@Override
public HttpResponseObject execute(HttpRequestObject request) {
JSONObject body = request.getBody();
// Build Log Service For logging in Your Code
// LogService logger = sp.buildLogService();
// logger.debug(" Recieved Request Body : :" + body.toString(), moduleName);
// Write Your Custom Code Here
// ......//
try
{
state = body.getString("state");
if(state.toLowerCase().equals("register"))
createUser(body); // call : userService.createUser
else if(state.toLowerCase().equals("login"))
doLogin(body); // call : userService.authenticate
else
setErrorResponse(state, "No State Given");
}
catch(Exception e)
{
setErrorResponse(state, e.getMessage());
}
// Create JSON Response Based on Your business logic
// Return JSON Response and Status Code
return new HttpResponseObject(HTTP_STATUS_SUCCESS, jsonResponse);
}