I am a noobie with RESTful API and I am trying to build a Login service in which I provide an email and password and if the validation is successful - to store a cookie. In addition, how do I check the cookie(if stored)?
How can this be achieved?
@Path("/login")
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON})
public Response Login(final String i_LoginDetails) throws JSONException {
    final JSONObject obj = new JSONObject(i_LoginDetails);
    try {
        if (isValidUser(obj.getString("email"), obj.getString("password"))) {
            // Set a cookie
        } else {
            // return error invalid-credentials message
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return Response.ok("TEST").build();
}
And how do I check the cookie(if set)?
 
    