首页 > 其他 > 详细

JAX-RS annotations

时间:2016-01-09 20:09:14      阅读:217      评论:0      收藏:0      [点我收藏+]

@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 way, one can inject, say, the ID of a resource into the method for getting the correct object.

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

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

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

@DELETE:
The @DELETE annotation indicates that the method will 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 be application/xml or application/json.

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

JAX-RS annotations

原文:http://www.cnblogs.com/IcanFixIt/p/5117093.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!