tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wingfield <jon.wingfi...@mkodo.com>
Subject Re: Removal of headers in HttpServletResponse object
Date Fri, 21 Jul 2006 10:10:53 GMT
You'll probably need to write your own connector!

See prepareResponse method:
http://svn.apache.org/repos/asf/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11Processor.java
http://svn.apache.org/repos/asf/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java

In any case, at the very least the Date header is mandatory in the 
response for an HTTP/1.1 response (see rfc2616).

Jon

Geir Øvsttun (AS/ETO) wrote:
> Hi all,
> 
> I am still struggling with the removal of header problem.
> 
> I found that the ServletResponse has a reset() method which should delete all headers.
> I thought maybe I could use this and then reconstruct the response object with only the
headers I want.
> I tried to do call this method in the http servlet code itself but when the object is
returned Tomcat reconstruct the original headers before sending the response to the client.
> 
> For this to work must the reset() method be called from a Filter or a Valve ?
> 
> Geir :-)
>  
> 
> -----Original Message-----
> From: Geir Øvsttun (AS/ETO) [mailto:geir.ovsttun@ericsson.com] 
> Sent: 21. juli 2006 08:41
> To: Martin Gainty; users@tomcat.apache.org
> Subject: RE: Removal of headers in HttpServletResponse object
> 
> Hi Martin,
> 
> Thanks for the feedback but I am afraid that the example did not really solve my problem.
> 
> As far as I can understand your example only includes adding a header not removing.
> It also relies on the standard HttpServletResponse methods which does not include a removeHeader
method.
> 
> Geir :-)
> 
> -----Original Message-----
> From: Martin Gainty [mailto:mgainty@hotmail.com]
> Sent: 20. juli 2006 19:25
> To: Geir Øvsttun (AS/ETO)
> Subject: Re: Removal of headers in HttpServletResponse object
> 
> Geir-
> 
> I found a complete Tomcat Valve example here at http://www.explain-it.org/mediawiki/index.php/TomcatValve
> where the invoke() method would modify the outgoing response to omit the Header ..
> 
> Sverige Altid-
> Martin --
> *********************************************************************
> This email message and any files transmitted with it contain confidential information
intended only for the person(s) to whom this email message is addressed.  If you have received
this email message in error, please notify the sender immediately by telephone or email and
destroy the original message without making a copy.  Thank you.
> 
> 
> 
> ----- Original Message -----
> From: "Geir Øvsttun (AS/ETO)" <geir.ovsttun@ericsson.com>
> To: <users@tomcat.apache.org>
> Sent: Thursday, July 20, 2006 6:09 AM
> Subject: Removal of headers in HttpServletResponse object
> 
> 
> Hi ,
> 
> For fast prototyping and test purposes I am trying to simulate the responses of various
devices (web cameras with embedded web servers) by using Tomcat.
> The problem I have is that Tomcat (5.5.17) seems to add by default the following headers
to the HTTP/1.1 200 OK response:
> 
> Server: Apache-Coyote/1.1
> Content-Type: text/html;charset=ISO-8859-1
> Content-Length: 82
> Date: Thu, 20 Jul 2006 09:53:33 GMT
> 
> These headers are not included by the various embedded devices I am trying to simulate.
> 
> As the HttpServletResponse class does not have a removeHeader method (only add... And
set...) I am stuck.
> 
> I have tried to look into the use of Filters but to my understanding the Filter also
relies on the methods of HttpServletResponse for manipulation of the response object.
> 
> Can Tomcat in any way be configured to not include the headers ?
> Are there any other way to remove the headers ?
> 
> Geir :-)  
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message