/** * Visits a path segment * @param pathSegment the path segment * @return a sub resource (which can possibly continue dispatch if it is itself an Resource) or null. */ @Path("{pathSegment}") public Object consumePathSegment(@PathParam("pathSegment") String pathSegment) { try { FileObject child = getChildLocation(pathSegment); return consumePathSegment(pathSegment, child, getResourceResolver()); } catch (FileSystemException e) { logger.error("Could not access child: " + pathSegment, e); throw new WebApplicationException(404); } }
public Object getSubResource(String subResourceName) throws Exception { FileObject subResourceLocation = getChildLocation(subResourceName); return getSubResource(subResourceLocation, subResourceName, getResourceResolver()); }
@Override public ResourcePermissions getPermissions() { try { Map permissions = getResourceResolver().resolve(location, "permissions", Map.class); if(permissions != null) { Map<String, List<String>> allow = (Map<String, List<String>>) permissions.get("allow"); Map<String, List<String>> deny = (Map<String, List<String>>) permissions.get("deny"); return new ResourcePermissions(this, translatePermissions(allow), translatePermissions(deny)); } else { return getEmptyResourcePermissions(); } } catch (Exception e) { logger.error("Could not load permissions for " + location, e); return getEmptyResourcePermissions(); } }