bharal
bharal

Reputation: 16184

Play framework - access Request object inside java controller?

How do I access the request object inside my java controller in the play framework?

The Scala tutorial-page references some sort of "request" object, but I don't see how to access that in the Java tutorial-page.

I'm using Play Framework 2.5

Upvotes: 0

Views: 1189

Answers (2)

Ilan Gur
Ilan Gur

Reputation: 1

Just add explicitly type: Action { request: Request[_] => ... }

Upvotes: 0

Al-Mothafar
Al-Mothafar

Reputation: 8219

The answer is really clear and straightforward:

When you call request() you access to the requests object, like headers and body, example request().body()

Much more here: https://www.playframework.com/documentation/2.5.x/JavaBodyParsers

Upvotes: 1

Related Questions