Получите кодирование передачи, разделенное на части в заголовке ответа HttpClient

Я хочу получить значение Location в заголовке ответа по этому коду

HttpGet getRequest = null;
CloseableHttpResponse response = null;
getRequest = new HttpGet("https://wl-prod.sabresonicweb.com/SSW2010/B3QE/webqtrip.html?searchType=NORMAL&journeySpan=RT&origin=SGN&destination=DAD&departureDate=2016-01-31&returnDate=2016-02-01&numAdults=2&numChildren=0&numInfants=0&alternativeLandingPage=true&promoCode=&lang=vi_VN");
getRequest.setHeader("Host", "wl-prod.sabresonicweb.com");
getRequest.setHeader("User-Agent", defaultUserAgent);
getRequest.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
getRequest.setHeader("Accept-Language", "en-US,en;q=0.5");
getRequest.setHeader("Accept-Encoding", "gzip, deflate");
getRequest.setHeader("Referer", "http://vietnamairlines.com/");
getRequest.setHeader("Connection", "keep-alive");

response = httpClient.execute(getRequest, context);
Header[] headers = response.getAllHeaders();
for (Header header : headers) {
    System.out.println("Key : " + header.getName() 
          + " ,Value : " + header.getValue());
}

Тем не менее, результат, который я получил, что:

Ключ: Cache-Control, Значение: без кэширования Ключ: Истекает, Значение: чт, 01 января 1970 00:00:00 GMT Ключ: X-FRAME-OPTIONS, Значение: SAMEORIGIN Ключ: Pragma, Значение: без кэширования Ключ: Cache-Control, Значение: no-store Ключ: Content-Type, Значение: text/html;charset=UTF-8Ключ: Transfer-Encoding, Значение: chunked Ключ: Vary, Значение: Accept-Encoding Ключ: Date,Value: Сб, 05 дек. 2015 08:36:16 GMT Ключ: Сервер, Значение:

Когда я использую Fiddler, я могу получить значение Location Response Header следующим образом:

HTTP/1.1 302 Found
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-FRAME-OPTIONS: SAMEORIGIN
Pragma: no-cache
Cache-Control: no-store
Location: https://wl-prod.sabresonicweb.com/SSW2010/B3QE/webqtrip.html?execution=e2s1
Content-Length: 0
Date: Sat, 05 Dec 2015 08:00:30 GMT
Server: 

Как получить значение Location в заголовке ответа методом HttpClient Get?

0 ответов

Другие вопросы по тегам