jersey在开发的过程中能够使用一些注解来获取请求参数不仅够使提高开发速度,而且能够使看起来更加代码简介,易于阅读。现将在jersey开发过程中使用到的一些知识进行总结如下:
1.GET
jersey获取GET传递过来的参数。
@GET @Path("/{param}") @PRoduces("text/plain;charset=UTF-8") public String sayHelloToUTF8(@PathParam("param") String username) { return "Hello " + username; } 2.POSTjersey获取POST传递过来的参数。
@POST @Consumes("application/x-www-form-urlencoded") publicvoid post(@FormParam("name") String name) { // Store the message }
新闻热点
疑难解答