How to call different methods from single webservices class
Posted
by
pointer
on Stack Overflow
See other posts from Stack Overflow
or by pointer
Published on 2013-10-20T09:52:06Z
Indexed on
2013/10/20
9:53 UTC
Read the original article
Hit count: 282
I have a following RESTful webservice, I have two methods for http get. One function signs in and other function signs out a user from an application. Following is the code:
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
/**
* REST Web Service
*
* @author Pointer
*/
@Path("generic")
public class GenericResource {
@Context
private UriInfo context;
/**
* Creates a new instance of GenericResource
*/
public GenericResource() {
}
/**
* Retrieves representation of an instance of
* com.ef.apps.xmpp.ws.GenericResource
*
* @return an instance of java.lang.String
*/
@GET
@Produces("text/html")
public String SignIn(@QueryParam("username") String username, @QueryParam("password") String password, @QueryParam("extension") String extension) {
//TODO return proper representation object
return "Credentials " + username + " : " + password + " : " + extension;
}
@GET
@Produces("text/html")
public String SignOut(@QueryParam("username") String username, @QueryParam("password") String password, @QueryParam("extension") String extension) {
//TODO return proper representation object
return "Credentials " + username + " : " + password + " : " + extension;
}
}
Now, where would I specify that which function I want to call for http get?
© Stack Overflow or respective owner