У меня довольно простой код HttpClient 4, который вызывает HttpGet для получения вывода HTML. HTML возвращается со сценариями и местоположениями изображений, все установлены на локальные (например, <img src="/images/foo.jpg"/>
), поэтому мне нужен URL-адрес вызова, чтобы сделать их абсолютными (<img src="http://foo.com/images/foo.jpg"/>
). Теперь возникает проблема - во время разговора может быть одна или две 302 переадресации, поэтому исходный URL-адрес больше не отражает местоположение HTML.
Как получить последний URL-адрес возвращаемого содержимого, заданного всеми перенаправленными мной (или не обязательно)?
Я посмотрел на HttpGet#getAllHeaders()
и HttpResponse#getAllHeaders()
- ничего не нашел.
Отредактировано: HttpGet#getURI()
возвращает исходный адрес вызова