https://bz.apache.org/bugzilla/show_bug.cgi?id=57645
Bug ID: 57645
Summary: getContext("/") returns null
Product: Tomcat 7
Version: 7.0.59
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
The getContext() method incorrectly returns null when requesting the ROOT
context ("/"). The following fix resolves the issue:
public ServletContext getContext(String uri) {
// Validate the format of the specified argument
if ((uri == null) || (!uri.startsWith("/")))
return (null);
Context child = null;
try {
// Look for an exact match
Container host = context.getParent();
child = (Context) host.findChild(uri);
if ( (child == null) && "/".equals(uri) ) { // fix
child = (Context) host.findChild(""); // fix
} // fix
The root context was created via:
Context context = embedded.addWebapp("", "/path/to/webapps/ROOT");
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]