Jax-rs annotations

Source: Internet
Author: User

@Path ("Resource_path"):
The @Path annotation defines the Path to the base URL or Resource_path. The base URL is based on the application's name, the servlet, and the URL pattern from the Web. XML configuration file.

@PathParam:
The @PathParam annotation is used to inject values from the URL into a method parameter. In this, one can inject, say, the ID of a resource to the method for getting the correct object.

@GET:
The @GET annotation indicates that the method would answer to an HTTP GET request.

@PUT:
The @PUT annotation indicates that the method would answer to an HTTP PUT request.

@POST:
The @POST annotation indicates that the method would answer to an HTTP POST request.

@DELETE:
The @DELETE annotation indicates that the method would answer to an HTTP DELETE request.

@Produces (Mediatype.text_plain):
The @Produces annotation defines which MIME type is delivered by a method annotated with any HTTP annotated methods. In the given example, a-text (Text/plain) is produced. Other examples would is application/xml or Application/json.

@Consumes (type):
The @Consumes annotation defines which MIME type is consumed by this method.

Jax-rs annotations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.