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

No comments:

Post a Comment