request.inputStream always empty?
I have the following issue that I just can't manage to solve myself:
From a Java client application, I am trying to upload a huge file to a Grails controller/web application. As you can imagine, a simple form-based upload is not working for this purpose (we will be dealing with a lot of files larger than 2GB and need uploads to be paused and resumed later on). I figured that the best way to do this is using URLConnection on the Java side and just use the OutputStream of that to send data directly to the InputStream on the Grails side.
It turns out that I actually can connect to the controller method, but when I try to read from request.inputStream, that stream is always empty.
I tried the following:
- Different HTTP methods (GET, POST, ...)
- Different types of data sent (as byte, String, ...)
- Different order of flush()/close()/connect() as well as InputStream/OutputStream (on the Java side)
- More things that I just can't remember, I guess (did a lot rearranging and modifying)
The result is always the same: I get through to the controller method, it starts working. The InputStream on the Grails side is always empty.
What am I doing wrong?
You can find a brief code snippet that describes my problem here: http://pastebin.com/5xWwuxhz
Well, I hope to find some help here...any help is highly appreciated (or link or pointer or ...).
Thanks a lot in advance!
Greets - steps