Harald Kirsch wrote:
>
> Am 23.07.2008 10:37 schrieb Paul Sandoz:
>> Harald Kirsch wrote:
>>> Ok, that would do it at least for my application, since I am using
>>> InputStream. But what I get is actually a ByteArrayInputStream and so I
>>> am afraid the input was first completely read into memory.
>>>
>> Jersey does not attempt to buffer bytes when using an InputStream. It
>> passes the InputStream directly from the container (servlet or
>> otherwise). So i am not sure what is going on... can you share some code?
>
> This is pretty boring. I have a small standalone application and the
> relevant bits of code are:
>
> Start the standalone HttpServer:
>
> import com.sun.net.httpserver.HttpServer;
> ...
> HttpServer server =
> HttpServerFactory.create("http://localhost:"+port+'/');
> server.start();
>
> Get control some time later in this method:
>
> public Response upload(@FormParam("upload") InputStream in) throws
> IOException
>
> Printing 'in' shows that it is a ByteArrayInputStream. So I guess you
> are right and it is the fault of this HttpServer. Maybe I should check
> with Tomcat then, for example.
>
Ah! the example was most helpful. In this case it is not the container.
You are using @FormParam i presume with "multipart/form-data". What
happens is that Jersey will use the JavaMail API to process the
information and extract out the body part with the content disposition
named "upload"
So the problem is in JavaMail (it buffers). Perhaps it is the the way
Jersye uses the JavaMail API. I hoped that the way i was using it would
ensure that buffering would not be performed. Drat :-( I may need to use
something other than JavaMail...
Could you log an issue on this?
Thanks,
Paul.
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109