A way to get the raw http request ?

58 views
Skip to first unread message

Thibault Meyer

unread,
Mar 23, 2017, 5:41:23 PM3/23/17
to Play Framework
Hello


is it possible to get the low level http request body ? I need it to pass it to WSClient to perform / forward a POST request.


Sincerely.

Will Sargent

unread,
Mar 23, 2017, 6:03:29 PM3/23/17
to play-fr...@googlegroups.com
What do you mean by "low level"?

--
Will Sargent
Engineer, Lightbend, Inc.


--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/5b5537cc-8081-4bdb-8afd-e13971417e15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thibault Meyer

unread,
Mar 24, 2017, 2:52:02 AM3/24/17
to Play Framework
To get the "body" content without regarding the Content-Type header. Actually if Content-Type is "application/json"   request().body().asText() or asRaw() return null.

Is Play have a method to retrieve the raw body data ? like this :



------WebKitFormBoundaryVegICUWvxiLnv05I
Content-Disposition: form-data; name="file"; filename="demo.csv"
Content-Type: text/csv

registrationToken,uid,canUpdate
"ba7366d0-f75e-4e17-b5ea-16c3cb479b0a","710dc37f-ce47-47dd-9439-299a3621fa01","4e7c5074-c500-47a3-b31f-5438dc2dbfdd","1K01267347877"

------WebKitFormBoundaryVegICUWvxiLnv05I
Content-Disposition: form-data; name="format"

csv
------WebKitFormBoundaryVegICUWvxiLnv05I--



Le jeudi 23 mars 2017 23:03:29 UTC+1, Will Sargent a écrit :
What do you mean by "low level"?

--
Will Sargent
Engineer, Lightbend, Inc.


On Thu, Mar 23, 2017 at 2:41 PM, Thibault Meyer <thibaul...@payintech.com> wrote:
Hello


is it possible to get the low level http request body ? I need it to pass it to WSClient to perform / forward a POST request.


Sincerely.

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.

Igmar Palsenberg

unread,
Mar 24, 2017, 4:15:34 AM3/24/17
to Play Framework


Op vrijdag 24 maart 2017 07:52:02 UTC+1 schreef Thibault Meyer:
To get the "body" content without regarding the Content-Type header. Actually if Content-Type is "application/json"   request().body().asText() or asRaw() return null.

Is Play have a method to retrieve the raw body data ? like this :

Thibault Meyer

unread,
Mar 24, 2017, 4:29:44 AM3/24/17
to Play Framework
Hi Igmar,

thank you for helping. @BodyParser.Of(BodyParser.Bytes.class) do the job.

Sincerely.

Will Sargent

unread,
Mar 24, 2017, 7:36:31 PM3/24/17
to play-fr...@googlegroups.com
You can't get at the preprocessed input after you've processed it with a body parser -- you have to pick a Raw or Bytes body parser. 

--
Will Sargent
Engineer, Lightbend, Inc.


To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/cc8df61f-abf4-485f-ab1f-77775f76187b%40googlegroups.com.

Thibault Meyer

unread,
Mar 25, 2017, 3:43:06 AM3/25/17
to Play Framework
Hi Will,

Thanks for help
Reply all
Reply to author
Forward
0 new messages