File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Getting Response Headers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting Response Headers" Watch "Getting Response Headers" New topic

Getting Response Headers

srinath anand
Ranch Hand

Joined: Nov 20, 2001
Posts: 30
Hello All,

Is there any way for me to get back the HTTP Response Headers using the J2EE framework in the format as given below ? I have a Filter which gets me the Request headers but I want to get the corresponding Response Headers also. Can it be done ?

HTTP/1.1 200 OK
Date: Mon, 19 Oct 2004 22:12:57 GMT
Pragma: no-cache
Server: WebLogic WebLogic Server 6.1 SP1 09/18/2001 14:28:44 #138716
Content-Length: 297
Content-Type: text/html
Expires: Thu, 01 Dec 2004 16:00:00 GMT
Set-Cookie: SessionID=null; path=/
1073741567!7001!7002; path=/
Cache-Control: no-cache, post-check=0, pre-check=0


David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Do you need to extract the headers to use in your code or you just want to see them? You can attach some tools to intercept the HTTP Request/Response if it is just for debugging.
srinath anand
Ranch Hand

Joined: Nov 20, 2001
Posts: 30
I want to see them.
I am printing out the request headers right now but I want the corresponding response headers sent by the server to the request headers.

subho saha
Ranch Hand

Joined: Jun 15, 2005
Posts: 57
There is a software available for free called Http Look.You can use it to track the request response headers. The url to download it is "".
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Here is your best bet LIveHttpHeaders. Its a firefox extension.
srinath anand
Ranch Hand

Joined: Nov 20, 2001
Posts: 30
Thanks for the replies. But I am using IE. Basically I am trying to track a JSESSIONID which is being lost somewhere. Thus I have to do it programatically.
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
Try 'ethereal', which is a protocol analyzer allowing you not just to look at HTTP messages but loads of other stuff (TCP/ICMP/IPX). Of course, you can filter out those you don't want to see.
subject: Getting Response Headers
It's not a secret anymore!