javax.ws.rs.core.Cookie.getDomain()方法的使用及代码示例

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

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

Cookie.getDomain介绍

[英]Get the domain of the cookie.
[中]获取cookie的域。

代码示例

代码示例来源:origin: jersey/jersey

@Override
public String toString(Cookie cookie) {
  throwIllegalArgumentExceptionIfNull(cookie, LocalizationMessages.COOKIE_IS_NULL());
  StringBuilder b = new StringBuilder();
  b.append("$Version=").append(cookie.getVersion()).append(';');
  b.append(cookie.getName()).append('=');
  StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getValue());
  if (cookie.getDomain() != null) {
    b.append(";$Domain=");
    StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getDomain());
  }
  if (cookie.getPath() != null) {
    b.append(";$Path=");
    StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getPath());
  }
  return b.toString();
}

代码示例来源:origin: jersey/jersey

@Override
public String toString(Cookie cookie) {
  throwIllegalArgumentExceptionIfNull(cookie, LocalizationMessages.COOKIE_IS_NULL());
  StringBuilder b = new StringBuilder();
  b.append("$Version=").append(cookie.getVersion()).append(';');
  b.append(cookie.getName()).append('=');
  StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getValue());
  if (cookie.getDomain() != null) {
    b.append(";$Domain=");
    StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getDomain());
  }
  if (cookie.getPath() != null) {
    b.append(";$Path=");
    StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getPath());
  }
  return b.toString();
}

代码示例来源:origin: jersey/jersey

if (!name.equals(((Cookie) v).getName())) {
    c = new Cookie(name, c.getValue(), c.getPath(), c.getDomain(), c.getVersion());
if (!name.equals(((Cookie) value).getName())) {
  cookies.add(new Cookie(name, c.getValue(), c.getPath(), c.getDomain(), c.getVersion()));

代码示例来源:origin: resteasy/Resteasy

public String toString(Cookie value)
  {
   StringBuffer buf = new StringBuffer();
   ServerCookie.appendCookieValue(buf, 0, value.getName(), value.getValue(), value.getPath(), value.getDomain(), null, -1, false);
   return buf.toString();
  }
}

代码示例来源:origin: resteasy/Resteasy

public void cookie(Cookie cookie)
{
 if (!(Cookie.class.equals(cookie.getClass())))
 {
   cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
 }
 headers.add(HttpHeaders.COOKIE, cookie);
}

代码示例来源:origin: resteasy/Resteasy

@Override
public Invocation.Builder cookie(Cookie cookie)
{
 if (!(Cookie.class.equals(cookie.getClass())))
 {
   cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
 }
 getHeaders().cookie(cookie);
 return this;
}

代码示例来源:origin: org.jboss.resteasy/resteasy-core

public String toString(Cookie value)
  {
   StringBuffer buf = new StringBuffer();
   ServerCookie.appendCookieValue(buf, 0, value.getName(), value.getValue(), value.getPath(), value.getDomain(), null, -1, false);
   return buf.toString();
  }
}

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

public String toString(Cookie value)
  {
   StringBuffer buf = new StringBuffer();
   ServerCookie.appendCookieValue(buf, 0, value.getName(), value.getValue(), value.getPath(), value.getDomain(), null, -1, false);
   return buf.toString();
  }
}

代码示例来源:origin: org.jboss.resteasy/resteasy-client

