List of usage examples for org.apache.http.client.methods CloseableHttpResponse getLocale
Locale getLocale();
From source file:com.lehman.ic9.net.httpClient.java
/** * Updates the Javascript response object. * @param info is the Javascript response object to update. * @param resp is a ClosableHttpResponse object with the actual response. * @throws NoSuchMethodException Exception * @throws ScriptException Exception/* w ww .j a v a2 s . c o m*/ */ private void getResponseInfo(Map<String, Object> info, CloseableHttpResponse resp) throws NoSuchMethodException, ScriptException { // Locale Locale jloc = resp.getLocale(); info.put("locale", jloc.toLanguageTag()); info.put("protocol", resp.getProtocolVersion().toString()); info.put("protocolMajor", resp.getProtocolVersion().getMajor()); info.put("protocolMinor", resp.getProtocolVersion().getMinor()); info.put("statusLine", resp.getStatusLine().toString()); info.put("statusCode", resp.getStatusLine().getStatusCode()); info.put("statusReasonPhrase", resp.getStatusLine().getReasonPhrase()); // Headers. Map<String, Object> hmap = this.eng.newObj(null); Header hdrs[] = resp.getAllHeaders(); for (Header hdr : hdrs) { hmap.put(hdr.getName(), hdr.getValue()); } info.put("headers", hmap); // Cookies Object clist = this.eng.newList(); this.jsobj.put("cookies", clist); for (Cookie C : this.cs.getCookies()) { Object nc = this.getApacheCookie(C); this.eng.invokeMethod(clist, "push", nc); } }