Tabnine Logo
Cookie2.isPortAttributeSpecified
Code IndexAdd Tabnine to your IDE (free)

How to use
isPortAttributeSpecified
method
in
org.apache.commons.httpclient.cookie.Cookie2

Best Java code snippets using org.apache.commons.httpclient.cookie.Cookie2.isPortAttributeSpecified (Showing top 15 results out of 315)

origin: commons-httpclient/commons-httpclient

/**
 * Validate cookie port attribute. If the Port attribute was specified
 * in header, the request port must be in cookie's port list.
 */
public void validate(final Cookie cookie, final CookieOrigin origin)
    throws MalformedCookieException {
  if (cookie == null) {
    throw new IllegalArgumentException("Cookie may not be null");
  }
  if (origin == null) {
    throw new IllegalArgumentException("Cookie origin may not be null");
  }
  if (cookie instanceof Cookie2) {
    Cookie2 cookie2 = (Cookie2) cookie;
    int port = origin.getPort();
    if (cookie2.isPortAttributeSpecified()) {
      if (!portMatch(port, cookie2.getPorts())) {
        throw new MalformedCookieException(
            "Port attribute violates RFC 2965: "
            + "Request port not found in cookie's port list.");
      }
    }
  }
}
origin: commons-httpclient/commons-httpclient

  /**
   * Match cookie port attribute. If the Port attribute is not specified
   * in header, the cookie can be sent to any port. Otherwise, the request port
   * must be in the cookie's port list.
   */
  public boolean match(final Cookie cookie, final CookieOrigin origin) {
    if (cookie == null) {
      throw new IllegalArgumentException("Cookie may not be null");
    }
    if (origin == null) {
      throw new IllegalArgumentException("Cookie origin may not be null");
    }
    if (cookie instanceof Cookie2) {
      Cookie2 cookie2 = (Cookie2) cookie;
      int port = origin.getPort();
      if (cookie2.isPortAttributeSpecified()) {
        if (cookie2.getPorts() == null) {
          LOG.warn("Invalid cookie state: port not specified");
          return false;
        }
        if (!portMatch(port, cookie2.getPorts())) {
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  }
}
origin: commons-httpclient/commons-httpclient

private void doFormatCookie2(final Cookie2 cookie, final StringBuffer buffer) {
  String name = cookie.getName();
  String value = cookie.getValue();
  if (value == null) {
    value = "";
  }
  this.formatter.format(buffer, new NameValuePair(name, value));
  // format domain attribute
  if (cookie.getDomain() != null && cookie.isDomainAttributeSpecified()) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Domain", cookie.getDomain()));
  }
  // format path attribute
  if ((cookie.getPath() != null) && (cookie.isPathAttributeSpecified())) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Path", cookie.getPath()));
  }
  // format port attribute
  if (cookie.isPortAttributeSpecified()) {
    String portValue = "";
    if (!cookie.isPortAttributeBlank()) {
      portValue = createPortAttribute(cookie.getPorts());
    }
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Port", portValue));
  }
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

  /**
   * Match cookie port attribute. If the Port attribute is not specified
   * in header, the cookie can be sent to any port. Otherwise, the request port
   * must be in the cookie's port list.
   */
  public boolean match(final Cookie cookie, final CookieOrigin origin) {
    if (cookie == null) {
      throw new IllegalArgumentException("Cookie may not be null");
    }
    if (origin == null) {
      throw new IllegalArgumentException("Cookie origin may not be null");
    }
    if (cookie instanceof Cookie2) {
      Cookie2 cookie2 = (Cookie2) cookie;
      int port = origin.getPort();
      if (cookie2.isPortAttributeSpecified()) {
        if (cookie2.getPorts() == null) {
          LOG.warn("Invalid cookie state: port not specified");
          return false;
        }
        if (!portMatch(port, cookie2.getPorts())) {
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  }
}
origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Validate cookie port attribute. If the Port attribute was specified
 * in header, the request port must be in cookie's port list.
 */
public void validate(final Cookie cookie, final CookieOrigin origin)
    throws MalformedCookieException {
  if (cookie == null) {
    throw new IllegalArgumentException("Cookie may not be null");
  }
  if (origin == null) {
    throw new IllegalArgumentException("Cookie origin may not be null");
  }
  if (cookie instanceof Cookie2) {
    Cookie2 cookie2 = (Cookie2) cookie;
    int port = origin.getPort();
    if (cookie2.isPortAttributeSpecified()) {
      if (!portMatch(port, cookie2.getPorts())) {
        throw new MalformedCookieException(
            "Port attribute violates RFC 2965: "
            + "Request port not found in cookie's port list.");
      }
    }
  }
}
origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

  /**
   * Match cookie port attribute. If the Port attribute is not specified
   * in header, the cookie can be sent to any port. Otherwise, the request port
   * must be in the cookie's port list.
   */
  public boolean match(final Cookie cookie, final CookieOrigin origin) {
    if (cookie == null) {
      throw new IllegalArgumentException("Cookie may not be null");
    }
    if (origin == null) {
      throw new IllegalArgumentException("Cookie origin may not be null");
    }
    if (cookie instanceof Cookie2) {
      Cookie2 cookie2 = (Cookie2) cookie;
      int port = origin.getPort();
      if (cookie2.isPortAttributeSpecified()) {
        if (cookie2.getPorts() == null) {
          LOG.warn("Invalid cookie state: port not specified");
          return false;
        }
        if (!portMatch(port, cookie2.getPorts())) {
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  }
}
origin: org.apache.commons/httpclient

  /**
   * Match cookie port attribute. If the Port attribute is not specified
   * in header, the cookie can be sent to any port. Otherwise, the request port
   * must be in the cookie's port list.
   */
  public boolean match(final Cookie cookie, final CookieOrigin origin) {
    if (cookie == null) {
      throw new IllegalArgumentException("Cookie may not be null");
    }
    if (origin == null) {
      throw new IllegalArgumentException("Cookie origin may not be null");
    }
    if (cookie instanceof Cookie2) {
      Cookie2 cookie2 = (Cookie2) cookie;
      int port = origin.getPort();
      if (cookie2.isPortAttributeSpecified()) {
        if (cookie2.getPorts() == null) {
          LOG.warn("Invalid cookie state: port not specified");
          return false;
        }
        if (!portMatch(port, cookie2.getPorts())) {
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  }
}
origin: org.apache.commons/httpclient

/**
 * Validate cookie port attribute. If the Port attribute was specified
 * in header, the request port must be in cookie's port list.
 */
public void validate(final Cookie cookie, final CookieOrigin origin)
    throws MalformedCookieException {
  if (cookie == null) {
    throw new IllegalArgumentException("Cookie may not be null");
  }
  if (origin == null) {
    throw new IllegalArgumentException("Cookie origin may not be null");
  }
  if (cookie instanceof Cookie2) {
    Cookie2 cookie2 = (Cookie2) cookie;
    int port = origin.getPort();
    if (cookie2.isPortAttributeSpecified()) {
      if (!portMatch(port, cookie2.getPorts())) {
        throw new MalformedCookieException(
            "Port attribute violates RFC 2965: "
            + "Request port not found in cookie's port list.");
      }
    }
  }
}
origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Validate cookie port attribute. If the Port attribute was specified
 * in header, the request port must be in cookie's port list.
 */
public void validate(final Cookie cookie, final CookieOrigin origin)
    throws MalformedCookieException {
  if (cookie == null) {
    throw new IllegalArgumentException("Cookie may not be null");
  }
  if (origin == null) {
    throw new IllegalArgumentException("Cookie origin may not be null");
  }
  if (cookie instanceof Cookie2) {
    Cookie2 cookie2 = (Cookie2) cookie;
    int port = origin.getPort();
    if (cookie2.isPortAttributeSpecified()) {
      if (!portMatch(port, cookie2.getPorts())) {
        throw new MalformedCookieException(
            "Port attribute violates RFC 2965: "
            + "Request port not found in cookie's port list.");
      }
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Validate cookie port attribute. If the Port attribute was specified
 * in header, the request port must be in cookie's port list.
 */
public void validate(final Cookie cookie, final CookieOrigin origin)
    throws MalformedCookieException {
  if (cookie == null) {
    throw new IllegalArgumentException("Cookie may not be null");
  }
  if (origin == null) {
    throw new IllegalArgumentException("Cookie origin may not be null");
  }
  if (cookie instanceof Cookie2) {
    Cookie2 cookie2 = (Cookie2) cookie;
    int port = origin.getPort();
    if (cookie2.isPortAttributeSpecified()) {
      if (!portMatch(port, cookie2.getPorts())) {
        throw new MalformedCookieException(
            "Port attribute violates RFC 2965: "
            + "Request port not found in cookie's port list.");
      }
    }
  }
}
origin: org.wso2.commons-httpclient/commons-httpclient

  /**
   * Match cookie port attribute. If the Port attribute is not specified
   * in header, the cookie can be sent to any port. Otherwise, the request port
   * must be in the cookie's port list.
   */
  public boolean match(final Cookie cookie, final CookieOrigin origin) {
    if (cookie == null) {
      throw new IllegalArgumentException("Cookie may not be null");
    }
    if (origin == null) {
      throw new IllegalArgumentException("Cookie origin may not be null");
    }
    if (cookie instanceof Cookie2) {
      Cookie2 cookie2 = (Cookie2) cookie;
      int port = origin.getPort();
      if (cookie2.isPortAttributeSpecified()) {
        if (cookie2.getPorts() == null) {
          LOG.warn("Invalid cookie state: port not specified");
          return false;
        }
        if (!portMatch(port, cookie2.getPorts())) {
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  }
}
origin: org.apache.commons/httpclient

private void doFormatCookie2(final Cookie2 cookie, final StringBuffer buffer) {
  String name = cookie.getName();
  String value = cookie.getValue();
  if (value == null) {
    value = "";
  }
  this.formatter.format(buffer, new NameValuePair(name, value));
  // format domain attribute
  if (cookie.getDomain() != null && cookie.isDomainAttributeSpecified()) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Domain", cookie.getDomain()));
  }
  // format path attribute
  if ((cookie.getPath() != null) && (cookie.isPathAttributeSpecified())) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Path", cookie.getPath()));
  }
  // format port attribute
  if (cookie.isPortAttributeSpecified()) {
    String portValue = "";
    if (!cookie.isPortAttributeBlank()) {
      portValue = createPortAttribute(cookie.getPorts());
    }
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Port", portValue));
  }
}

origin: org.wso2.commons-httpclient/commons-httpclient

private void doFormatCookie2(final Cookie2 cookie, final StringBuffer buffer) {
  String name = cookie.getName();
  String value = cookie.getValue();
  if (value == null) {
    value = "";
  }
  this.formatter.format(buffer, new NameValuePair(name, value));
  // format domain attribute
  if (cookie.getDomain() != null && cookie.isDomainAttributeSpecified()) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Domain", cookie.getDomain()));
  }
  // format path attribute
  if ((cookie.getPath() != null) && (cookie.isPathAttributeSpecified())) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Path", cookie.getPath()));
  }
  // format port attribute
  if (cookie.isPortAttributeSpecified()) {
    String portValue = "";
    if (!cookie.isPortAttributeBlank()) {
      portValue = createPortAttribute(cookie.getPorts());
    }
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Port", portValue));
  }
}

origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

private void doFormatCookie2(final Cookie2 cookie, final StringBuffer buffer) {
  String name = cookie.getName();
  String value = cookie.getValue();
  if (value == null) {
    value = "";
  }
  this.formatter.format(buffer, new NameValuePair(name, value));
  // format domain attribute
  if (cookie.getDomain() != null && cookie.isDomainAttributeSpecified()) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Domain", cookie.getDomain()));
  }
  // format path attribute
  if ((cookie.getPath() != null) && (cookie.isPathAttributeSpecified())) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Path", cookie.getPath()));
  }
  // format port attribute
  if (cookie.isPortAttributeSpecified()) {
    String portValue = "";
    if (!cookie.isPortAttributeBlank()) {
      portValue = createPortAttribute(cookie.getPorts());
    }
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Port", portValue));
  }
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

private void doFormatCookie2(final Cookie2 cookie, final StringBuffer buffer) {
  String name = cookie.getName();
  String value = cookie.getValue();
  if (value == null) {
    value = "";
  }
  this.formatter.format(buffer, new NameValuePair(name, value));
  // format domain attribute
  if (cookie.getDomain() != null && cookie.isDomainAttributeSpecified()) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Domain", cookie.getDomain()));
  }
  // format path attribute
  if ((cookie.getPath() != null) && (cookie.isPathAttributeSpecified())) {
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Path", cookie.getPath()));
  }
  // format port attribute
  if (cookie.isPortAttributeSpecified()) {
    String portValue = "";
    if (!cookie.isPortAttributeBlank()) {
      portValue = createPortAttribute(cookie.getPorts());
    }
    buffer.append("; ");
    this.formatter.format(buffer, new NameValuePair("$Port", portValue));
  }
}

org.apache.commons.httpclient.cookieCookie2isPortAttributeSpecified

Popular methods of Cookie2

  • <init>
    Creates a cookie with the given name, value, domain attribute, path attribute, expiration attribute,
  • getDomain
  • getExpiryDate
  • getName
  • getPath
  • getPorts
    Get the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request
  • getValue
  • getVersion
  • isDomainAttributeSpecified
  • isPathAttributeSpecified
  • isPortAttributeBlank
  • isVersionAttributeSpecified
  • isPortAttributeBlank,
  • isVersionAttributeSpecified,
  • setCommentURL,
  • setDiscard,
  • setPortAttributeBlank,
  • setPortAttributeSpecified,
  • setPorts,
  • setVersion,
  • setVersionAttributeSpecified

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • setRequestProperty (URLConnection)
  • Kernel (java.awt.image)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now