public void cookie(Cookie cookie)
{
 if (!(Cookie.class.equals(cookie.getClass())))
 {
   cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
 }
 headers.add(HttpHeaders.COOKIE, cookie);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-client-20

public void cookie(Cookie cookie)
{
 if (!(Cookie.class.equals(cookie.getClass())))
 {
   cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
 }
 headers.add(HttpHeaders.COOKIE, cookie);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-client

@Override
public Invocation.Builder cookie(Cookie cookie)
{
 if (!(Cookie.class.equals(cookie.getClass())))
 {
   cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
 }
 getHeaders().cookie(cookie);
 return this;
}

代码示例来源:origin: org.neo4j.3rdparty.javax.ws.rs/jsr311-api

/**
 * Create a new instance copying the information in the supplied cookie.
 * @param cookie the cookie to clone
 * @throws IllegalArgumentException if cookie is null
 */
public NewCookie(Cookie cookie) {
  super(cookie==null ? null : cookie.getName(), 
     cookie==null ? null : cookie.getValue(),
     cookie==null ? null : cookie.getPath(),
     cookie==null ? null : cookie.getDomain(),
     cookie==null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
}

代码示例来源:origin: org.apache.openejb/javaee-api

public NewCookie(Cookie cookie, String comment, int maxAge, boolean isSecure) {
  super(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie
    .getVersion());
  this.comment = comment;
  this.maxAge = maxAge;
  this.isSecure = isSecure;
}

代码示例来源:origin: Nextdoor/bender

/**
 * Create a new instance copying the information in the supplied cookie.
 * @param cookie the cookie to clone
 * @throws IllegalArgumentException if cookie is null
 */
public NewCookie(Cookie cookie) {
  super(cookie==null ? null : cookie.getName(), 
     cookie==null ? null : cookie.getValue(),
     cookie==null ? null : cookie.getPath(),
     cookie==null ? null : cookie.getDomain(),
     cookie==null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-jaxrs_2.1_spec

public NewCookie(Cookie cookie, String comment, int maxAge, Date expiry, boolean secure, boolean httpOnly) {
  super(cookie == null ? null : cookie.getName(), cookie == null ? null : cookie.getValue(),
      cookie == null ? null : cookie.getPath(), cookie == null ? null : cookie.getDomain(),
      cookie == null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
  this.comment = comment;
  this.maxAge = maxAge;
  this.expiry = expiry;
  this.secure = secure;
  this.httpOnly = httpOnly;
}

代码示例来源:origin: org.apache.aries.spec/org.apache.aries.javax.jax.rs-api

public NewCookie(Cookie cookie, String comment, int maxAge, Date expiry, boolean secure, boolean httpOnly) {
  super(cookie == null ? null : cookie.getName(), cookie == null ? null : cookie.getValue(),
      cookie == null ? null : cookie.getPath(), cookie == null ? null : cookie.getDomain(),
      cookie == null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
  this.comment = comment;
  this.maxAge = maxAge;
  this.expiry = expiry;
  this.secure = secure;
  this.httpOnly = httpOnly;
}

代码示例来源:origin: org.jboss.resteasy/resteasy-client-20

@Override
public Invocation.Builder cookie(Cookie cookie)
{
 if (!(Cookie.class.equals(cookie.getClass())))
 {
   cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
 }
 getHeaders().cookie(cookie);
 return this;
}

代码示例来源:origin: apache/meecrowave

public NewCookie(Cookie cookie, String comment, int maxAge, Date expiry, boolean secure, boolean httpOnly) {
  super(cookie == null ? null : cookie.getName(), cookie == null ? null : cookie.getValue(),
      cookie == null ? null : cookie.getPath(), cookie == null ? null : cookie.getDomain(),
      cookie == null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
  this.comment = comment;
  this.maxAge = maxAge;
  this.expiry = expiry;
  this.secure = secure;
  this.httpOnly = httpOnly;
}

代码示例来源:origin: org.keycloak/keycloak-jaxrs-oauth-client

@Override
public Cookie getCookie(String cookieName) {
  Map<String, javax.ws.rs.core.Cookie> cookies = requestContext.getCookies();
  if (cookies == null)
    return null;
  javax.ws.rs.core.Cookie cookie = cookies.get(cookieName);
  if (cookie == null)
    return null;
  return new Cookie(cookie.getName(), cookie.getValue(), cookie.getVersion(), cookie.getDomain(), cookie.getPath());
}

代码示例来源:origin: org.minijax/minijax-core

@Override
  public String toString(final Cookie cookie) {
    final HttpCookie httpCookie = new HttpCookie(cookie.getName(), cookie.getValue());
    httpCookie.setDomain(cookie.getDomain());
    httpCookie.setPath(cookie.getPath());
    return httpCookie.toString();
  }
}

相关文章