开发者

Rest path question

I have some code as a rest resource :

@GET
@Produces ( { "application/json" } )
@Path ("/some/{some}")
public JSONObject retrieveSome(@PathParam("some") final String some) {
    //body of the method
}

What does the 开发者_如何学JAVA@Path ("/some/{some}") mean?


The @Path annotation creates a URI template of sorts. The {some} portion gives a name to that portion of the resource path. So if the URI is /some/1234 then retrieveSome will be invoked with the some parameter set to 1234. So the @Path annotation creates the template and the @PathParam annotation extracts a named portion of the template. Read @Path Annotation and URI Path Templates for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