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

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

Introduction

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

Prototype

boolean containsAttribute(String name);

Source Link

Usage

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

private void setValue(Context cx, Cookie cookie, Scriptable js, Scriptable raw, String name, Object value) {
    if (value instanceof String || value instanceof Number || value instanceof Boolean) {
        js.put(name, js, value);/*from   w ww  . j  a  v a 2s.  c o m*/
    } else if (value instanceof Date) {
        js.put(name, js, ((Date) value).getTime());
    } else if (value instanceof int[]) {
        int[] ports = (int[]) value;
        Object[] ip = new Object[ports.length];

        for (int i = 0; i < ports.length; ++i) {
            ip[i] = i;
        }

        js.put(name, js, cx.newArray(jsuri, ip));
    }

    // Add raw attribute, if present
    if (cookie instanceof ClientCookie) {
        ClientCookie cc = (ClientCookie) cookie;

        if (cc.containsAttribute(name)) {
            raw.put(name, raw, cc.getAttribute(name));
        }
    }
}