((HttpServletRequestFacade)request.getFacade()).
isRequestedSessionIdFromCookie())
return false;
// Is this a valid absolute URL?
URL url = null;
try {
url = new URL(location);
} catch (MalformedURLException e) {
return (false);
}
// Does this URL match down to (and including) the context path?
if (!request.scheme().equalsIgnoreCase(url.getProtocol()))
return (false);
if (!request.serverName().equalsIgnoreCase(url.getHost()))
return (false);
// Set the URL port to HTTP default if not available before comparing
int urlPort = url.getPort();
if (urlPort == -1) {
if("http".equalsIgnoreCase(url.getProtocol())) {
urlPort = 80;
} else if ("https".equalsIgnoreCase(url.getProtocol())) {
urlPort = 443;
}
}
int serverPort = request.getServerPort();
if (serverPort == -1) // Work around bug in java.net.URL.getHost()
serverPort = 80;
if (serverPort != urlPort)
return (false);
String contextPath = request.getContext().getPath();
if ((contextPath != null) && (contextPath.length() > 0)) {
String file = url.getFile();
if ((file == null) || !file.startsWith(contextPath))
return (false);
// XXX endsWith() ? However, that confilicts with
// the ;charset= attribute.
if(file.indexOf(";jsessionid=" + session.getId()) >= 0)