[PATCH] Catalina CGIServlet broken redirects

2005-10-12 Thread May, Patrick
Title: [PATCH] Catalina CGIServlet broken redirects





Hello,


The Catalina CGIServlet (as of tomcat 5.0.28) does not have a special case for handling Status headers set by a cgi script. When a script tries to issue a redirect, tomcat returns inconsistent headers:

 HTTP/1.x 200 OK
 Status: 300 Moved


This behaviour breaks the redirect. Attached is a patch which adds a special case for Status headers to


 catalina/src/share/org/apache/catalina/servlets/CGIServlet.java


The patch was written against the tomcat 5.0.28 sources.


Cheers,


Patrick May



~~
Patrick May
Software Engineer
SourceMedia
1 State St Plaza 25th Floor
New York, NY 10004
Tel: (212) 803-6589
Email: [EMAIL PROTECTED]
URL: www.sourcemedia.com






This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

[5][PATCH]catalina/tester fix golden files for new request listener noise

2002-09-23 Thread Steve Downey

JSP includes now trigger request listeners with the attributes for dispatcher 
types and dispatcher request paths. This patch adds the output from the 
request listener to the golden files.



Index: JspInclude01a.txt
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/tester/web/golden/JspInclude01a.txt,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 JspInclude01a.txt
--- JspInclude01a.txt	18 Jul 2002 16:47:25 -	1.1.1.1
+++ JspInclude01a.txt	23 Sep 2002 17:36:30 -
@@ -1,6 +1,8 @@
 This is before the include
 Include00a PASSEDSessionListener01: sessionCreated()
 SessionListener02: sessionCreated()
+RequestListener01: attributeReplaced(org.apache.catalina.core.DISPATCHER_TYPE,8)
+RequestListener01: attributeReplaced(org.apache.catalina.core.DISPATCHER_REQUEST_PATH,/JspInclude01.jsp)
 
 This is after the include
 
Index: JspInclude02a.txt
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/tester/web/golden/JspInclude02a.txt,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 JspInclude02a.txt
--- JspInclude02a.txt	18 Jul 2002 16:47:25 -	1.1.1.1
+++ JspInclude02a.txt	23 Sep 2002 17:36:30 -
@@ -1,6 +1,8 @@
 This is before the include
 Include00a PASSEDSessionListener01: sessionCreated()
 SessionListener02: sessionCreated()
+RequestListener01: attributeReplaced(org.apache.catalina.core.DISPATCHER_TYPE,8)
+RequestListener01: attributeReplaced(org.apache.catalina.core.DISPATCHER_REQUEST_PATH,/JspInclude02.jsp)
 
 This is after the include
 



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: [5][PATCH]catalina-tester assumes that ServletExceptions are NOT unwrapped

2002-09-23 Thread micael

That would be appreciated, John.

At 02:01 PM 9/23/2002 -0400, you wrote:
Per Servlet 2.3, if a servlet throws a wrapped exception, the error handler
that receives it gets the underlying root cause as the exception. That is, if
ServletException(new TesterException()) is thrown, the exception in the
request under attribute javax.servlet.error.exception will be
TesterException, not ServletException.

The test in catalina/tester assumes that the root cause will still be wrapped
in a ServletException.


With this patch, plus the others I've posted, the tomcat-5 passes all of the
catalina tester tests. If anyone is interested, I can post a rolled up set of
patches.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




[PATCH] catalina DateTool thread safety issue

2002-09-18 Thread Steve Downey

This patch mirrors that in connectors. DateTool in catalina util is largely 
obsolete, in any case. The patch cuts out unused code.



