Java Reference
In-Depth Information
@Produces({"application/xml", "application/json"})
public List<Customer> findAll() {
return super.findAll();
@Produces({"application/xml", "application/json"})
public List<Customer> findRange(@PathParam("from")
Integer from, @PathParam("to")
Integer to) {
return super.findRange(new int[]{from, to});
public String countREST() {
return String.valueOf(super.count());
As evident by the @Stateless annotation, the generated class is a stateless session
bean. The @Path annotation is used to identify the Uniform Resource Identifier
( URI ) that our class will serve requests for. As we can see, several of the methods
in our class are annotated with the @POST , @PUT , @DELETE , and @GET annotations.
These methods will be automatically invoked when our web service responds to
the corresponding HTTP requests. Notice that several of the methods are annotated
with the @Path annotation as well, the reason for this is that some of these methods
require a parameter, for example, when we need to delete an entry from the
CUSTOMER table, we need to pass the primary key of the corresponding row as a
parameter. The format of the value attribute of the @Path annotation is "{varName}" ,
the text between the curly braces is known as a path parameter . Notice that the
method has corresponding parameters that are annotated with the @PathParam
Search WWH ::

Custom Search