Fabian
Fabian

Reputation: 99

How can I get the URL of an HTTPResponse

how can I get the URL of an HTTPResponse? I tried:

response.getHeaders("Locations")

But I obtained:

11-15 21:14:03.355: INFO/System.out(880): [Lorg.apache.http.Header;@43ea9568

Upvotes: 2

Views: 25189

Answers (2)

Ahmet
Ahmet

Reputation: 271

Try this

for(Header header : response.getHeaders("Location")) {
  System.out.println("Location from connect:" + header.getValue());
}

Upvotes: 2

Basic
Basic

Reputation: 26756

You maybe be thinking of redirecting the client to a new url in which case you want to set Location not Locations

Requests have URLs, responses are just data packets sent back to the client.

Upvotes: 2

Related Questions