? share/org/apache/catalina/startup/CatalinaService.java.smd
Index: share/org/apache/catalina/util/CookieTools.java
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CookieTools.java,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 CookieTools.java
--- share/org/apache/catalina/util/CookieTools.java	18 Jul 2002 16:47:45 -	1.1.1.1
+++ share/org/apache/catalina/util/CookieTools.java	18 Sep 2002 23:35:05 -
@@ -143,10 +143,10 @@
 if (version == 0) {
 buf.append (;Expires=);
 if (cookie.getMaxAge() == 0)
-DateTool.oldCookieFormat.format(new Date(1), buf,
+DateTool.formatOldCookie(new Date(1), buf,
 new FieldPosition(0));
 else
-DateTool.oldCookieFormat.format
+DateTool.formatOldCookie
 (new Date( System.currentTimeMillis() +
cookie.getMaxAge() *1000L), buf,
  new FieldPosition(0));
Index: share/org/apache/catalina/util/DateTool.java
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/DateTool.java,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 DateTool.java
--- share/org/apache/catalina/util/DateTool.java	18 Jul 2002 16:47:45 -	1.1.1.1
+++ share/org/apache/catalina/util/DateTool.java	18 Sep 2002 23:35:05 -
@@ -79,55 +79,34 @@
  */
 public class DateTool {
 
-private static StringManager sm =
-StringManager.getManager(org.apache.catalina.util);
-
 /** US locale - all HTTP dates are in english
  */
 public final static Locale LOCALE_US = Locale.US;
 
 /** GMT timezone - all HTTP dates are on GMT
  */
-public final static TimeZone GMT_ZONE = TimeZone.getTimeZone(GMT);
-
-/** format for RFC 1123 date string -- Sun, 06 Nov 1994 08:49:37 GMT
- */
-public final static String RFC1123_PATTERN =
-EEE, dd MMM y HH:mm:ss z;
-
-// format for RFC 1036 date string -- Sunday, 06-Nov-94 08:49:37 GMT
-private final static String rfc1036Pattern =
-E, dd-MMM-yy HH:mm:ss z;
-
-// format for C asctime() date string -- Sun Nov  6 08:49:37 1994
-private final static String asctimePattern =
-EEE MMM d HH:mm:ss y;
+private final static TimeZone GMT_ZONE = TimeZone.getTimeZone(GMT);
 
 /** Pattern used for old cookies
  */
 public final static String OLD_COOKIE_PATTERN = EEE, dd-MMM- HH:mm:ss z;
 
-/** DateFormat to be used to format dates
- */
-public final static DateFormat rfc1123Format =
-new SimpleDateFormat(RFC1123_PATTERN, LOCALE_US);
-
 /** DateFormat to be used to format old netscape cookies
  */
-public final static DateFormat oldCookieFormat =
+private final static DateFormat oldCookieFormat =
 new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US);
 
-public final static DateFormat rfc1036Format =
-new SimpleDateFormat(rfc1036Pattern, LOCALE_US);
-
-public final static DateFormat asctimeFormat =
-new SimpleDateFormat(asctimePattern, LOCALE_US);
-
 static {
-rfc1123Format.setTimeZone(GMT_ZONE);
 oldCookieFormat.setTimeZone(GMT_ZONE);
-rfc1036Format.setTimeZone(GMT_ZONE);
-asctimeFormat.setTimeZone(GMT_ZONE);
+}
+
+public static StringBuffer formatOldCookie(
+  Date d,
+  StringBuffer buf,
+  FieldPosition fieldPosition) {
+  synchronized (oldCookieFormat) {
+return oldCookieFormat.format(d, buf, fieldPosition);
+  }
 }
 
 }



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


[5][PATCH] catalina/tester fix some false positive and false negative tests

2002-09-10 Thread Steve Downey

This patch builds tester against the servletapi-5 classes and repairs the URLs 
in the JSP examples used by tester. These were causing some false positve and 
false negative test results. 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: [5][PATCH] catalina/tester fix some false positive and false negative tests

2002-09-10 Thread Steve Downey

sigh/
On Tuesday 10 September 2002 10:56 pm, Steve Downey wrote:
 This patch builds tester against the servletapi-5 classes and repairs the
 URLs in the JSP examples used by tester. These were causing some false
 positve and false negative test results.


Index: build.xml
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/tester/build.xml,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 build.xml
--- build.xml	18 Jul 2002 16:47:24 -	1.1.1.1
+++ build.xml	11 Sep 2002 02:54:01 -
@@ -8,14 +8,14 @@
   property file=${user.home}/build.properties/
 
   property name=build.compiler  value=classic/
-  property name=servletapi.home value=../../jakarta-servletapi-4/dist/
+  property name=api.home value=../../jakarta-servletapi-5/dist/
   property name=tester.buildvalue=${basedir}/build/
   property name=tester.deploy   value=${basedir}/../build/
   property name=tester.dist value=${basedir}/dist/
 
   !-- == Derived Property Values = --
   property name=ant.jar value=${ant.home}/lib/ant.jar/
-  property name=servlet.jar value=${servletapi.home}/lib/servlet.jar/
+  property name=servlet-api.jar value=${api.home}/jsr154/dist/lib/servlet-api.jar/
 
   !-- === BUILD: Create Directories == --
   target name=build-prepare
@@ -56,7 +56,7 @@
 
 !-- Compile tester components and tools --
 javac srcdir=src/tester destdir=${tester.build}/classes
- classpath=${ant.jar}:${servlet.jar}:${xerces.jar}
+ classpath=${ant.jar}:${servlet-api.jar}:${xercesImpl.jar}
  deprecation=off debug=on optimize=off
  excludes=**/CVS/**/
 
@@ -87,7 +87,7 @@
 tofile=${tester.build}/web/WEB-INF/classes/org/apache/tester/Unpacked05.txt/
 
 !-- Install Xerces --
-copy  todir=${tester.build}/web/WEB-INF/lib file=${xerces.jar}/
+copy  todir=${tester.build}/web/WEB-INF/lib file=${xercesImpl.jar}/
 
 !-- Create and install tester library --
 mkdir   dir=${tester.build}/web/WEB-INF/lib/
Index: src/bin/tester.xml
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/tester/src/bin/tester.xml,v
retrieving revision 1.2
diff -u -w -r1.2 tester.xml
--- src/bin/tester.xml	9 Aug 2002 02:12:13 -	1.2
+++ src/bin/tester.xml	11 Sep 2002 02:54:01 -
@@ -8,11 +8,15 @@
 !--  property name=protocol   value=HTTP/1.0/ --
   property name=protocol   value=/ !-- Use HttpURLConnection --
   property name=context.path   value=/tester/
-  property name=examples.path  value=/examples/
+  property name=examples.path  value=/jsp-examples/
   property name=golden.pathvalue=${context.path}/golden/
   property name=manager.path   value=/manager/
   property name=reload.pathvalue=/tester/
-  taskdef  name=tester classname=org.apache.tester.TestClient/
+  taskdef  name=tester classname=org.apache.tester.TestClient
+classpath
+  pathelement location=${catalina.home}/webapps/tester/WEB-INF/lib/tester.jar/
+/classpath
+  /taskdef
 
 
   target name=all depends=ROOT,Authentication,CaseSensitive,Decoding,ErrorPage,FilterRequest,FilterResponse,Jndi,Jsp,Lifecycle,RequestDispatcher,Resources,Security,ServletContext,ServletRequest,ServletResponse,HttpSession,XercesTest/
@@ -110,33 +114,23 @@
   status=404/
 
 !-- Should be able to execute the Date example --
-touch  file=${catalina.home}/webapps/examples/jsp/dates/date.jsp/
 tester host=${host} port=${port} protocol=${protocol}
- request=${examples.path}/jsp/dates/date.jsp debug=${debug}
+ request=${examples.path}/dates/date.jsp debug=${debug}
   status=200/
 
 !-- Should not be able to view the source of the Date example --
-touch  file=${catalina.home}/webapps/examples/jsp/dates/date.jsp/
 tester host=${host} port=${port} protocol=${protocol}
- request=${examples.path}/jsp/dates/date.Jsp debug=${debug}
+ request=${examples.path}/dates/date.Jsp debug=${debug}
   status=404/
 
 !-- Should not be able to view the source of the Date example --
-touch  file=${catalina.home}/webapps/examples/jsp/dates/date.jsp/
 tester host=${host} port=${port} protocol=${protocol}
- request=${examples.path}/jsp/dates/Date.jsp debug=${debug}
+ request=${examples.path}/dates/Date.jsp debug=${debug}
   status=404/
 
 !-- Should not be able to view the source of the Date example --
-touch  file=${catalina.home}/webapps/examples/jsp/dates/date.jsp/
 tester host=${host} port=${port} protocol=${protocol}
- request=${examples.path}/jsp/Dates/date.jsp debug=${debug}
-  status=404/
-
-!-- Should not be able to view the source of the Date example --
-touch  file=${catalina.home}/webapps/examples/jsp/dates/date.jsp/
-tester host=${host} port=${port} protocol=${protocol}
- 

[PATCH][Catalina] Validation turned off by default.

2002-08-20 Thread Jean-francois Arcand

Hi,

attached is a patch that implement the mechanism to turn off/on the XML 
validation and namespace awareness.  Starting with this patch, 
validation/namespace will be turned off. If you want to turn it on, do:

Host name=localhost debug=0 appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=true xmlNamespaceAware=true

*xmlValidation and xmlNamespaceAware are optional attributes. Current 
server.xml file are still supported.

I did not implement the functionality for server.xml and user.xml since 
the validation was turned off by default (and willnot work if validation 
is turned on).

Thanks,

-- Jeanfrancois


Index: server.xml
===
RCS file: /home/cvspublic/jakarta-tomcat-catalina/catalina/src/conf/server.xml,v
retrieving revision 1.3
diff -u -r1.3 server.xml
--- server.xml  4 Aug 2002 19:41:06 -   1.3
+++ server.xml  20 Aug 2002 18:25:01 -
@@ -219,10 +219,19 @@
   userRoleTable=user_roles roleNameCol=role_name /
   --
 
-  !-- Define the default virtual host --
-  Host name=localhost debug=0 appBase=webapps 
+  !-- Define the default virtual host.--
+  !--Host name=localhost debug=0 appBase=webapps 
unpackWARs=true autoDeploy=true
+   --
 
+  !-- Define the default virtual host. Uncomment this element if you 
+   want to turn on XML schema/dtd validation. --
+   
+  Host name=localhost debug=0 appBase=webapps 
+unpackWARs=true autoDeploy=true
+xmlValidation=true xmlNamespaceAware=true
+  
+   
 !-- Normally, users must authenticate themselves to each web app
  individually.  Uncomment the following entry if you would like
  a user to be authenticated the first time they encounter a


Index: Host.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Host.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Host.java
--- Host.java   18 Jul 2002 16:47:37 -  1.1.1.1
+++ Host.java   20 Aug 2002 18:17:57 -
@@ -171,8 +171,39 @@
  * @exception IllegalArgumentException if name is null
  */
 public void setName(String name);
+
+
+/**
+ * Get the server.xml host attribute's xmlNamespaceAware.
+ * @return true if namespace awarenes is enabled.
+ *
+ */
+public boolean getXmlNamespaceAware();
+
+
+/**
+ * Get the server.xml host attribute's xmlValidation.
+ * @return true if validation is enabled.
+ *
+ */
+public boolean getXmlValidation();
 
-
+
+/**
+ * Set the validation feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlValidation true to enable xml instance validation 
+ */
+public void setXmlValidation(boolean xmlValidation);
+
+
+   /**
+ * Set the namespace aware feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlNamespaceAware true to enable namespace awareness 
+ */
+public void setXmlNamespaceAware(boolean xmlNamespaceAware);
+
 // - Public Methods
 
Index: StandardHost.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 StandardHost.java
--- StandardHost.java   18 Jul 2002 16:48:08 -  1.1.1.1
+++ StandardHost.java   20 Aug 2002 18:18:35 -
@@ -211,7 +211,20 @@
  * DefaultContext config
  */
 private DefaultContext defaultContext;
-
+
+
+/**
+ * Attribute value used to turn on/off XML validation
+ */
+ private boolean xmlValidation = false;
+ 
+ 
+/**
+ * Attribute value used to turn on/off XML namespace awarenes.
+ */
+ private boolean xmlNamespaceAware = false;
+ 
+ 
 
 // - Properties
 
@@ -519,8 +532,48 @@
 
 this.workDir = workDir;
 }
