Hi all,

I'm not sure if this is the right channel to go for help, but there seems to be no separate user list, so I'll take a shot here.

I need to create a HttpHandler that fully reads the request body and stores it into a buffer or byte[] before ending the exchange. For this, I'm trying to digest what Undertow's RequestBufferingHandler does.

It seems that I have to take care of the scenario where the handler is called before the entire request body is available on the stream by doing the following:
- read from the stream
- check whether I've hit the end of the stream when as many bytes as possible have been read
- if not, register a listener on the stream and continue handling the request from there
- if so, handle the request from the handler directly
- finally close the stream

Can someone assert that the above is correct?

Also, are there general pointers to what I'd like to achieve (read the request body into a buffer)?


Many thanks, cheers,
Friso