开发者

Rest path question

开发者 https://www.devze.com 2023-02-01 04:38 出处:网络
I have some code as a rest resource : @GET @Produces ( { \"application/json\" } ) @Path (\"/some/{some}\")

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

精彩评论

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