List of usage examples for org.apache.http.cookie SM SET_COOKIE2
String SET_COOKIE2
To view the source code for org.apache.http.cookie SM SET_COOKIE2.
Click Source Link
From source file:org.droidparts.http.CookieJar.java
@Override public void put(URI uri, Map<String, List<String>> responseHeaders) throws IOException { for (String key : responseHeaders.keySet()) { if (SM.SET_COOKIE.equalsIgnoreCase(key) || SM.SET_COOKIE2.equalsIgnoreCase(key)) { List<Cookie> cookies = parseCookies(uri, responseHeaders.get(key)); for (Cookie c : cookies) { addCookie(c);//from w w w . j a v a 2 s . co m } return; } } }
From source file:com.googlecode.noweco.webmail.httpclient.UnsecureResponseProcessCookies.java
public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { if (response == null) { throw new IllegalArgumentException("HTTP request may not be null"); }// w ww . ja v a 2s. c om if (context == null) { throw new IllegalArgumentException("HTTP context may not be null"); } // Obtain actual CookieSpec instance CookieSpec cookieSpec = (CookieSpec) context.getAttribute(ClientContext.COOKIE_SPEC); if (cookieSpec == null) { this.log.debug("Cookie spec not specified in HTTP context"); return; } // Obtain cookie store CookieStore cookieStore = (CookieStore) context.getAttribute(ClientContext.COOKIE_STORE); if (cookieStore == null) { this.log.debug("Cookie store not specified in HTTP context"); return; } // Obtain actual CookieOrigin instance CookieOrigin cookieOrigin = (CookieOrigin) context.getAttribute(ClientContext.COOKIE_ORIGIN); if (cookieOrigin == null) { this.log.debug("Cookie origin not specified in HTTP context"); return; } HeaderIterator it = response.headerIterator(SM.SET_COOKIE); processCookies(it, cookieSpec, cookieOrigin, cookieStore); // see if the cookie spec supports cookie versioning. if (cookieSpec.getVersion() > 0) { // process set-cookie2 headers. // Cookie2 will replace equivalent Cookie instances it = response.headerIterator(SM.SET_COOKIE2); processCookies(it, cookieSpec, cookieOrigin, cookieStore); } }
From source file:org.apache.http.client.protocol.ResponseProcessCookies.java
public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP request"); Args.notNull(context, "HTTP context"); final HttpClientContext clientContext = HttpClientContext.adapt(context); // Obtain actual CookieSpec instance final CookieSpec cookieSpec = clientContext.getCookieSpec(); if (cookieSpec == null) { this.log.debug("Cookie spec not specified in HTTP context"); return;/*w w w . j a va 2 s. c o m*/ } // Obtain cookie store final CookieStore cookieStore = clientContext.getCookieStore(); if (cookieStore == null) { this.log.debug("Cookie store not specified in HTTP context"); return; } // Obtain actual CookieOrigin instance final CookieOrigin cookieOrigin = clientContext.getCookieOrigin(); if (cookieOrigin == null) { this.log.debug("Cookie origin not specified in HTTP context"); return; } HeaderIterator it = response.headerIterator(SM.SET_COOKIE); processCookies(it, cookieSpec, cookieOrigin, cookieStore); // see if the cookie spec supports cookie versioning. if (cookieSpec.getVersion() > 0) { // process set-cookie2 headers. // Cookie2 will replace equivalent Cookie instances it = response.headerIterator(SM.SET_COOKIE2); processCookies(it, cookieSpec, cookieOrigin, cookieStore); } }