Hi Alan,
On Apr 24, 2009, at 8:23 PM, Alan Harder wrote:
> Hi-
> I'm using JMXRestAdaptor with Jersey 1.0.3 and Java 6u13  
> HttpServer.  I find that I  get responses with "Transfer-encoding:  
> chunked".  How can I tell it the size of the response so it will use  
> Content-Length instead?
>
Why do you require that?
This would be a configuration feature of the HttpServer container.  
Jersey does not dictate to the container to support chunked or non- 
chunked transfer encoding. Jersey will never buffer a response entity  
to determine what the content length of the response entity is. Where  
it is known Jersey will attempt to inform the container what the  
length is, for example, if an instance of File or byte[] os returned.
If you really want to know, on the client side, the length of a  
chunked encoded response, then you can buffer the response by reading  
all the bytes of the input stream and writing them to a  
ByteArrayOutputStream. However, i will would recommend avoiding  
buffering unless you really require it, as it makes things more  
inefficient and is always a potential source of out of memory errors.
Paul.
> JMXRestAdaptor source:
> https://opendmk.dev.java.net/source/browse/opendmk/contributions/rest-adaptor/RestAdaptor/src/com/sun/jdmk/contrib/rest/JMXMBeanRestResource.java?rev=1.4&view=markup
>
> Thanks,
>
>     - Alan
>
>
> --------------------------------------------------------------------- To 
>  unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net For  
> additional commands, e-mail: users-help_at_jersey.dev.java.net