Reputation: 1601
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?
Upvotes: 1
Views: 253
Reputation: 4608
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();
Upvotes: 1