1

I'm new in the play framework. I'm using play 2.8.x framework and I need to get from the controller session object and params from request. But I don't realize how to do that. My routes file looks like the following:

POST /api/verifyToken/:token        controllers.UserController.verifyToken(token: String, request: Request)

and my controller looks like this:

public class UserController extends Controller {
    public Result verifyToken(String token, Http.Request request) {
        ...
    }
}

and when I try to send a request to the server I had had an error but if I remove token parameter all is working fine.
How can I pass the request and params to the controller?

1
  • How does you request look like? What is the error you got? Commented Feb 28, 2020 at 7:20

1 Answer 1

1

Your handler is given the Http.Request when it is called:

java.util.Map<java.lang.String,java.lang.String[]> queryParams = request.queryString();

for the session:

Http.Session session = request.session();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.