Showing posts with label how to use queryparam in jersey. Show all posts
Showing posts with label how to use queryparam in jersey. Show all posts

Saturday, 11 April 2015

QueryParam Annotation In Jersey



 @QueryParam Annotation In  Jersey

Example:


http://localhost:8080/JerseyDemo/rest/user/12?p=10


@Path("/user")
public class UserHander {

    @GET
    @Path("/{id}")
    public Response addUser(@PathParam("id") int id,@QueryParam("p") int page) {
        System.out.println("id=" + id+"page="+page);
        String str = "id is=" + id+"page="+page;
        return Response.status(Status.OK).entity(str).build();
    }

}

Output:

id is=12page=10