@GET public Response findModels( @Auth AuthModelT authModel, @QueryParam("limit") Optional<Integer> limit, @QueryParam("offset") Optional<Integer> offset, @QueryParam("sort") Optional<String> sort, @Context HttpServletRequest request) throws HttpCodeException { ResultsSet<ModelT> results = man.find(getContext(authModel, limit, offset, sort)); return res().success(res().listData(results)); }
@Path("/{id}") @GET public Response findModel( @Auth AuthModelT authModel, @PathParam("id") PrimaryKeyT id, @Context HttpServletRequest request) throws HttpCodeException { ModelT model = man.find(getAuthContext(authModel), id); if (model == null) { throw new HttpNotFoundException( "Could not find " + modelClass.getSimpleName() + " with id " + id); } return res().success(res().modelData(model)); }