Hello,
Thanks for the answer.. Here is the complete code of doGet method:
************************
protected void doGet(HttpServletRequest theRequest, HttpServletResponse
theResponse) throws ServletException, IOException {
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("Set-Cookie",
"JSESSIONID=FixForBuggyProxy;Version=1;Discard;Path=\"/\""); // HTTP 1.1
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("Set-Cookie2",
"JSESSIONID=ForBuggyCachingProxies;Path=\"/\""); // HTTP 1.1
theResponse.setHeader("Connection", "close");
theResponse.setContentType("text/plain");
theResponse.flushBuffer();
String aResponse = "";
try {
RequestProcessor aRequestProcessor = new RequestProcessor();
aResponse = aRequestProcessor.processRequest(theRequest);
} catch (InvalidReqException e) {
System.out.println("EXCEPTION OCCURED: " + e);
} //end of try-catch block
catch (Exception ex) {
System.out.println(ex);
}
//theResponse.setContentLength(aResponse.length());
PrintWriter aPrintWriter = theResponse.getWriter();
aPrintWriter.write(aResponse);
aPrintWriter.flush();
} //end of doGet method
************************
I think I am playing with the correct response...
And here is an example communication between the client and my servlet
application:
*******************************
POST /MmpNg/MmpNgServlet?x=y HTTP/1.1
Cookie: JSESSIONID=FixForBuggyProxy
User-Agent: OutlookAddin
Host: 192.168.10.77
Content-Length: 163
Cache-Control: no-cache
"data coming from client"
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 68
Date: Tue, 24 Apr 2007 17:55:10 GMT
"data to be sent to client"
*******************************
Would you have any comments on this..? Sth is certainly wrong, but I am not
able to see it..
Thanks & Regards
Huseyin Sinecan
Hassan Schroeder <[EMAIL PROTECTED]> wrote: On 4/24/07, Huseyin Sinecan wrote:
> I want to set header parameters of http response in my servlet.
Are you sure you're working on the right response object? Perhaps
you can post a simple but complete example that fails...
I just tried the following file as a JSP:
------------------------------------------------------------------
<%
response.setHeader("HooHaa", "whatever");
response.setHeader("Cache-Control", "no-cache");
%>
what now?
------------------------------------------------------------------
:: and can see the headers are set (using LiveHTTPHeaders).
--
Hassan Schroeder ------------------------ [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.