@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); final String host = origin.getHost(); String domain = cookie.getDomain(); if (domain == null) { return false; } if (domain.startsWith(".")) { domain = domain.substring(1); } domain = domain.toLowerCase(Locale.ROOT); if (host.equals(domain)) { return true; } if (cookie instanceof ClientCookie) { if (((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { return domainMatch(domain, host); } } return false; }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); final String host = origin.getHost(); String domain = cookie.getDomain(); if (domain == null) { return false; } if (domain.startsWith(".")) { domain = domain.substring(1); } domain = domain.toLowerCase(Locale.ROOT); if (host.equals(domain)) { return true; } if (cookie instanceof ClientCookie) { if (((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { return domainMatch(domain, host); } } return false; }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); final String host = origin.getHost(); String domain = cookie.getDomain(); if (domain == null) { return false; } if (domain.startsWith(".")) { domain = domain.substring(1); } domain = domain.toLowerCase(Locale.ROOT); if (host.equals(domain)) { return true; } if (cookie instanceof ClientCookie) { if (((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { return domainMatch(domain, host); } } return false; }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); final String host = origin.getHost(); String domain = cookie.getDomain(); if (domain == null) { return false; } if (domain.startsWith(".")) { domain = domain.substring(1); } domain = domain.toLowerCase(Locale.ROOT); if (host.equals(domain)) { return true; } if (cookie instanceof ClientCookie) { if (((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { return domainMatch(domain, host); } } return false; }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); final String host = origin.getHost(); String domain = cookie.getDomain(); if (domain == null) { return false; } if (domain.startsWith(".")) { domain = domain.substring(1); } domain = domain.toLowerCase(Locale.ROOT); if (host.equals(domain)) { return true; } if (cookie instanceof ClientCookie) { if (((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { return domainMatch(domain, host); } } return false; }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { final String host = origin.getHost(); final String domain = cookie.getDomain(); if (!host.equals(domain) && !BasicDomainHandler.domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal domain attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } if (host.contains(".")) { final int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { final String host = origin.getHost(); final String domain = cookie.getDomain(); if (!host.equals(domain) && !BasicDomainHandler.domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal domain attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } if (host.contains(".")) { final int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { final String host = origin.getHost(); final String domain = cookie.getDomain(); if (!host.equals(domain) && !BasicDomainHandler.domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal domain attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } if (host.contains(".")) { final int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { final String host = origin.getHost(); final String domain = cookie.getDomain(); if (!host.equals(domain) && !BasicDomainHandler.domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal domain attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } if (host.contains(".")) { final int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { final String host = origin.getHost(); final String domain = cookie.getDomain(); if (!host.equals(domain) && !BasicDomainHandler.domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal domain attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } if (host.contains(".")) { final int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new CookieRestrictionViolationException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); // Validate the cookies domain attribute. NOTE: Domains without // any dots are allowed to support hosts on private LANs that don't // have DNS names. Since they have no dots, to domain-match the // request-host and domain must be identical for the cookie to sent // back to the origin-server. final String host = origin.getHost(); final String domain = cookie.getDomain(); if (domain == null) { throw new CookieRestrictionViolationException("Cookie 'domain' may not be null"); } if (!host.equals(domain) && !domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal 'domain' attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); // Validate the cookies domain attribute. NOTE: Domains without // any dots are allowed to support hosts on private LANs that don't // have DNS names. Since they have no dots, to domain-match the // request-host and domain must be identical for the cookie to sent // back to the origin-server. final String host = origin.getHost(); final String domain = cookie.getDomain(); if (domain == null) { throw new CookieRestrictionViolationException("Cookie 'domain' may not be null"); } if (!host.equals(domain) && !domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal 'domain' attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); // Validate the cookies domain attribute. NOTE: Domains without // any dots are allowed to support hosts on private LANs that don't // have DNS names. Since they have no dots, to domain-match the // request-host and domain must be identical for the cookie to sent // back to the origin-server. final String host = origin.getHost(); final String domain = cookie.getDomain(); if (domain == null) { throw new CookieRestrictionViolationException("Cookie 'domain' may not be null"); } if (!host.equals(domain) && !domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal 'domain' attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); // Validate the cookies domain attribute. NOTE: Domains without // any dots are allowed to support hosts on private LANs that don't // have DNS names. Since they have no dots, to domain-match the // request-host and domain must be identical for the cookie to sent // back to the origin-server. final String host = origin.getHost(); final String domain = cookie.getDomain(); if (domain == null) { throw new CookieRestrictionViolationException("Cookie 'domain' may not be null"); } if (!host.equals(domain) && !domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal 'domain' attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); // Validate the cookies domain attribute. NOTE: Domains without // any dots are allowed to support hosts on private LANs that don't // have DNS names. Since they have no dots, to domain-match the // request-host and domain must be identical for the cookie to sent // back to the origin-server. final String host = origin.getHost(); final String domain = cookie.getDomain(); if (domain == null) { throw new CookieRestrictionViolationException("Cookie 'domain' may not be null"); } if (!host.equals(domain) && !domainMatch(domain, host)) { throw new CookieRestrictionViolationException( "Illegal 'domain' attribute \"" + domain + "\". Domain of origin: \"" + host + "\""); } }