我有一个以下 RESTful 网络服务,我有两种 http get 方法。一个功能登录,而其他功能将用户从应用程序中注销。以下是代码:
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;
}
}
现在,我将在哪里指定我想为 http get 调用哪个函数?