protected Map<String,String> cookiesToAdd(final HttpObjectConfig.Client clientConfig, final ChainedHttpConfig.ChainedRequest cr) { Map<String,String> tmp = new HashMap<>(); try { final URI uri = cr.getUri().toURI(); for(HttpCookie cookie : cr.actualCookies(new ArrayList<>())) { final String keyName = clientConfig.getCookieVersion() == 0 ? "Set-Cookie" : "Set-Cookie2"; final Map<String,List<String>> toPut = singletonMap(keyName, singletonList(cookie.toString())); cookieManager.put(uri, toPut); } for(Map.Entry<String,List<String>> e : cookieManager.get(uri, emptyMap()).entrySet()) { if(e.getValue() != null && !e.getValue().isEmpty()) { tmp.put(e.getKey(), String.join("; ", e.getValue())); } } } catch(IOException ioe) { throw new RuntimeException(ioe); } return tmp; }
protected Map<String, String> cookiesToAdd(final HttpObjectConfig.Client clientConfig, final ChainedHttpConfig.ChainedRequest cr) throws URISyntaxException { Map<String, String> tmp = new HashMap<>(); try { final URI uri = cr.getUri().toURI(); for (HttpCookie cookie : cr.actualCookies(new ArrayList<>())) { final String keyName = clientConfig.getCookieVersion() == 0 ? "Set-Cookie" : "Set-Cookie2"; final Map<String, List<String>> toPut = singletonMap(keyName, singletonList(cookie.toString())); cookieManager.put(cr.getUri().forCookie(cookie), toPut); } Map<String, List<String>> found = cookieManager.get(uri, emptyMap()); for (Map.Entry<String, List<String>> e : found.entrySet()) { if (e.getValue() != null && !e.getValue().isEmpty()) { tmp.put(e.getKey(), String.join("; ", e.getValue())); } } } catch (IOException ioe) { throw new TransportingException(ioe); } return tmp; }
protected Map<String, String> cookiesToAdd(final HttpObjectConfig.Client clientConfig, final ChainedHttpConfig.ChainedRequest cr) throws URISyntaxException { Map<String, String> tmp = new HashMap<>(); try { final URI uri = cr.getUri().toURI(); for (HttpCookie cookie : cr.actualCookies(new ArrayList<>())) { final String keyName = clientConfig.getCookieVersion() == 0 ? "Set-Cookie" : "Set-Cookie2"; final Map<String, List<String>> toPut = singletonMap(keyName, singletonList(cookie.toString())); cookieManager.put(cr.getUri().forCookie(cookie), toPut); } Map<String, List<String>> found = cookieManager.get(uri, emptyMap()); for (Map.Entry<String, List<String>> e : found.entrySet()) { if (e.getValue() != null && !e.getValue().isEmpty()) { tmp.put(e.getKey(), String.join("; ", e.getValue())); } } } catch (IOException ioe) { throw new TransportingException(ioe); } return tmp; }