Saturday, 11 April 2015

PathParam Annotation In Jersey

 @pathparam  Annotation

Binds the value of a URI template parameter or a path segment containing the template parameter to a resource method parameter, resource class field, or resource class bean property. 

 Example :


Where "27" is the id of the user. So, in the code, I specified like this

public class UserHander {

    public Response addUser(@PathParam("id") int id) {
        System.out.println("id=" + id);
        String str = "id is=" + id;
        return Response.status(Status.OK).entity(str).build();


No comments:

Post a Comment