dev@glassfish.java.net

Re: Duplicate http headers

From: Ashish Sahni <Ashish.Sahni_at_Sun.COM>
Date: Wed, 31 Jan 2007 18:18:33 -0800

Hi Jeanfrancois,

Actually this is as a regular webapp ie, within GlassFish web container
not standalone grizzly.

-Ashish

Jeanfrancois Arcand wrote:
> Hi Ashish,
>
> Ashish Sahni wrote:
>> Hi,
>> I have a web application that passes the
>> httpservletresponse(outputstream actually)
>> to an external lib/code that I don't have control over.
>> The application seems to be working correctly other than the fact
>> that the http headers
>> are duplicated in the response(see below).
>> I remember seeing a discussion on http-header-duplication but can't
>> seem to find it
>> and nothing seems to jump out in API docs.
>>
>> How do I prevent the webcontainer from 'committing' the http response
>> headers ?
>
> This happens with Grizzly standalone, right? Not with the normal
> Grizzly/GlassFish HTTP port. You need to do something like:
>
> ((c.s.e.w.connector.grizzly.SocketChannelOutputBuffer)org.apache.coyote.Response.getOutputBuffer()).commit();
>
>
> before writing bytes using the SocketChannel. This will discard the
> Grizzly HTTP header, and then you will be able to add yours. You can
> find the complete Rails example here:
>
> http://fisheye5.cenqua.com/browse/glassfish/appserv-http-engine/modules/rails/src/main/java/com/sun/grizzly/rails/RailsAdapter.java?r=1.6
>
>
> Thanks
>
> -- Jeanfrancois
>
>
>
>
>>
>> Thanks
>> Ashish
>>
>>
>> HTTP/1.x 200 OK
>> X-powered-by: Servlet/2.5
>> Content-Type: text/plain; charset=iso-8859-1
>> Transfer-Encoding: chunked
>> Date: Wed, 31 Jan 2007 23:52:02 GMT
>>
>> HTTP/1.1 200 OK
>> Date: Wed, 31 Jan 2007 23:52:02 GMT
>> Content-Type: text/html
>> Set-Cookie: _session_id=253bb5948d11ecf0671e4af2bb9b2cee; path=/
>> Status: 200 OK
>> Cache-Control: no-cache
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>


-- 
Ashish
http://blogs.sun.com/whacko