package cactusServer.resources; import java.net.URI; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import cactusServer.entities.Account; import cactusServer.models.Accounts; @Path("/AccountsRest") public class AccountsRest { @POST @Path("/login") @Produces(MediaType.APPLICATION_JSON) public String loginAccount(@QueryParam("userID") String userID, @QueryParam("userPass") String userPass) { if(Accounts.getInstance().getAccount(userID).getPass().equals(userPass)) { return getAccount(userID); }else { return "failed login attempt"; } } @POST @Path("/logout") @Produces(MediaType.APPLICATION_JSON) public String logoutAccount(@QueryParam("userID") String userID) { return ""; } @POST @Path("/createAccount") @Produces(MediaType.APPLICATION_JSON) public Account create(@QueryParam("userID") String userID, @QueryParam("userName") String userName, @QueryParam("userPass") String userPass) { return Accounts.getInstance().createAcount(userID, userName, userPass); } @GET @Path("/getAccount") @Produces(MediaType.APPLICATION_JSON) public Account getAccount(@QueryParam("userID") String userID) { return Accounts.getInstance().getAccount(userID); } }