class RepositoryPermissionsJaxrsService {

    @GET
    @Path("/{uri:.+}")
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response getPermissionsEntryPoint(@Context UriInfo uriInfo) throws ErrorDescriptorException {
        PermissionComplexKey permissionComplexKey = new PermissionComplexKey(uriInfo).invoke();
        MultivaluedMap<String, String> queryParams = permissionComplexKey.getQueryParams();

        Response response;
        if (permissionComplexKey.getRecipientUri() == null){
            response = getPermissions(permissionComplexKey.getResourceUri(),
                    "true".equalsIgnoreCase(queryParams.getFirst("effectivePermissions")),
                    queryParams.getFirst("recipientType"),
                    queryParams.getFirst("recipientId"),
                    "true".equalsIgnoreCase(queryParams.getFirst("resolveAll")),
                    parseIntParam(RestConstants.QUERY_PARAM_OFFSET, queryParams.getFirst(RestConstants.QUERY_PARAM_OFFSET)),
                    parseIntParam(RestConstants.QUERY_PARAM_LIMIT, queryParams.getFirst(RestConstants.QUERY_PARAM_LIMIT)));
        } else {
            response = getPermission(permissionComplexKey.getResourceUri(), permissionComplexKey.getRecipientUri());
        }
        return response;
    }

}