jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes How to get http header infomation in HttpURLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to get http header infomation in HttpURLConnection" Watch "How to get http header infomation in HttpURLConnection" New topic
Author

How to get http header infomation in HttpURLConnection

Vinoth Thirunavukarasu
Ranch Hand

Joined: Dec 18, 2008
Posts: 164

Hi All,
I'm making http connection using HttpURLConnection. When a page gives 3xx status code I want to get redirecting url usng HTTP header datas . I'm trying to get it using "getHeaderField(int) " but I can't get it. Please any one suggest me a soluction


Java Best Practices
Linux Best Practices
Amortization Calculator

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Are you sure this is present in the headers at all?


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
Rob Prime wrote:Are you sure this is present in the headers at all?


Should be in the Location header, right?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to get http header infomation in HttpURLConnection
 
Similar Threads
HTTPS Request and Response Streams
Consume dot net webservice
How to set custom HTTP header for single sign on
Set the header fields for a HttpUrlConnection
Detecting URL redirection using java