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 :
http://localhost:8080/JerseyDemo/rest/user/27
Where "27" is the id of the user. So, in the code, I specified like this
@Path("/user")
public class UserHander {
@GET
@Path("/{id}")
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