url = req.getURI().toURL();
} catch (MalformedURLException e1) {
return null;
}
Header h = HTTPResponse4Impl.getLastHeaderIgnoreCase(rsp, "location");
if(h!=null) {
String str = h.getValue();
try {
return new URL(str);
} catch (MalformedURLException e) {
try {
return new URL(url.getProtocol(), url.getHost(), url.getPort(), mergePath(url.getFile(), str));