org.apache.http.impl.cookie.BasicClientCookie2 Java Examples

The following examples show how to use org.apache.http.impl.cookie.BasicClientCookie2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultCookieManager.java    From esigate with Apache License 2.0 6 votes vote down vote up
private static Cookie rewriteForServer(Cookie cookie, DriverRequest request) {
    String name = cookie.getName();
    if ("_JSESSIONID".equalsIgnoreCase(name)) {
        name = name.substring(1);
    }
    BasicClientCookie2 httpClientCookie = new BasicClientCookie2(name, cookie.getValue());
    httpClientCookie.setSecure(false);
    String domain;
    if (request.getDriver().getConfiguration().isPreserveHost()) {
        domain = UriUtils.extractHostName(request.getOriginalRequest().getRequestLine().getUri());
    } else {
        domain = request.getBaseUrl().getHost();
    }

    httpClientCookie.setDomain(domain);
    httpClientCookie.setPath("/");
    httpClientCookie.setComment(cookie.getComment());
    httpClientCookie.setVersion(cookie.getVersion());
    return httpClientCookie;
}
 
Example #2
Source File: BoxDotComAccount.java    From neembuu-uploader with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Set the cookie locale to en_US.
 */
private void setCookieLocale(){
    cookieStore.addCookie(new BasicClientCookie2("box_locale", "en_US"));
    cookieStore.addCookie(new BasicClientCookie2("country", "US"));
    cookieStore.addCookie(new BasicClientCookie2("lang", "en-US"));
}