The root-resource classes are Plain Old Java Objects (POJO), which are either annotated with @Path
or have at least one method annotated with @Path
or a request method designator, such as @GET
, @PUT
, @POST
, or @DELETE
. Resource methods are methods of a resource
class that are annotated with a request-method designator.
Let's look at the JAX-RS annotations:
@Path("resource_path"):
The
@Path
annotation defines the path to the base URL orresource_path
. The base URL is based on the application's name, the servlet, and the URL pattern from theweb.xml
configuration file.@PathParam:
The
@PathParam
annotation is used to inject values from the URL into a method parameter. In this way, one can inject, say, the ID of a resource into the method for getting the correct object.@GET:
The
@GET
annotation indicates that the method will answer to an HTTP GET request.@PUT:
The
@PUT
annotation indicates that the method will answer to an HTTP PUT request.@POST: