below you find an example of resource that returns a collection of
entities with pagination ...
I was thinking in a standard way to move the logging and validation
from this code to something external..
@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/readall")
public Collection<FpOrganization> readAll(@PathParam("offset") int
offset, @PathParam("limit") int limit) {
try {
if (offset < 0) {
offset = 0;
}
if (limit <= 0
|| limit > EntityFacadeConstants.MAX_PAGINATION_CHUNK.INT_VALUE) {
limit = EntityFacadeConstants.DEFAULT_PAGINATION_CHUNK.INT_VALUE;
}
return organizationFacade.readAll(offset, limit);
} catch (IllegalStateException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
throw e;
} catch (IllegalArgumentException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
throw e;
}
}
--
Please help to test this application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces