/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(); if (datepatterns != null) { this.datepatterns = datepatterns.clone(); } else { this.datepatterns = new String[] { EXPIRES_PATTERN }; } registerAttribHandler(ClientCookie.PATH_ATTR, new BasicPathHandler()); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new NetscapeDomainHandler()); registerAttribHandler(ClientCookie.MAX_AGE_ATTR, new BasicMaxAgeHandler()); registerAttribHandler(ClientCookie.SECURE_ATTR, new BasicSecureHandler()); registerAttribHandler(ClientCookie.COMMENT_ATTR, new BasicCommentHandler()); registerAttribHandler(ClientCookie.EXPIRES_ATTR, new BasicExpiresHandler( this.datepatterns)); }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { super.validate(cookie, origin); // Perform Netscape Cookie draft specific validation String host = origin.getHost(); String domain = cookie.getDomain(); if (host.contains(".")) { int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (origin != null && origin.getHost() != null && cookie != null) { String hostPort = origin.getHost() + ":" + origin.getPort(); String domain = cookie.getDomain(); if (hostPort.equals(domain)) { return; } } super.validate(cookie, origin); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { if (origin != null && origin.getHost() != null && cookie != null) { String hostPort = origin.getHost() + ":" + origin.getPort(); String domain = cookie.getDomain(); if (hostPort.equals(domain)) { return true; } } return super.match(cookie, origin); } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(new BasicPathHandler(), new NetscapeDomainHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new BasicExpiresHandler( datepatterns != null ? datepatterns.clone() : new String[]{EXPIRES_PATTERN})); }
@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"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(new BasicPathHandler(), new NetscapeDomainHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new BasicExpiresHandler( datepatterns != null ? datepatterns.clone() : new String[]{EXPIRES_PATTERN})); }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { super.validate(cookie, origin); // Perform Netscape Cookie draft specific validation String host = origin.getHost(); String domain = cookie.getDomain(); if (host.contains(".")) { int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(new BasicPathHandler(), new NetscapeDomainHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new BasicExpiresHandler( datepatterns != null ? datepatterns.clone() : new String[]{EXPIRES_PATTERN})); }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { super.validate(cookie, origin); // Perform Netscape Cookie draft specific validation String host = origin.getHost(); String domain = cookie.getDomain(); if (host.contains(".")) { int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(new BasicPathHandler(), new NetscapeDomainHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new BasicExpiresHandler( datepatterns != null ? datepatterns.clone() : new String[]{EXPIRES_PATTERN})); }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { super.validate(cookie, origin); // Perform Netscape Cookie draft specific validation String host = origin.getHost(); String domain = cookie.getDomain(); if (host.contains(".")) { int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(new BasicPathHandler(), new NetscapeDomainHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new BasicExpiresHandler( datepatterns != null ? datepatterns.clone() : new String[]{EXPIRES_PATTERN})); }
@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"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(); if (datepatterns != null) { this.datepatterns = datepatterns.clone(); } else { this.datepatterns = new String[] { EXPIRES_PATTERN }; } registerAttribHandler(ClientCookie.PATH_ATTR, new BasicPathHandler()); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new NetscapeDomainHandler()); registerAttribHandler(ClientCookie.SECURE_ATTR, new BasicSecureHandler()); registerAttribHandler(ClientCookie.COMMENT_ATTR, new BasicCommentHandler()); registerAttribHandler(ClientCookie.EXPIRES_ATTR, new BasicExpiresHandler( this.datepatterns)); }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { super.validate(cookie, origin); // Perform Netscape Cookie draft specific validation String host = origin.getHost(); String domain = cookie.getDomain(); if (host.contains(".")) { int domainParts = new StringTokenizer(domain, ".").countTokens(); if (isSpecialDomain(domain)) { if (domainParts < 2) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification for " + "special domains"); } } else { if (domainParts < 3) { throw new MalformedCookieException("Domain attribute \"" + domain + "\" violates the Netscape cookie specification"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(); if (datepatterns != null) { this.datepatterns = datepatterns.clone(); } else { this.datepatterns = new String[] { EXPIRES_PATTERN }; } registerAttribHandler(ClientCookie.PATH_ATTR, new BasicPathHandler()); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new NetscapeDomainHandler()); registerAttribHandler(ClientCookie.MAX_AGE_ATTR, new BasicMaxAgeHandler()); registerAttribHandler(ClientCookie.SECURE_ATTR, new BasicSecureHandler()); registerAttribHandler(ClientCookie.COMMENT_ATTR, new BasicCommentHandler()); registerAttribHandler(ClientCookie.EXPIRES_ATTR, new BasicExpiresHandler( this.datepatterns)); }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { super.validate(cookie, origin); // Perform Netscape Cookie draft specific validation final String host = origin.getHost(); final String domain = cookie.getDomain(); 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"); } } } }
/** Default constructor */ public NetscapeDraftSpec(final String[] datepatterns) { super(); if (datepatterns != null) { this.datepatterns = datepatterns.clone(); } else { this.datepatterns = new String[] { EXPIRES_PATTERN }; } registerAttribHandler(ClientCookie.PATH_ATTR, new BasicPathHandler()); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new NetscapeDomainHandler()); registerAttribHandler(ClientCookie.MAX_AGE_ATTR, new BasicMaxAgeHandler()); registerAttribHandler(ClientCookie.SECURE_ATTR, new BasicSecureHandler()); registerAttribHandler(ClientCookie.COMMENT_ATTR, new BasicCommentHandler()); registerAttribHandler(ClientCookie.EXPIRES_ATTR, new BasicExpiresHandler( this.datepatterns)); }
@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"); } } } }