okhttp3.Cookie.hostOnly()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中okhttp3.Cookie.hostOnly()方法的一些代码示例,展示了Cookie.hostOnly()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cookie.hostOnly()方法的具体详情如下:
包路径:okhttp3.Cookie
类名称:Cookie
方法名:hostOnly

Cookie.hostOnly介绍

[英]Returns true if this cookie's domain should be interpreted as a single host name, or false if it should be interpreted as a pattern. This flag will be false if its Set-Cookie header included a domain attribute.

For example, suppose the cookie's domain is example.com. If this flag is true it matches only example.com. If this flag is false it matches example.com and all subdomains including api.example.com, www.example.com, and beta.api.example.com.
[中]如果此cookie的域应解释为单个主机名,则返回true;如果应解释为模式,则返回false。如果其Set Cookie标头包含域属性,则此标志将为false。
例如,假设cookie的域是示例。通用域名格式。如果此标志为true,则仅与示例匹配。通用域名格式。如果此标志为false,则与示例匹配。com和所有子域,包括api。实例com,www.example。com和beta。应用程序编程接口。实例通用域名格式。

代码示例

代码示例来源:origin: jeasonlzy/okhttp-OkGo

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.expiresAt());
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
  out.writeBoolean(cookie.persistent());
}

代码示例来源:origin: GitLqr/LQRWeChat

@Override
  public int hashCode() {
    int hash = 17;
    hash = 31 * hash + cookie.name().hashCode();
    hash = 31 * hash + cookie.domain().hashCode();
    hash = 31 * hash + cookie.path().hashCode();
    hash = 31 * hash + (cookie.secure() ? 0 : 1);
    hash = 31 * hash + (cookie.hostOnly() ? 0 : 1);
    return hash;
  }
}

代码示例来源:origin: seven332/EhViewer

public ContentValues toContentValues(Cookie cookie) {
 ContentValues contentValues = new ContentValues(9);
 contentValues.put(COLUMN_NAME, cookie.name());
 contentValues.put(COLUMN_VALUE, cookie.value());
 contentValues.put(COLUMN_EXPIRES_AT, cookie.expiresAt());
 contentValues.put(COLUMN_DOMAIN, cookie.domain());
 contentValues.put(COLUMN_PATH, cookie.path());
 contentValues.put(COLUMN_SECURE, cookie.secure());
 contentValues.put(COLUMN_HTTP_ONLY, cookie.httpOnly());
 contentValues.put(COLUMN_PERSISTENT, cookie.persistent());
 contentValues.put(COLUMN_HOST_ONLY, cookie.hostOnly());
 return contentValues;
}

代码示例来源:origin: GitLqr/LQRWeChat

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
}

代码示例来源:origin: GitLqr/LQRWeChat

@Override
public boolean equals(Object other) {
  if (!(other instanceof IdentifiableCookie)) return false;
  IdentifiableCookie that = (IdentifiableCookie) other;
  return that.cookie.name().equals(this.cookie.name())
      && that.cookie.domain().equals(this.cookie.domain())
      && that.cookie.path().equals(this.cookie.path())
      && that.cookie.secure() == this.cookie.secure()
      && that.cookie.hostOnly() == this.cookie.hostOnly();
}

代码示例来源:origin: seven332/EhViewer

public static Cookie newCookie(Cookie cookie, String newDomain, boolean forcePersistent,
    boolean forceLongLive, boolean forceNotHostOnly) {
  Cookie.Builder builder = new Cookie.Builder();
  builder.name(cookie.name());
  builder.value(cookie.value());
  if (forceLongLive) {
    builder.expiresAt(Long.MAX_VALUE);
  } else if (cookie.persistent()) {
    builder.expiresAt(cookie.expiresAt());
  } else if (forcePersistent) {
    builder.expiresAt(Long.MAX_VALUE);
  }
  if (cookie.hostOnly() && !forceNotHostOnly) {
    builder.hostOnlyDomain(newDomain);
  } else {
    builder.domain(newDomain);
  }
  builder.path(cookie.path());
  if (cookie.secure()) {
    builder.secure();
  }
  if (cookie.httpOnly()) {
    builder.httpOnly();
  }
  return builder.build();
}

代码示例来源:origin: franmontiel/PersistentCookieJar

