[PATCH} Re: Tomcat 3.2.1 bug if not root-context defined.

2000-12-23 Thread Shawn McMurdo

I have attached a patch that corrects this problem for me.
Please try it out and see if it works for you so that a committer can
apply it.
This is a patch against the current 3.2 branch for the ContextManager.
Happy Holidays!
Shawn


Klaus Friedel wrote:

 Tomcat 3.2.1 fails to deliver a resource, if no root-context is defined in 
serverl.xml.
 If you do not define the root-context "" in server.xml and request a non-existing 
resource,
 Tomcat will loop forever in PrefixMapper.getLongestPrefixMatch() trying to find a 
Container for "".

 Bye,
 Klaus.

--
Shawn McMurdo  mailto:[EMAIL PROTECTED]
Lutris Technologieshttp://www.lutris.com
Enhydra.Orghttp://www.enhydra.org


Title: Not found!
Index: ContextManager.java
===
RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
retrieving revision 1.100.2.19
diff -c -r1.100.2.19 ContextManager.java
*** ContextManager.java	2000/11/16 18:25:21	1.100.2.19
--- ContextManager.java	2000/12/24 01:57:28
***
*** 1015,1020 
--- 1015,1043 
  	Context ctx = req.getContext();
  	if(ctx==null) ctx=getContext("");
  
+ 	// XXX We handle this case specially
+ 	if (ctx == null) {
+ 	try {
+ 		res.setContentType("text/html");
+ 		String body = "Not found!";
+ 		res.setContentLength(body.length());
+ 		if (res.isUsingStream()) {
+ 		ServletOutputStream out = res.getOutputStream();
+ 		out.print(body);
+ 		out.flush();
+ 		} else {
+ 		PrintWriter out = res.getWriter();
+ 		out.print(body);
+ 		out.flush();
+ 		}
+ 		return;
+ 	} catch (IOException ioe) {
+ 		// XXX ignore, we tried
+ 		//ioe.printStackTrace();
+ 		return;
+ 	}
+ 	}
+ 
  	// don't log normal cases ( redirect and need_auth ), they are not
  	// error
  	// XXX this log was intended to debug the status code generation.


Re: Tomcat 3.2.1 bug if not root-context defined.

2000-12-21 Thread Shawn McMurdo

Hi Klaus,
I ran into this as well and thought it was particular to the way that Tomcat is 
integrated
with Enhydra.  I think I have a fix for it.  I'll try to get a patch together and post 
it soon.
Shawn

Klaus Friedel wrote:

 Tomcat 3.2.1 fails to deliver a resource, if no root-context is defined in 
serverl.xml.
 If you do not define the root-context "" in server.xml and request a non-existing 
resource,
 Tomcat will loop forever in PrefixMapper.getLongestPrefixMatch() trying to find a 
Container for "".

 Bye,
 Klaus.

--
Shawn McMurdo  mailto:[EMAIL PROTECTED]
Lutris Technologieshttp://www.lutris.com
Enhydra.Orghttp://www.enhydra.org