Hi,

I am modifying the Tomcat 4.0.4 to make it a proxy cache server.

I am extending the container's (StandardHost) invoke(Request, Response) function  to 
be able to forward a request if there is no cache for it. I use the apache 
commons-httpclient to implement the forwarding semantics.
While I implement the transfering of data from httpclient method object to the 
Response object, I noticed some strange behavior regarding the Response object. 

What I did is first get a HttpServletResponse object reference from the Response 
object hresp, then I will call a loop of 
   resp.setHeader(....) , 
then I do
  OutputStream os = resp.getOutputStream();
  os.write(response_body_text_as_byte_array)

When the origin server is another Tomcat server, it does not work, however
if I comment out resp.setHeader(...), it is working (I mean the result shown in the 
browser)

I do the forwarding inside a servlet, even with rest.setHeader(...), it still works.

I wonder why is that? BTW, I am using IE 6 as browser.

I feel I should do the setting of headers, they may contain cookies and other info.

When I try against www.microsoft.com (url in the request), with header setting, it 
works, 
without header setting, it does not. Quite the opposite of Tomcat.

When I try against www.yahoo.com, i find the same behavior as Tomcat.

I wonder how it is related to the origin server, the format of their response or 
version?

Thanks!

--Zhenxin Wang
DoCoMo Labs USA


Reply via email to