-
-
+ 
+
+ /**
+ * Set the validation feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlValidation true to enable xml instance validation 
+ */
+public void setXmlValidation(boolean xmlValidation){
+this.xmlValidation = xmlValidation;
+}
+
+
+/**
+ * Get the server.xml host attribute's xmlValidation.
+ * @return true if validation is enabled.
+ *
+ */
+public boolean getXmlValidation(){
+return xmlValidation;
+}
+ 
+
+/**
+ * Get the server.xml host attribute's xmlNamespaceAware.
+ * @return true if namespace awarenes is enabled.
+ *
+ */   
+public boolean getXmlNamespaceAware(){
+

[PATCH] [Catalina]

2002-08-19 Thread Jean-francois Arcand

Hi,

this patch implements a new SAX's entity resolver that will re-direct 
any remote schema/dtd locally. The patch  implements a workaround for 
the warning problem when using Xerces 2.0.1 (see Remy's email). It also 
supports the current Xerces nightly build. I was unable to find a 
workaround for the StackOverflowException when using Xerces 2.0.2. At 
least we have one Xerces released version that work (very slow, that's 
why I gonna start adding validation switch on/off :-) )

Thanks,

-- Jeanfrancois


Index: ContextConfig.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
retrieving revision 1.8
diff -u -r1.8 ContextConfig.java
--- ContextConfig.java  10 Aug 2002 22:42:34 -  1.8
+++ ContextConfig.java  20 Aug 2002 00:46:48 -
@@ -124,9 +124,11 @@
 import org.apache.catalina.deploy.SecurityConstraint;
 import org.apache.catalina.loader.Extension;
 import org.apache.catalina.util.StringManager;
+import org.apache.catalina.util.SchemaResolver;
 import org.apache.catalina.valves.ValveBase;
 import org.apache.commons.digester.Digester;
 import org.xml.sax.InputSource;
+import org.xml.sax.EntityResolver;
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.SAXParseException;
@@ -275,12 +277,15 @@
 try {
 URL url =
 servletContext.getResource(Constants.ApplicationWebXml);
+
 InputSource is = new InputSource(url.toExternalForm());
 is.setByteStream(stream);
 webDigester.setDebug(getDebug());
 if (context instanceof StandardContext) {
 ((StandardContext) context).setReplaceWelcomeFiles(true);
 }
+
+
 webDigester.clear();
 webDigester.push(context);
 webDigester.parse(is);
@@ -482,25 +487,51 @@
 Digester tldDigester = new Digester();
 tldDigester.setNamespaceAware(true);
 tldDigester.setValidating(true);
+
+if (tldDigester.getFactory().getClass().getName().indexOf(xerces)!=-1) {
+tldDigester = patchXerces(tldDigester);
+}
+
+// Set the schemaLocation
+url = ContextConfig.class.getResource(Constants.TldSchemaResourcePath_20);
+SchemaResolver tldEntityResolver = new SchemaResolver(url.toString());
+tldDigester.setSchema(url.toString());   
+
 url = ContextConfig.class.getResource(Constants.TldDtdResourcePath_11);
-tldDigester.register(Constants.TldDtdPublicId_11,
- url.toString());
+tldEntityResolver.register(Constants.TldDtdPublicId_11,
+   url.toString());
+
 url = ContextConfig.class.getResource(Constants.TldDtdResourcePath_12);
-tldDigester.register(Constants.TldDtdPublicId_12,
- url.toString());
-
-url = ContextConfig.class.getResource(Constants.TldSchemaResourcePath_20);
-// to support servlet.jar that does not contains the schema
-if (url != null){
-tldDigester.setSchema(url.toString());
-tldDigester = registerLocalSchema(tldDigester);
-}
-
+tldEntityResolver.register(Constants.TldDtdPublicId_12,
+   url.toString());
+
+tldEntityResolver = registerLocalSchema(tldEntityResolver);
+
+tldDigester.setEntityResolver(tldEntityResolver);
 tldDigester.addRuleSet(new TldRuleSet());
 return (tldDigester);
 
 }
 
+
+private static Digester patchXerces(Digester digester){
+// This feature is needed for backward compatibility with old DDs
+// which used Java encoding names such as ISO8859_1 etc.
+// with Crimson (bug 4701993). By default, Xerces does not
+// support ISO8859_1.
+try{
+digester.setFeature(
+http://apache.org/xml/features/allow-java-encodings;, true);
+} catch(ParserConfigurationException e){
+// log(contextConfig.registerLocalSchema, e);
+} catch(SAXNotRecognizedException e){
+// log(contextConfig.registerLocalSchema, e);
+} catch(SAXNotSupportedException e){
+// log(contextConfig.registerLocalSchema, e);
+}
+return digester;
+}
+
 
 /**
  * Create (if necessary) and return a Digester configured to process the
@@ -512,26 +543,28 @@
 Digester webDigester = new Digester();
 webDigester.setNamespaceAware(true);
 webDigester.setValidating(true);
+   
+if (webDigester.getFactory().getClass().getName().indexOf(xerces)!=-1) {
+webDigester = 

[PATCH][Catalina] Use fully qualified URI for locating local schema

2002-08-10 Thread Jean-francois Arcand

Hi,

this patch change the way local schema are stored - use the full URI 
instead a the file name.

Thanks,

-- Jeanfrancois


Index: Constants.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Constants.java,v
retrieving revision 1.3
diff -u -r1.3 Constants.java
--- Constants.java  1 Aug 2002 04:53:03 -   1.3
+++ Constants.java  10 Aug 2002 14:46:08 -
@@ -93,9 +93,9 @@
 /javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd;
 
 public static final String TldSchemaPublicId_20 =
-web-jsptaglibrary_2_0.xsd;
+http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd;;
 public static final String TldSchemaResourcePath_20 =
-/javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd;
+/javax/servlet/resources/web-jsptaglibrary_2_0.xsd;
 
 public static final String WebDtdPublicId_22 =
 -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN;
@@ -110,23 +110,23 @@
 /javax/servlet/resources/web-app_2_3.dtd;
 
 public static final String WebSchemaPublicId_24 =
-web-app_2_4.xsd;
+http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;;
 public static final String WebSchemaResourcePath_24 =
 /javax/servlet/resources/web-app_2_4.xsd;
 
 public static final String J2eeSchemaPublicId_14 =
-j2ee_1_4.xsd;
+http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd;;
 public static final String J2eeSchemaResourcePath_14 =
 /javax/servlet/resources/j2ee_1_4.xsd;
 
 public static final String W3cSchemaPublicId_10 =
-xml.xsd;
+http://www.w3.org/2001/xml.xsd;;
 public static final String W3cSchemaResourcePath_10 =
 /javax/servlet/resources/xml.xsd;
 
 public static final String JspSchemaPublicId_20 =
-jsp_2_0.xsd;
+http://java.sun.com/xml/ns/j2ee/jsp_2_0.xsd;;
 public static final String JspSchemaResourcePath_20 =
-/javax/servlet/jsp/resources/jsp_2_0.xsd;
+/javax/servlet/resources/jsp_2_0.xsd;
 
 }
Index: ContextConfig.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
retrieving revision 1.7
diff -u -r1.7 ContextConfig.java
--- ContextConfig.java  8 Aug 2002 18:31:33 -   1.7
+++ ContextConfig.java  10 Aug 2002 14:46:08 -
@@ -493,10 +493,9 @@
 // to support servlet.jar that does not contains the schema
 if (url != null){
 tldDigester.setSchema(url.toString());
+tldDigester = registerLocalSchema(tldDigester);
 }
 
-tldDigester = registerLocalSchema(tldDigester);
-
 tldDigester.addRuleSet(new TldRuleSet());
 return (tldDigester);
 
@@ -527,9 +526,8 @@
 // to support servlet.jar that does not contains the schema
 if (url != null){
 webDigester.setSchema(url.toString());
+webDigester = registerLocalSchema(webDigester);
 }
-
-webDigester = registerLocalSchema(webDigester);
 
 webDigester.addRuleSet(new WebRuleSet());
 return (webDigester);



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: [PATCH][Catalina] Use fully qualified URI for locating localschema

2002-08-10 Thread Patrick Luby

Jean-François,

When I apply this patch and your jakarta-servletapi-5 patch and build 
with the latest commons-digester, I get the following exception. I seems 
that with your patches, Xerces no longer looks locally for the XML files.

Accordingly, I think we should figure out what is happening before these 
patches should be applied as these patches make it impossible for anyone 
running behind a firewall to run Tomcat.

Patrick

org.xml.sax.SAXParseException: src-import.0: Failed to read imported 
schema document 'http://www.w3.org/2001/xml.xsd'.
 at 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
 at 
org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:141)
 at 
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:358)
 at 
org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:1837)
 at 
org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1298)
 at 
org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1240)
 at 
org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:611)
 at 
org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:654)
 at 
org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:403)
 at 
org.apache.xerces.impl.xs.XMLSchemaValidator.processJAXPSchemaSource(XMLSchemaValidator.java:2302)
 at 
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1632)
 at 
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:568)
 at 
org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:832)
 at 
org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBinder.java:568)
 at 
org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:796)
 at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:752)
 at 
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:927)
 at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1519)
 at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
 at 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
 at 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
 at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
 at 
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148)
 at org.apache.commons.digester.Digester.parse(Digester.java:1512)
 at 
org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:573)
 at 
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:711)
 at 
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:247)
 at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
 at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3493)
 at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
 at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at 
org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:617)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at 
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
 at 
org.apache.commons.digester.SetNextRule.end(SetNextRule.java:260)
 at 
org.apache.commons.digester.Digester.endElement(Digester.java:1036)
 at 
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:559)
 at 
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:646)
 at 
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2978)
 at 
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:918)
 at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1145)
 at 

Re: [PATCH][Catalina] Use fully qualified URI for locating localschema

2002-08-10 Thread Jean-francois Arcand

Patrick,

you also have to apply the catalina pache where it is defined the local 
schema location (Constants.java). I made some change to avoid having 
Xerces resolving with the wrong URI.

Thanks,

Jeanfrancois.

Patrick Luby wrote:

 Jean-François,

 When I apply this patch and your jakarta-servletapi-5 patch and build 
 with the latest commons-digester, I get the following exception. I 
 seems that with your patches, Xerces no longer looks locally for the 
 XML files.

 Accordingly, I think we should figure out what is happening before 
 these patches should be applied as these patches make it impossible 
 for anyone running behind a firewall to run Tomcat.

 Patrick

 org.xml.sax.SAXParseException: src-import.0: Failed to read imported 
 schema document 'http://www.w3.org/2001/xml.xsd'.
 at 
 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
 

 at 
 org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:141) 

 at 
 org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:358) 

 at 
 
org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:1837)
 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1298) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1240) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:611) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:654) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:403) 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.processJAXPSchemaSource(XMLSchemaValidator.java:2302)
 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1632)
 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:568)
 

 at 
 
org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:832)
 

 at 
 org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBinder.java:568) 

 at 
 org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:796) 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:752)
 

 at 
 
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:927)
 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1519)
 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
 

 at 
 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
 

 at 
 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
 

 at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
 at 
 org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148) 

 at org.apache.commons.digester.Digester.parse(Digester.java:1512)
 at 
 org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:573) 

 at 
 org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:711)
 at 
 org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:247) 

 at 
 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
 

 at 
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3493)
 at 
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821) 

 at 
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at 
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at 
 
org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:617) 

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 

 at 
 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

 at java.lang.reflect.Method.invoke(Method.java:324)
 at 
 org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) 

 at 
 org.apache.commons.digester.SetNextRule.end(SetNextRule.java:260)
 at 
 org.apache.commons.digester.Digester.endElement(Digester.java:1036)
 at 
 org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:559) 

 at 
 org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:646) 

 at 

Re: [PATCH][Catalina] Use fully qualified URI for locating localschema

2002-08-10 Thread Patrick Luby

Jean-François,

I just deleted my CVS repositories, rechecked them out, and reapplied 
*both* the jakarta-servletapi-5 and jakarta-tomcat-catalina patches. I 
did a build from scratch and I still get the same exception.

Note: I am using the HEAD of commons-digester. Might there be a 
incompatibility in commons-digester?

Patrick

Jean-francois Arcand wrote:
 Patrick,
 
 you also have to apply the catalina pache where it is defined the local 
 schema location (Constants.java). I made some change to avoid having 
 Xerces resolving with the wrong URI.
 
 Thanks,
 
 Jeanfrancois.
 
 Patrick Luby wrote:
 
 Jean-François,

 When I apply this patch and your jakarta-servletapi-5 patch and build 
 with the latest commons-digester, I get the following exception. I 
 seems that with your patches, Xerces no longer looks locally for the 
 XML files.

 Accordingly, I think we should figure out what is happening before 
 these patches should be applied as these patches make it impossible 
 for anyone running behind a firewall to run Tomcat.

 Patrick

 org.xml.sax.SAXParseException: src-import.0: Failed to read imported 
 schema document 'http://www.w3.org/2001/xml.xsd'.
 at 
 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
 

 at 
 org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:141) 

 at 
 org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:358) 

 at 
 
org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:1837)
 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1298) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1240) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:611) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:654) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:403) 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.processJAXPSchemaSource(XMLSchemaValidator.java:2302)
 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1632)
 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:568)
 

 at 
 
org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:832)
 

 at 
 org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBinder.java:568) 

 at 
 org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:796) 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:752)
 

 at 
 
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:927)
 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1519)
 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
 

 at 
 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
 

 at 
 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
 

 at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
 at 
 org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148) 

 at org.apache.commons.digester.Digester.parse(Digester.java:1512)
 at 
 org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:573) 

 at 
 org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:711)
 at 
 org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:247) 

 at 
 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
 

 at 
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3493)
 at 
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821) 

 at 
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at 
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at 
 
org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:617) 

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 

 at 
 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

 at java.lang.reflect.Method.invoke(Method.java:324)
 at 
 org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) 

Re: [PATCH][Catalina] Use fully qualified URI for locating localschema

2002-08-10 Thread Patrick Luby

Jean-François,

Thanks for finding the missing patch to commons-digester. I committed 
that patch and now Tomcat 5 works with both of your patches to 
jakarta-servletapi-5 and jakarta-tomcat-catalina.

BTW, with your patches, all of the JSP test failures in watchdog are 
gone and all JSP test pass.

Patrick

Patrick Luby wrote:
 Jean-François,
 
 I just deleted my CVS repositories, rechecked them out, and reapplied 
 *both* the jakarta-servletapi-5 and jakarta-tomcat-catalina patches. I 
 did a build from scratch and I still get the same exception.
 
 Note: I am using the HEAD of commons-digester. Might there be a 
 incompatibility in commons-digester?
 
 Patrick
 
 Jean-francois Arcand wrote:
 
 Patrick,

 you also have to apply the catalina pache where it is defined the 
 local schema location (Constants.java). I made some change to avoid 
 having Xerces resolving with the wrong URI.

 Thanks,

 Jeanfrancois.

 Patrick Luby wrote:

 Jean-François,

 When I apply this patch and your jakarta-servletapi-5 patch and build 
 with the latest commons-digester, I get the following exception. I 
 seems that with your patches, Xerces no longer looks locally for the 
 XML files.

 Accordingly, I think we should figure out what is happening before 
 these patches should be applied as these patches make it impossible 
 for anyone running behind a firewall to run Tomcat.

 Patrick

 org.xml.sax.SAXParseException: src-import.0: Failed to read imported 
 schema document 'http://www.w3.org/2001/xml.xsd'.
 at 
 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
 

 at 
 org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:141) 

 at 
 org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:358) 

 at 
 
org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:1837)
 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1298) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1240) 

 at 
 
org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:611) 

 at 
 
org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:654) 

 at 
 org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:403) 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.processJAXPSchemaSource(XMLSchemaValidator.java:2302)
 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1632)
 

 at 
 
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:568)
 

 at 
 
org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:832)
 

 at 
 
org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBinder.java:568) 

 at 
 org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:796) 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:752)
 

 at 
 
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:927)
 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1519)
 

 at 
 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
 

 at 
 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
 

 at 
 
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
 

 at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
 at 
 org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148) 

 at org.apache.commons.digester.Digester.parse(Digester.java:1512)
 at 
 org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:573) 

 at 
 org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:711)
 at 
 org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:247) 

 at 
 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
 

 at 
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3493)
 at 
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821) 

 at 
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at 
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at 
 
org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:617) 

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  

[PATCH][Catalina] Improved flexiblity of pipeline WRT session cookies

2001-11-28 Thread Daniel Rall

First, this patch fixes a problem with Catalina's sendHeaders()
implementation which prevents post-service() Valve code from having a
chance to cleanly set or modify the JSESSIONID cookie used to store
Catalina's session identifier.

Second, this removes some of the remnants of a cut and paste birth of
WarpResponse from jakarta-tomcat-4.0 (note that there is another copy
of this file in the jakarta-turbine-connectors repository).

This patch is against CVS HEAD of jakarta-tomcat-4.0 from the evening
of Wed, Nov 28.

On a parallel note, neither JServ (in JServServletManager) nor
Catalina (in two HttpProcessor impls and WarpRequestHandler) use the
equalsIgnoreCase that section 4.1 of RFC 2109 to me suggests use when
rooting through the cookies parsed from the request stream (when
initially seeking the session identifier).  Even though a constant is
used internally in Catalina, I would assume that Catalina would accept
cookies formatted as per the RFC (perhaps common usage suggests
otherwise?).


Index: HttpResponseBase.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
retrieving revision 1.40
diff -u -u -r1.40 HttpResponseBase.java
--- HttpResponseBase.java   2001/11/13 19:39:27 1.40
+++ HttpResponseBase.java   2001/11/28 09:15:20
@@ -614,25 +614,7 @@
 }
 
 // Add the session ID cookie if necessary
-HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
-HttpSession session = hreq.getSession(false);
-
-if ((session != null)  session.isNew()  (getContext() != null)
- getContext().getCookies()) {
-Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
-   session.getId());
-cookie.setMaxAge(-1);
-String contextPath = null;
-if (context != null)
-contextPath = context.getPath();
-if ((contextPath != null)  (contextPath.length()  0))
-cookie.setPath(contextPath);
-else
-cookie.setPath(/);
-if (hreq.isSecure())
-cookie.setSecure(true);
-addCookie(cookie);
-}
+addAbsentSessionCookie((HttpServletRequest) request.getRequest());
 
 // Send all specified cookies (if any)
 synchronized (cookies) {
@@ -657,6 +639,63 @@
 
 // The response is now committed
 committed = true;
+
+}
+
+
+/**
+ * Adds the session ID cookie if a new session exists for
+ * codehreq/code, the Context is configured to pass the
+ * session ID via cookies (the default), and the session cookie
+ * doesn't already exist in the request (could've been inserted by
+ * a meddling Valve during Pipeline execution).
+ *
+ * @param hreq The HttpServletRequest whose session to service.
+ */
+protected void addAbsentSessionCookie(HttpServletRequest hreq) {
+
+HttpSession session = hreq.getSession(false);
+
+if ((session != null)  session.isNew()  (getContext() != null)
+ getContext().getCookies()  !containsSessionCookie()) {
+Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
+   session.getId());
+cookie.setMaxAge(-1);
+String contextPath = null;
+if (context != null)
+contextPath = context.getPath();
+if ((contextPath != null)  (contextPath.length()  0))
+cookie.setPath(contextPath);
+else
+cookie.setPath(/);
+if (hreq.isSecure())
+cookie.setSecure(true);
+addCookie(cookie);
+}
+
+}
+
+
+/**
+ * Returns whether this HttpResponse contains the session
+ * identifier cookie.  Though section 4.1 of RFC 2109 suggests
+ * that cookie name comparisons are case-insentive, a
+ * case-sensitive comparison is performed for consistancy with the
+ * rest of Catalina's implementation.
+ *
+ * @return Whether this response has a session identifier cookie
+ * set.
+ */
+protected boolean containsSessionCookie() {
+
+Cookie c;
+for (Iterator i = cookies.iterator(); i.hasNext(); ) {
+c = (Cookie) i.next();
+if (Globals.SESSION_COOKIE_NAME.equals(c.getName())) {
+return true;
+}
+}
+return false;
 
 }
 


Index: WarpResponse.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpResponse.java,v
retrieving revision 1.7
diff -u -u -r1.7 WarpResponse.java
--- WarpResponse.java   2001/08/09 20:08:58 1.7
+++ WarpResponse.java   2001/11/28 09:15:00
@@ -201,25 +201,7 @@
 }
 
 

