JAX-RS annotations

Annotation Description
@PATH(your_path) Sets the path to base URL + /your_path. The base URL is based on your application name, the servlet and the URL pattern from the web.xml” configuration file.
@POST Indicates that the following method will answer to a HTTP POST request
@GET Indicates that the following method will answer to a HTTP GET request
@PUT Indicates that the following method will answer to a HTTP PUT request
@DELETE Indicates that the following method will answer to a HTTP DELETE request
@Produces(MediaType.TEXT_PLAIN [, more-types ]) @Produces defines which MIME type is delivered by a method annotated with @GET. In the example text (“text/plain”) is produced. Other examples would be “application/xml” or “application/json”.
@Consumes(type [, more-types ]) @Consumes defines which MIME type is consumed by this method.
@PathParam Used to inject values from the URL into a method parameter. This way you inject for example the ID of a resource into the method to get the correct object.
Advertisements