package cactusServer.resources; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import cactusServer.entities.*; import cactusServer.models.Accounts; @Path("/accounts") public class AccountsRest { @PUT @Produces(MediaType.APPLICATION_JSON) public Session loginAccount(@FormParam("userID") String userID, @FormParam("userPass") String userPass) { return Accounts.getInstance().loginAccount(userID, userPass); } @POST @Path("/logout") @Produces(MediaType.TEXT_PLAIN) public String logoutAccount(@FormParam("token") String token) { return Accounts.getInstance().logoutAccount(token); } @POST @Produces(MediaType.APPLICATION_JSON) public Session createAccount(@FormParam("userID") String userID, @FormParam("userName") String userName, @FormParam("userPass") String userPass) { return Accounts.getInstance().createAcount(userID, userName, userPass); } @GET @Path("/{userID}") @Produces(MediaType.APPLICATION_JSON) public Account getAccount(@PathParam("userID") String userID) { return Accounts.getInstance().getAccount(userID); } }