[PATCH] [Catalina] StandardContext::addParameter() JavaDoc

2001-11-16 Thread Daniel Rall

addParameter() instance method actually throws an
IllegalArgumentException if a duplicate name is used.

I came across this while attempting to setup Catalina behind Apache +
mod_webapp -- AFAICT, my setup is currently giving me the joy of
multiple initializations of Catalina.

Index: StandardContext.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.87
diff -u -u -r1.87 StandardContext.java
--- StandardContext.java2001/11/10 00:01:54 1.87
+++ StandardContext.java2001/11/17 02:18:47
@@ -1506,8 +1506,7 @@
 
 
 /**
- * Add a new context initialization parameter, replacing any existing
- * value for the specified name.
+ * Add a new context initialization parameter.
  *
  * @param name Name of the new parameter
  * @param value Value of the new  parameter

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: [PATCH] Catalina JNDIRealm - binding as the user

2001-05-17 Thread John Holman

When using a pattern the uid value or whatever that people enter is 
substituted into the pattern to generate the dn - users are not expected to 
enter the full dn. Search is needed however when the attribute whose value 
is entered by the user is not a component of the dn, or when users are held 
in the directory under more than one node.

I agree that when a directory is used for authentication it is usually safe 
to assume that the entered value is a unique identifier for an entry. An 
exception might arise though when users are held under multiple nodes - 
e.g. people are held under organisational units, and some people are 
employed by more than one unit.

At 04:48 17/05/01, Martin Smith wrote:
My use of search then bind is searching for a non-DN user ID (like UID or
mail, which is presumably unique) then binding witht he retrieved DN and
password.  Can you imagine making people type in X.500-style user names

Martin





Torgeir Veimo wrote:

  John Holman wrote:
  
   As said before I'd like to add the ability to search the directory 
 for the
   user's dn to cover cases when a fixed pattern will not work, but will 
 wait
   to see the fate of this patch before going ahead.
 
  Regarding the search, then bind authentication; what would be the
  suggested behaviour when there are more than one returned dn from the
  search? Should one try to authenticate as each of these, or
  automatically assume not authenticated?
 
  --
  - Torgeir





Re: [PATCH] Catalina JNDIRealm - binding as the user

2001-05-16 Thread Torgeir Veimo

John Holman wrote:
 
 As said before I'd like to add the ability to search the directory for the
 user's dn to cover cases when a fixed pattern will not work, but will wait
 to see the fate of this patch before going ahead.

Regarding the search, then bind authentication; what would be the
suggested behaviour when there are more than one returned dn from the
search? Should one try to authenticate as each of these, or
automatically assume not authenticated?

-- 
- Torgeir



Re: [PATCH] Catalina JNDIRealm - binding as the user

2001-05-16 Thread John Holman

I was planning to fail authentication if more than one entry is found.

At 09:58 16/05/01, you wrote:
John Holman wrote:
 
  As said before I'd like to add the ability to search the directory for the
  user's dn to cover cases when a fixed pattern will not work, but will wait
  to see the fate of this patch before going ahead.

Regarding the search, then bind authentication; what would be the
suggested behaviour when there are more than one returned dn from the
search? Should one try to authenticate as each of these, or
automatically assume not authenticated?

--
- Torgeir





Re: [PATCH] Catalina JNDIRealm - binding as the user

2001-05-16 Thread Martin Smith

My use of search then bind is searching for a non-DN user ID (like UID or
mail, which is presumably unique) then binding witht he retrieved DN and
password.  Can you imagine making people type in X.500-style user names

Martin



Torgeir Veimo wrote:

 John Holman wrote:
 
  As said before I'd like to add the ability to search the directory for the
  user's dn to cover cases when a fixed pattern will not work, but will wait
  to see the fate of this patch before going ahead.

 Regarding the search, then bind authentication; what would be the
 suggested behaviour when there are more than one returned dn from the
 search? Should one try to authenticate as each of these, or
 automatically assume not authenticated?

 --
 - Torgeir




[PATCH] Catalina JNDIRealm - binding as the user

2001-05-15 Thread John Holman

Here is a patch for the JNDI  realm in Catalina that supports authentication
by binding to the directory with the credentials specified by the user.

I've added a configuration parameter bindAsUser which defaults to true.
If set to false the realm authenticates as before: ie it retrieves the
password from the directory and compares it explicitly with the presented
credentials.

For the moment I've kept JNDIRealm as a single implementation class, but it
would be trivial to split it into different classes for the two modes of
authentication, if that is thought better. I've not updated the initial
javadoc comment because this will depend on whether the class is split or
not.

Note that digest authentication is not supported in the default bind mode.
Torgeir has suggested that this might be possible - if so that would be
good.

As said before I'd like to add the ability to search the directory for the
user's dn to cover cases when a fixed pattern will not work, but will wait
to see the fate of this patch before going ahead.

Cheers, John



Index: JNDIRealm.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java,v
retrieving revision 1.1
diff -c -r1.1 JNDIRealm.java
*** JNDIRealm.java  2001/04/13 21:18:42 1.1
--- JNDIRealm.java  2001/05/15 21:17:46
***
*** 68,73 
--- 68,74 
  import javax.naming.NameNotFoundException;
  import javax.naming.NamingEnumeration;
  import javax.naming.NamingException;
+ import javax.naming.AuthenticationException;
  import javax.naming.directory.Attribute;
  import javax.naming.directory.Attributes;
  import javax.naming.directory.DirContext;
***
*** 238,243 
--- 239,250 
  
  
  /**
+  * Should we authenticate by binding to the directory as the user?
+  */
+ protected boolean bindAsUser = true;
+ 
+ 
+ /**
   * The attribute name used to retrieve the user password.
   */
  protected String userPassword[] = null;
