Example usage for org.apache.http.cookie ClientCookie VERSION_ATTR

List of usage examples for org.apache.http.cookie ClientCookie VERSION_ATTR

Introduction

In this page you can find the example usage for org.apache.http.cookie ClientCookie VERSION_ATTR.

Prototype

String VERSION_ATTR

To view the source code for org.apache.http.cookie ClientCookie VERSION_ATTR.

Click Source Link

Usage

From source file:com.gargoylesoftware.htmlunit.httpclient.HtmlUnitVersionAttributeHandler.java

@Override
public String getAttributeName() {
    return ClientCookie.VERSION_ATTR;
}

From source file:org.xwiki.wysiwyg.internal.plugin.alfresco.server.SiteMinderAuthenticator.java

/**
 * @return the list of SiteMinder cookies that have to be added to the HTTP request in order to authenticate it.
 *//*w  w  w  . j  a va 2 s. c om*/
private List<Cookie> getSiteMinderCookies() {
    javax.servlet.http.Cookie[] receivedCookies = ((ServletRequest) container.getRequest())
            .getHttpServletRequest().getCookies();
    List<Cookie> cookies = new ArrayList<Cookie>();
    // Look for the SMSESSION cookie.
    for (int i = 0; i < receivedCookies.length; i++) {
        javax.servlet.http.Cookie receivedCookie = receivedCookies[i];
        if (SITE_MINDER_COOKIES.contains(receivedCookie.getName())) {
            BasicClientCookie cookie = new BasicClientCookie(receivedCookie.getName(),
                    receivedCookie.getValue());
            cookie.setVersion(receivedCookie.getVersion());
            cookie.setDomain(receivedCookie.getDomain());
            cookie.setPath(receivedCookie.getPath());
            cookie.setSecure(receivedCookie.getSecure());
            // Set attributes EXACTLY as sent by the browser.
            cookie.setAttribute(ClientCookie.VERSION_ATTR, String.valueOf(receivedCookie.getVersion()));
            cookie.setAttribute(ClientCookie.DOMAIN_ATTR, receivedCookie.getDomain());
            cookies.add(cookie);
        }
    }
    return cookies;
}

From source file:com.jaeksoft.searchlib.crawler.web.database.CookieItem.java

public BasicClientCookie getCookie() throws MalformedURLException, URISyntaxException {
    if (basicClientCookie != null)
        return basicClientCookie;
    basicClientCookie = new BasicClientCookie(name, value);
    basicClientCookie.setVersion(1);//from   w  w w  .  j  ava 2  s .  co m
    String domain_attr = StringUtils.fastConcat(".", InternetDomainName.from(extractUrl().getHost()).name());
    basicClientCookie.setDomain(domain_attr);
    basicClientCookie.setPath("/");
    basicClientCookie.setSecure(true);
    basicClientCookie.setAttribute(ClientCookie.VERSION_ATTR, "1");
    basicClientCookie.setAttribute(ClientCookie.DOMAIN_ATTR, domain_attr);
    return basicClientCookie;
}

From source file:org.esxx.js.protocol.CookieJar.java

private Scriptable cookieToScriptable(Context cx, Cookie cookie) {
    Scriptable js = cx.newObject(jsuri);
    Scriptable raw = cx.newObject(js);/*w w  w . ja va  2s  .c o  m*/

    js.put("raw", js, raw);

    setValue(cx, cookie, js, raw, "name", cookie.getName());
    setValue(cx, cookie, js, raw, "value", cookie.getValue());

    setValue(cx, cookie, js, raw, ClientCookie.COMMENT_ATTR, cookie.getComment());
    setValue(cx, cookie, js, raw, ClientCookie.COMMENTURL_ATTR, cookie.getCommentURL());
    setValue(cx, cookie, js, raw, ClientCookie.DISCARD_ATTR, null);
    setValue(cx, cookie, js, raw, ClientCookie.DOMAIN_ATTR, cookie.getDomain());
    setValue(cx, cookie, js, raw, ClientCookie.EXPIRES_ATTR, cookie.getExpiryDate());
    setValue(cx, cookie, js, raw, ClientCookie.MAX_AGE_ATTR, null);
    setValue(cx, cookie, js, raw, ClientCookie.PATH_ATTR, cookie.getPath());
    setValue(cx, cookie, js, raw, ClientCookie.PORT_ATTR, cookie.getPorts());
    setValue(cx, cookie, js, raw, ClientCookie.SECURE_ATTR, cookie.isSecure());
    setValue(cx, cookie, js, raw, ClientCookie.VERSION_ATTR, cookie.getVersion());

    return js;
}

From source file:org.esxx.js.protocol.CookieJar.java

private Cookie scriptableToCookie(Context cx, Scriptable js) {
    String name = Context.toString(js.get("name", js));
    String value = Context.toString(js.get("value", js));
    Object raw = js.get("raw", js);

    BasicClientCookie cookie;/*from   ww w . ja  va2  s .c  om*/

    if (js.has(ClientCookie.COMMENTURL_ATTR, js) || js.has(ClientCookie.DISCARD_ATTR, js)
            || js.has(ClientCookie.PORT_ATTR, js)) {
        BasicClientCookie2 cookie2 = new BasicClientCookie2(name, value);

        cookie2.setCommentURL(stringValue(cx, js, raw, cookie2, ClientCookie.COMMENTURL_ATTR));
        cookie2.setDiscard(booleanValue(cx, js, raw, cookie2, ClientCookie.DISCARD_ATTR));
        cookie2.setPorts(intArrayValue(cx, js, raw, cookie2, ClientCookie.PORT_ATTR));
        cookie = cookie2;
    } else {
        cookie = new BasicClientCookie(name, value);
    }

    cookie.setComment(stringValue(cx, js, raw, cookie, ClientCookie.COMMENT_ATTR));
    cookie.setDomain(stringValue(cx, js, raw, cookie, ClientCookie.DOMAIN_ATTR));
    cookie.setExpiryDate(dateValue(cx, js, raw, cookie, ClientCookie.EXPIRES_ATTR));
    cookie.setPath(stringValue(cx, js, raw, cookie, ClientCookie.PATH_ATTR));
    cookie.setSecure(booleanValue(cx, js, raw, cookie, ClientCookie.SECURE_ATTR));
    cookie.setVersion(intValue(cx, js, raw, cookie, ClientCookie.VERSION_ATTR));

    setRawValue(raw, cookie, ClientCookie.MAX_AGE_ATTR);

    return cookie;
}