Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to turn off "chunked" encoding in http response in jetty 7?

Tom Lee wrote:
> Hi,
>  
> I'm currently using Jetty 7 (embedded mode) and Jersey in a demo java
> project to implement some REST web services.  I notice that by default
> Jetty uses chunked transfer-encoding for http responses. I'm just
> wondering if there is a way I can turn chunking OFF (besides reverting
> back to HTTP/1.0 instead of 1.1)?. 
>

Tom,

Chunked is used when jetty cannot work out the length of the response.
I needs to know the length, because HTTP/1.1 uses persistent connections
by default.

So to avoid chunking you either need to set the response content length
or to avoid persistent connections by setting "Connection":"close" header
on the response.

cheers




Back to the top