protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
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 targetpath = origin.getPath(); String topmostPath = cookie.getPath(); if (topmostPath == null) { topmostPath = "/"; } if (topmostPath.length() > 1 && topmostPath.endsWith("/")) { topmostPath = topmostPath.substring(0, topmostPath.length() - 1); } boolean match = targetpath.startsWith (topmostPath); // if there is a match and these values are not exactly the same we have // to make sure we're not matcing "/foobar" and "/foo" if (match && targetpath.length() != topmostPath.length()) { if (!topmostPath.endsWith("/")) { match = (targetpath.charAt(topmostPath.length()) == '/'); } } return match; }
public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (!match(cookie, origin)) { throw new MalformedCookieException( "Illegal path attribute \"" + cookie.getPath() + "\". Path of origin: \"" + origin.getPath() + "\""); } }
host, origin.getPort(), origin.getPath(), origin.isSecure()); } else {
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
protected static String getDefaultPath(final CookieOrigin origin) { String defaultPath = origin.getPath(); int lastSlashIndex = defaultPath.lastIndexOf('/'); if (lastSlashIndex >= 0) { if (lastSlashIndex == 0) { //Do not remove the very first slash lastSlashIndex = 1; } defaultPath = defaultPath.substring(0, lastSlashIndex); } return defaultPath; }
public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (!match(cookie, origin)) { throw new MalformedCookieException( "Illegal path attribute \"" + cookie.getPath() + "\". Path of origin: \"" + origin.getPath() + "\""); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (!match(cookie, origin)) { throw new CookieRestrictionViolationException( "Illegal 'path' attribute \"" + cookie.getPath() + "\". Path of origin: \"" + origin.getPath() + "\""); } }
public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (!match(cookie, origin)) { throw new CookieRestrictionViolationException( "Illegal path attribute \"" + cookie.getPath() + "\". Path of origin: \"" + origin.getPath() + "\""); } }
public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (!match(cookie, origin)) { throw new MalformedCookieException( "Illegal path attribute \"" + cookie.getPath() + "\". Path of origin: \"" + origin.getPath() + "\""); } }
@Override public void validate( final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (!match(cookie, origin)) { throw new CookieRestrictionViolationException( "Illegal 'path' attribute \"" + cookie.getPath() + "\". Path of origin: \"" + origin.getPath() + "\""); } }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return pathMatch(origin.getPath(), cookie.getPath()); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return pathMatch(origin.getPath(), cookie.getPath()); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return pathMatch(origin.getPath(), cookie.getPath()); }