Search This Blog

Friday, January 30, 2015

JAX-RS Annotations

@Path - at class level specifies the context path to access this web service

@Path - at method level specifies the path to access the actual method in the web service

@Produces - is used to specify the MIME media type for the return type of the method

@Consumes - is used to specify the MIME media type for the parameter type accepted as input to a method

@PathParam - is used to accept input from the request URL path specified by @Path

@QueryParam - is used to get query parameters from URL

@DefaultValue - is used to specify default value if no query parameters are specified

@MatrixParam - is used to specify a set of "name=value" pairs separated by ";" in the URI path

@CookieParam - is used to get the parameters from cookie, eg, 

@FormParam - is used to get HTML form parameter values

@Context - is used to get the contextual java types of request or responses like ServletContext, ServletConfig,
    HttpServletRequest and HttpServletResponse etc

@BeanParam - is used to hold multiple parameters as a single entity (bean)

@HeaderParam - is used to get information from the HTTP headers

No comments: