app/controllers/UserController.java
/**
     * Validate User Login Credentials from Android App,
     * which listens for expected responses.
     * Play route actions only return HTTP responses.
     */
Validate User Login Credentials from Android App,
which listens for expected responses.
Play route actions only return HTTP responses.
Validate User Login Credentials from Android App which listens for expected responses . Play route actions only return HTTP responses .
public Result androidValidate(){
        Form<User> loginForm = formFactory.form(User.class).bindFromRequest();
        if(loginForm.hasErrors()) {
            System.out.println("Problem with credentials.");
            return (ok("NOT_FOUND"));
        }
        else {
            User user = null;
            String username = loginForm.get().username;
            String password = loginForm.get().password;
            user = User.authenticate(username, password);
            if (user == null) {
                System.out.println("User not found.");
                return(ok("NOT_FOUND"));
            } else {
                session("username", loginForm.get().username);
                System.out.println("User Logged in.");
              return (ok(user.username));
            }
        }
    }
public Result androidValidate ( ) { Form < User > loginForm = formFactory . form ( User . class ) . bindFromRequest ( ) ; if ( loginForm . hasErrors ( ) ) { System . out . println ( "Problem with credentials." ) ; return ( ok ( "NOT_FOUND" ) ) ; } else { User user = null ; String username = loginForm . get ( ) . username ; String password = loginForm . get ( ) . password ; user = User . authenticate ( username , password ) ; if ( user == null ) { System . out . println ( "User not found." ) ; return ( ok ( "NOT_FOUND" ) ) ; } else { session ( "username" , loginForm . get ( ) . username ) ; System . out . println ( "User Logged in." ) ; return ( ok ( user . username ) ) ; } } }
Validate User Login Credentials from Android App,
 which listens for expected responses.
Validate User Login Credentials from Android App which listens for expected responses .
// Return Response to Android Volley.