***
*** 253,258 
--- 260,266 
  // - Properties
  
  
+ 
  /**
   * Return the connection username for this Realm.
   */
***
*** 342,347 
--- 350,377 
  
  
  /**
+  * Return the bind as user flag.
+  */
+ public boolean getBindAsUser() {
+ 
+ return (this.bindAsUser);
+ 
+ }
+ 
+ 
+ /**
+  * Set the bind as user flag.
+  *
+  * @param bindAsUser The new search flag
+  */
+ public void setBindAsUser(boolean bindAsUser) {
+ 
+ this.bindAsUser = bindAsUser;
+ 
+ }
+ 
+ 
+ /**
   * Return the base element for role searches.
   */
  public String getRoleBase() {
***
*** 581,586 
--- 611,766 
  
  
  /**
+  * Return the distinguished name of an authenticated user (if successful)
+  * or codenull/code if authentication is unsuccessful.
+  *
+  * @param context The directory context we are accessing
+  * @param username Username to be authenticated
+  * @param credentials Authentication credentials
+  *
+  * @exception NamingException if a directory server error occurs
+  */
+ protected String getUserDN(DirContext context,
+String username, String credentials)
+ throws NamingException {
+ 
+ if (debug = 2)
+ log(getUserDN( + username + ));
+ 
+ if (username == null)
+ return (null);
+ 
+ if ((userFormat == null) || (userPassword == null))
+ return (null);
+ 
+ // substitute username into the pattern to get the dn
+ String dn = userFormat.format(new String[] { username });
+ if (debug = 3)
+ log(  dn= + dn);
+ 
+   boolean isAuthenticated = false;
+ if (bindAsUser)
+   isAuthenticated = bindAsUser(context, dn, credentials);
+   else
+   isAuthenticated = compareCredentials(context, dn, credentials);
+ 
+ if (isAuthenticated) {
+ if (debug = 2)
+ log(sm.getString(jndiRealm.authenticateSuccess,
+  username));
+ } else {
+ if (debug = 2)
+ log(sm.getString(jndiRealm.authenticateFailure,
+  username));
+ return (null);
+ }
+ 
+   return (dn);
+ }
+ 
+ 
+ /**
+  * Can we bind to the directory as the user?
+  *
+  * @param context The directory context we are accessing
+  * @param dn DN to bind as
+  * @param credentials Authentication credentials
+  *
+  * @exception NamingException if a directory server error occurs
+  */
+ protected boolean bindAsUser(DirContext context,
+String dn, String credentials)
+ throws