tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Adding Transfer Encoding header if not present
Date Thu, 16 Sep 2010 15:56:49 GMT
Amit,

The Transfer-Encoding header is not one which you can just add to a request, and expect it

to work.  You should consult the HTTP RFC 2616, to find out what it really means.

In particular, a value of "chunked"
1) only makes sense if the request has a body (which is not the case for a GET request)
2) requires that this body is sent in a particular way (in chunks, as the name indicates)

Your servlet is not working in the way you expect, because your are sending an invalid 
HTTP request to Tomcat.
If your purpose is just to play around with HTTP headers and check if your servlet works 
properly, use Header names starting with "X-" for example.



Amit Puri wrote:
> Hi
> 
> Thanks a lot Mark and Andre for your replies.
> As per my requirement I want to add Transfer-Encoding in the client request
> header and send request to servlet for priniting the headers there. For one
> way, I am doing with Apache http server using mod_jk with mod_headers
> 
> <IfModule mod_headers.c>
> <Location /my-example>
> RequestHeader append Transfer-Encoding "chunked"
> </Location>
> </IfModule>
> 
> Here for testing purpose, If I print request.getHeader("transfer-encoding")
> in systemout, it comes as "chunked". But I am getting this error in the
> browser.
> 
> "OK
> The requested resource
> /my-example/myServlet
> does not allow request data with GET requests, or the amount of data
> provided in the request exceeds the capacity limit."
> 
> Any help will be appreciated.
> 
> Thanks
> Amit
> 
> 
> On Thu, Sep 16, 2010 at 1:47 PM, Mark Thomas <markt@apache.org> wrote:
> 
>> On 16/09/2010 00:15, André Warnier wrote:
>>> Did I totally misread the above, or is the OP talking about request
>>> headers, as received by the server from a client request ?
>>> In that case, I would think that if the servlet does not see a
>>> Transfer-Encoding header, it is because the client request does not
>>> contain one.
>> Yep. I mis-read it. Same issue applies though. Just because a client
>> sets it, doesn't mean Tomcat will see it.
>>
>> A quick look at the code doesn't suggest any reason why this wouldn't work.
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@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