Thursday, January 14, 2016

Brief view in JAX-RS (Java API for RESTful Web Services)

What is JAX-RS

Java API for RESTful Web Services (JAX-RS) is a Java programming language API that provides support in creating web services according to the Representational State Transfer (REST) architectural pattern.

JAX-RS is an official part of Java EE 6.

Annotations in JAX-RS 

JAX-RS uses these annotations:
 In addition, it provides further annotations to method parameters:
  • @PathParam binds the method parameter to a path segment.
  • @QueryParam binds the method parameter to the value of an HTTP query parameter.
  • @MatrixParam binds the method parameter to the value of an HTTP matrix parameter.
  • @HeaderParam binds the method parameter to an HTTP header value.
  • @CookieParam binds the method parameter to a cookie value.
  • @FormParam binds the method parameter to a form value.
  • @DefaultValue specifies a default value for the above bindings when the key is not found.
  • @Context returns the entire context of the object (for example @Context HttpServletRequest request).
 Source: wikipedia