Tabnine Logo
CookieOrigin
Code IndexAdd Tabnine to your IDE (free)

How to use
CookieOrigin
in
org.apache.commons.httpclient.cookie

Best Java code snippets using org.apache.commons.httpclient.cookie.CookieOrigin (Showing top 20 results out of 315)

origin: commons-httpclient/commons-httpclient

  return false;
CookieOrigin origin = new CookieOrigin(getEffectiveHost(host), port, path, secure); 
for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) {
  CookieAttributeHandler handler = (CookieAttributeHandler) i.next();
origin: commons-httpclient/commons-httpclient

/**
 * Match cookie domain attribute.
 */
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");
  }
  String host = origin.getHost().toLowerCase();
  String cookieDomain = cookie.getDomain();
  // The effective host name MUST domain-match the Domain
  // attribute of the cookie.
  if (!domainMatch(host, cookieDomain)) {
    return false;
  }
  // effective host name minus domain must not contain any dots
  String effectiveHostWithoutDomain = host.substring(
      0, host.length() - cookieDomain.length());
  if (effectiveHostWithoutDomain.indexOf('.') != -1) {
    return false;
  }
  return true;
}
origin: commons-httpclient/commons-httpclient

  /**
   * Match cookie path attribute. The value for the Path attribute must be a
   * prefix of the request-URI (case-sensitive matching).
   */
  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");
    }
    String path = origin.getPath();
    if (cookie.getPath() == null) {
      LOG.warn("Invalid cookie state: path attribute is null.");
      return false;
    }
    if (path.trim().equals("")) {
      path = PATH_DELIM;
    }
    if (!pathMatch(path, cookie.getPath())) {
      return false;
    }
    return true;
  }
}
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

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");
  }
  return cookie.getSecure() == origin.isSecure();
}

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: org.apache.commons/com.springsource.org.apache.commons.httpclient

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");
  }
  return cookie.getSecure() == origin.isSecure();
}

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: commons-httpclient/commons-httpclient

  throw new IllegalArgumentException("Cookie origin may not be null");
String host = origin.getHost().toLowerCase();
if (cookie.getDomain() == null) {
  throw new MalformedCookieException("Invalid cookie state: " +
origin: commons-httpclient/commons-httpclient

/**
 * Validate cookie path attribute. The value for the Path attribute must be a
 * prefix of the request-URI (case-sensitive matching).
 */
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");
  }
  String path = origin.getPath();
  if (path == null) {
    throw new IllegalArgumentException(
        "Path of origin host may not be null.");
  }
  if (cookie.getPath() == null) {
    throw new MalformedCookieException("Invalid cookie state: " +
                      "path attribute is null.");
  }
  if (path.trim().equals("")) {
    path = PATH_DELIM;
  }
  if (!pathMatch(path, cookie.getPath())) {
    throw new MalformedCookieException(
        "Illegal path attribute \"" + cookie.getPath()
        + "\". Path of origin: \"" + path + "\"");
  }
}
origin: commons-httpclient/commons-httpclient

  throw new MalformedCookieException("Cookie name may not start with $");
CookieOrigin origin = new CookieOrigin(getEffectiveHost(host), port, path, secure); 
for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) {
 CookieAttributeHandler handler = (CookieAttributeHandler) i.next();
origin: org.apache.commons/httpclient

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");
  }
  return cookie.getSecure() == origin.isSecure();
}

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.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Match cookie domain attribute.
 */
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");
  }
  String host = origin.getHost().toLowerCase();
  String cookieDomain = cookie.getDomain();
  // The effective host name MUST domain-match the Domain
  // attribute of the cookie.
  if (!domainMatch(host, cookieDomain)) {
    return false;
  }
  // effective host name minus domain must not contain any dots
  String effectiveHostWithoutDomain = host.substring(
      0, host.length() - cookieDomain.length());
  if (effectiveHostWithoutDomain.indexOf('.') != -1) {
    return false;
  }
  return true;
}
origin: org.apache.commons/httpclient

  /**
   * Match cookie path attribute. The value for the Path attribute must be a
   * prefix of the request-URI (case-sensitive matching).
   */
  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");
    }
    String path = origin.getPath();
    if (cookie.getPath() == null) {
      LOG.warn("Invalid cookie state: path attribute is null.");
      return false;
    }
    if (path.trim().equals("")) {
      path = PATH_DELIM;
    }
    if (!pathMatch(path, cookie.getPath())) {
      return false;
    }
    return true;
  }
}
origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

  return false;
CookieOrigin origin = new CookieOrigin(getEffectiveHost(host), port, path, secure); 
for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) {
  CookieAttributeHandler handler = (CookieAttributeHandler) i.next();
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

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");
  }
  return cookie.getSecure() == origin.isSecure();
}

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.commons/com.springsource.org.apache.commons.httpclient

/**
 * Match cookie domain attribute.
 */
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");
  }
  String host = origin.getHost().toLowerCase();
  String cookieDomain = cookie.getDomain();
  // The effective host name MUST domain-match the Domain
  // attribute of the cookie.
  if (!domainMatch(host, cookieDomain)) {
    return false;
  }
  // effective host name minus domain must not contain any dots
  String effectiveHostWithoutDomain = host.substring(
      0, host.length() - cookieDomain.length());
  if (effectiveHostWithoutDomain.indexOf('.') != -1) {
    return false;
  }
  return true;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

  /**
   * Match cookie path attribute. The value for the Path attribute must be a
   * prefix of the request-URI (case-sensitive matching).
   */
  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");
    }
    String path = origin.getPath();
    if (cookie.getPath() == null) {
      LOG.warn("Invalid cookie state: path attribute is null.");
      return false;
    }
    if (path.trim().equals("")) {
      path = PATH_DELIM;
    }
    if (!pathMatch(path, cookie.getPath())) {
      return false;
    }
    return true;
  }
}
org.apache.commons.httpclient.cookieCookieOrigin

Javadoc

CookieOrigin class incapsulates details of an origin server that are relevant when parsing, validating or matching HTTP cookies.

Most used methods

  • <init>
  • getHost
  • getPath
  • getPort
  • isSecure

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm plugins
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