JAX-RS annotations
2016-01-09 19:43
316 查看
@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.
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.
相关文章推荐
- poj1275差分约束
- python中利用exec动态创建函数
- activemq 假死
- c++ 服务端 客户端
- python学习--------随机验证码生成
- TF-IDF与余弦相似性的应用(二):找出相似文章
- 【Git 使用笔记】第二部分:基本命令 和 单分支开发
- android音频
- php 实现 二维码 扫描登录
- android的网络通信
- 从僵尸网络追踪到入侵检测 第3章 Honeyd服务(23端口防御)
- Win10 UWP系列:更新UWP时注意的问题——TargetDeviceFamily
- CSS3 文本特效
- Android5.0实现全透明状态栏效果
- 机房重构——初出茅庐,总有险阻
- 个人阅读作业 --软件工程M1/M2总结
- 关于win8系统下的80端口被占用,Apache启动失败.2,MySQL5.1启动失败,请检查相关配置
- htmlunit+Jsoup实现网页抓取
- jQuery之操作DOM元素
- 在团队开发中使用 CocoaPods 的小技巧