java.net.HttpCookie#getDomain ( )源码实例Demo

下面列出了java.net.HttpCookie#getDomain ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Kalle   文件: DBCookieStore.java
@Override
public void remove(HttpCookie httpCookie) {
    mLock.lock();
    try {
        Where.Builder whereBuilder = Where.newBuilder().add(NAME, Where.Options.EQUAL, httpCookie.getName());

        String domain = httpCookie.getDomain();
        if (!TextUtils.isEmpty(domain)) whereBuilder.and(DOMAIN, Where.Options.EQUAL, domain);

        String path = httpCookie.getPath();
        if (!TextUtils.isEmpty(path)) {
            if (path.length() > 1 && path.endsWith("/")) {
                path = path.substring(0, path.length() - 1);
            }
            whereBuilder.and(PATH, Where.Options.EQUAL, path);
        }
        mCookieDao.delete(whereBuilder.build().toString());
    } finally {
        mLock.unlock();
    }
}
 
源代码2 项目: 4pdaClient-plus   文件: ProfileEditFragment.java
protected void onPostExecute(final Boolean success) {
    setLoading(false);

    if (isCancelled()) return;

    if (success) {
        showThemeBody(m_ThemeBody);
    } else {
        getSupportActionBar().setTitle(ex.getMessage());
        m_WebView.loadDataWithBaseURL("https://4pda.ru/forum/", m_ThemeBody, "text/html", "UTF-8", null);
        AppLog.e(getMainActivity(), ex);
    }

    CookieSyncManager syncManager = CookieSyncManager.createInstance(m_WebView.getContext());
    CookieManager cookieManager = CookieManager.getInstance();

        for (HttpCookie cookie : Client.getInstance().getCookies()) {

            if (cookie.getDomain() != null) {
                cookieManager.setCookie(cookie.getDomain(), cookie.getName() + "=" + cookie.getValue());
            }
            //cookieManager.setCookie(cookie.getTitle(),cookie.getValue());
        }
    syncManager.sync();
}
 
源代码3 项目: Nimingban   文件: CookieDBJar.java
private Cookie httpCookie2Cookie(URL url, HttpCookie httpCookie) {
    String domain = httpCookie.getDomain();
    String path = httpCookie.getPath();
    if (TextUtils.isEmpty(domain)) {
        domain = url.getHost();
    }
    if (TextUtils.isEmpty(path)) {
        path = url.getPath();
    }

    Cookie.Builder builder = new Cookie.Builder()
            .name(httpCookie.getName())
            .value(httpCookie.getValue())
            .expiresAt(System.currentTimeMillis() + (httpCookie.getMaxAge() * 1000))
            .domain(domain)
            .path(path);
    if (httpCookie.getSecure()) {
        builder.secure();
    }
    return builder.build();
}
 
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码5 项目: jdk8u-jdk   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码6 项目: TencentKona-8   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码7 项目: jdk8u60   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码8 项目: JDKSourceCode1.8   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码9 项目: jdk8u_jdk   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码10 项目: openjdk-8   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码11 项目: openjdk-jdk8u   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码12 项目: Bytecoder   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码13 项目: jdk8u-jdk   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码14 项目: jdk8u-dev-jdk   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码15 项目: hottub   文件: InMemoryCookieStore.java
/**
 * Add one cookie into cookie store.
 */
public void add(URI uri, HttpCookie cookie) {
    // pre-condition : argument can't be null
    if (cookie == null) {
        throw new NullPointerException("cookie is null");
    }


    lock.lock();
    try {
        // remove the ole cookie if there has had one
        cookieJar.remove(cookie);

        // add new cookie if it has a non-zero max-age
        if (cookie.getMaxAge() != 0) {
            cookieJar.add(cookie);
            // and add it to domain index
            if (cookie.getDomain() != null) {
                addIndex(domainIndex, cookie.getDomain(), cookie);
            }
            if (uri != null) {
                // add it to uri index, too
                addIndex(uriIndex, getEffectiveURI(uri), cookie);
            }
        }
    } finally {
        lock.unlock();
    }
}
 
源代码16 项目: registry   文件: TestAuthenticationFilter.java
private static void parseCookieMap(String cookieHeader, HashMap<String,
        String> cookieMap) {
    List<HttpCookie> cookies = HttpCookie.parse(cookieHeader);
    for (HttpCookie cookie : cookies) {
        if (AuthenticatedURL.AUTH_COOKIE.equals(cookie.getName())) {
            cookieMap.put(cookie.getName(), cookie.getValue());
            if (cookie.getPath() != null) {
                cookieMap.put("Path", cookie.getPath());
            }
            if (cookie.getDomain() != null) {
                cookieMap.put("Domain", cookie.getDomain());
            }
        }
    }
}
 
源代码17 项目: big-c   文件: TestAuthenticationFilter.java
private static void parseCookieMap(String cookieHeader, HashMap<String,
        String> cookieMap) {
  List<HttpCookie> cookies = HttpCookie.parse(cookieHeader);
  for (HttpCookie cookie : cookies) {
    if (AuthenticatedURL.AUTH_COOKIE.equals(cookie.getName())) {
      cookieMap.put(cookie.getName(), cookie.getValue());
      if (cookie.getPath() != null) {
        cookieMap.put("Path", cookie.getPath());
      }
      if (cookie.getDomain() != null) {
        cookieMap.put("Domain", cookie.getDomain());
      }
    }
  }
}
 
源代码18 项目: FimiX8-RE   文件: PersistentCookieStore.java
public String getCookieToken(URI uri, HttpCookie cookie) {
    return cookie.getName() + cookie.getDomain();
}
 
源代码19 项目: AndroidStudyDemo   文件: PersistentCookieStore.java
protected String getCookieToken(URI uri, HttpCookie cookie) {
    return cookie.getName() + cookie.getDomain();
}
 
源代码20 项目: NewsMe   文件: PersistentCookieStore.java
protected String getCookieToken(URI uri, HttpCookie cookie)
{
    return cookie.getName() + cookie.getDomain();
}