Version 2

    Using @Path and other HttpMethods


    public class Library {
       public String getBooks() {...}
       public String getBook(@PathParm("isbn") String id) {
          // search my database and get a string representation and return it
       public void addBook(@PathParam("isbn") String id, @QueryParam("name") String name) {...}
       public void removeBook(@PathParam("id") String id {...}


    The annotation must exist on either the class and/or a resource method.  If it exists on both the class and method, the relative path to the resource method is a concatenation of the class and method.


    In the package there are annotations for each HTTP method.  @GET, @POST, @PUT, @DELETE, @HEAD, @OPTIONS.  You place these on public methods that you want to map to that certain kind of HTTP method.  As long as there is a @Path annotation on the class, you do not have to have a @Path annotation on the method you are mapping.  You can have more than one HTTP method as long as they can be distinguished from other methods.  See PathParam and JAXRSContentNegotiation for more examples of this case.


    When you have a @Path annotation on a method without an HTTP method, these are called JAXRSResourceLocators.