| Author |
How to retrieve HttpResponse Headers
|
Sudhakar Krishnamurthy
Ranch Hand
Joined: Jun 02, 2003
Posts: 76
|
|
Greetings: Is their a possibility to retrieve the headers from HttpResponse, i know we can retrieve it from the HttpRequest but i need it from the HttpResponse. Here's why i need to retrieve the response header: I have a servlet A running on my local machine that needs to send an object to servlet B that is running on a remote machine as a post message. for servlet B to accept the post message i need to send the cookie(generated by serlvet B) in the post message. Any help is greatly appreciated. -Sudhakar
|
 |
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
|
|
|
Can't you just forward the request to servlet B? Am I missing something here?
|
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
|
 |
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
|
|
You can only use forward() to something in your own web app. Kyle
|
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
|
 |
Sudhakar Krishnamurthy
Ranch Hand
Joined: Jun 02, 2003
Posts: 76
|
|
no i can't forward the request to servlet B since servlet B is on a remote machine and even if it were i don't want to because i need the response from servlet B to be processed by servlet A. I am using oreilly's HttpMessage.sendPostMessage(obj) method to perform a post on the remote machine, this returns me an inputstream that contains the response, i am trying to figure out if this response will contain the header info, if so then i can parse the response to retrieve the info needed. Is their a better way to do this?? Any suggestions??
|
 |
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
|
|
Whenever I need to send a request to another server and receive and parse the response, I use HTTP Unit This software offers methods to simply fetch headers from a returned response: Maybe that might be easier?
|
A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
|
 |
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
|
|
Yep! I missed the fact that servlet B resides on a remote machine. [ January 09, 2004: Message edited by: Bosun Bello ]
|
 |
Sudhakar Krishnamurthy
Ranch Hand
Joined: Jun 02, 2003
Posts: 76
|
|
Thanks for the response Frank, but i don't have the liberty to use this software, i am bound to use custom made classes or oreilly only. Any suggestions?? Thanks, -Sudhakar
|
 |
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
|
|
In which case I suggest you download the source code for HTTPUnit, and use any bits you like in your "custom code". That's the beauty of open source. Although limiting oneself to just one, limited, open source package, rather than using whatever is most suitable does seem a bit pointless.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: How to retrieve HttpResponse Headers
|
|
|