REST Service Annotation

RESTful web services are easy to develop, and they have the ability to produce and consume different types of media i.e. information. In most cases, REST web services are encouraged for services that will be sending and receiving information over the Internet.

A Java class that is a REST service implementation contains a multiple annotations. The possible annotations that may be used to create a REST service.

Annotation :-
@POST
@GET
@PUT
@DELETE
@HEAD
@Path
@PathParam
@QueryParam
@Consumes
@Produces
@Provider

Annotation Description:-

@POST Request method designator that processes HTTP POST requests.

@GET Request method designator that processes HTTP GET requests.

@PUT Request method designator that processes HTTP PUT requests.

@DELETE Request method designator that processes HTTP DELETE requests.

@HEAD Request method designator that corresponds to the HTTP HEAD method. Processes HTTP HEAD requests.

@Path The value of this annotation should correlate to the relative URI path that indicates where the Java class will be hosted.Variables can be embedded in the URIs to make a URI path template.

@PathParam A type of parameter that can be extracted for use in the resource class. The URI path parameters are extracted from the request URI, and the parameter names correlate to the URI path template variable names that are specified in the @Path class-level annotation.

@QueryParam A type of parameter that can be extracted for use in the resource class.The Query parameters are extracted from the request.

@Consumes Used to specify the MIME media types of representations that a resource can consume.

@Produces Used to specify the MIME media types of representations that a resource can produce.

@Provider Used for anything that is of interest to the JAX-RS runtime, like MessageBodyHeader and MessageBodyWriter.