Jersey POST Request and Close InputStream

when I have a method in Jersey that listens for a POST request, and when I have an InputStream as an argument in the method from which I want to get data, I need to close this InputStream or will control Jersey

I did not find any information about this. I read RESTful Java with JAX-RS 2.0 a while ago, and I don't remember if that was mentioned. Now, looking through it, I found some code examples, and the stream is not closed. I would think that this is not necessary, but I would like to ask.

+7
inputstream jersey jax-rs
source share
1 answer

How do you get a link to InputStream? Via MessageBodyReader? In this case, if you are using MessageBodyReader, you should not close the InputStream. There is even an explicit warning in the documentation.

7.2.2.2. MessageBodyReader.readFrom

In any case, this link applies to Jersey v2. I don’t know how about version 1. Which version are you using?

0
source share

All Articles