@Override
  public int hashCode() {
    int hash = 17;
    hash = 31 * hash + cookie.name().hashCode();
    hash = 31 * hash + cookie.domain().hashCode();
    hash = 31 * hash + cookie.path().hashCode();
    hash = 31 * hash + (cookie.secure() ? 0 : 1);
    hash = 31 * hash + (cookie.hostOnly() ? 0 : 1);
    return hash;
  }
}

代码示例来源:origin: limedroid/XDroidMvp

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.expiresAt());
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
  out.writeBoolean(cookie.persistent());
}

代码示例来源:origin: franmontiel/PersistentCookieJar

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
}

代码示例来源:origin: franmontiel/PersistentCookieJar

@Override
public boolean equals(Object other) {
  if (!(other instanceof IdentifiableCookie)) return false;
  IdentifiableCookie that = (IdentifiableCookie) other;
  return that.cookie.name().equals(this.cookie.name())
      && that.cookie.domain().equals(this.cookie.domain())
      && that.cookie.path().equals(this.cookie.path())
      && that.cookie.secure() == this.cookie.secure()
      && that.cookie.hostOnly() == this.cookie.hostOnly();
}

代码示例来源:origin: lygttpod/RxHttpUtils

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.expiresAt());
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
  out.writeBoolean(cookie.persistent());
}

代码示例来源:origin: yoyiyi/bilisoleil

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.expiresAt());
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
  out.writeBoolean(cookie.persistent());
}

代码示例来源:origin: FussenYu/MVP_Project

@Override
  public int hashCode() {
    int hash = 17;
    hash = 31 * hash + cookie.name().hashCode();
    hash = 31 * hash + cookie.domain().hashCode();
    hash = 31 * hash + cookie.path().hashCode();
    hash = 31 * hash + (cookie.secure() ? 0 : 1);
    hash = 31 * hash + (cookie.hostOnly() ? 0 : 1);
    return hash;
  }
}

代码示例来源:origin: 0xm1nam0/RxCore

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.expiresAt());
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
  out.writeBoolean(cookie.persistent());
}

代码示例来源:origin: postaddictme/instagram-java-scraper

@Override
  public int hashCode() {
    int hash = 17;
    hash = 31 * hash + cookie.name().hashCode();
    hash = 31 * hash + cookie.domain().hashCode();
    hash = 31 * hash + cookie.path().hashCode();
    hash = 31 * hash + (cookie.secure() ? 0 : 1);
    hash = 31 * hash + (cookie.hostOnly() ? 0 : 1);
    return hash;
  }
}

代码示例来源:origin: guanpj/JReadHub

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookies.name());
  out.writeObject(cookies.value());
  out.writeLong(cookies.expiresAt());
  out.writeObject(cookies.domain());
  out.writeObject(cookies.path());
  out.writeBoolean(cookies.secure());
  out.writeBoolean(cookies.httpOnly());
  out.writeBoolean(cookies.hostOnly());
  out.writeBoolean(cookies.persistent());
}

代码示例来源:origin: jinguangyue/Android-CustomCamera

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.expiresAt());
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
  out.writeBoolean(cookie.persistent());
}

代码示例来源:origin: com.couchbase.lite/couchbase-lite-java-core

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
}

代码示例来源:origin: postaddictme/instagram-java-scraper

@Override
public boolean equals(Object other) {
  if (!(other instanceof CookieBox)) return false;
  CookieBox that = (CookieBox) other;
  return that.cookie.name().equals(this.cookie.name())
      && that.cookie.domain().equals(this.cookie.domain())
      && that.cookie.path().equals(this.cookie.path())
      && that.cookie.secure() == this.cookie.secure()
      && that.cookie.hostOnly() == this.cookie.hostOnly();
}

代码示例来源:origin: postaddictme/instagram-java-scraper

@Override
public boolean equals(Object other) {
  if (!(other instanceof CookieBox)) return false;
  CookieBox that = (CookieBox) other;
  return that.cookie.name().equals(this.cookie.name())
      && that.cookie.domain().equals(this.cookie.domain())
      && that.cookie.path().equals(this.cookie.path())
      && that.cookie.secure() == this.cookie.secure()
      && that.cookie.hostOnly() == this.cookie.hostOnly();
}

相关文章