首页 > 学院 > 开发设计 > 正文

jersey开发总结

2019-11-06 08:09:22
字体:
来源:转载
供稿:网友

        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.POST

         jersey获取POST传递过来的参数。

    @POST    @Consumes("application/x-www-form-urlencoded")    publicvoid post(@FormParam("name") String name) {     // Store the message    }


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表