Hello all, I want to set header parameters of http response in my servlet.
I set parameters as below: ************************************** theResponse.reset(); theResponse.resetBuffer(); theResponse.setHeader("Request Version", "HTTP/1.1"); theResponse.setStatus(200); theResponse.setHeader("Date", "Wed, 18 Apr 2007 09:24:04 GMT"); theResponse.setHeader("Server", "Tomcat"); theResponse.addCookie(theRequest.getCookies()[0]); theResponse.setHeader("pragma", "no-cache"); // HTTP 1.0 theResponse.setHeader("Cache-Control", "no-cache"); // HTTP 1.1 theResponse.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); // a past date theResponse.setDateHeader("Last-Modified", (new java.util.Date()).getTime()); theResponse.setHeader("Connection", "close"); theResponse.setContentType("text/plain"); theResponse.flushBuffer(); //.......... //some other things... //.......... PrintWriter aPrintWriter = theResponse.getWriter(); aPrintWriter.write("this is the string to be put into the body part of the http packet."); aPrintWriter.flush(); ************************************** However, when I check what I am sending as response (using the ethereal network sniffing tool) I see the result below: *************************************** HTTP/1.1 200 OK\r\n Request Version: HTTP/1.1 Response Code: 200 Server: Apache-Coyote/1.1\r\n Content-Length: 68\r\n Date: Tue, 24 Apr 2007 17:55:10 GMT\r\n \r\n Data (68 bytes) *************************************** I am setting header parameters as it should be.. But it doesn't care about my parameters and Tomcat puts some values that it selects itself.. Would anyone has any idea about what I am doing wrong here..? Thanks & Regards Huseyin Sinecan --------------------------------- Ahhh...imagining that irresistible "new car" smell? Check outnew cars at Yahoo! Autos.