You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/02/14 05:59:45 UTC

cvs commit: jakarta-tomcat/src/tests/webpages/WEB-INF web.xml

costin      00/02/13 20:59:44

  Modified:    src/etc  server.xml
               src/j2ee/org/apache/tomcat/context WarWebXmlInterceptor.java
               src/j2ee/org/apache/tomcat/util XMLParser.java
               src/share/org/apache/tomcat/context AutoSetup.java
                        LoadOnStartupInterceptor.java LogEvents.java
                        WebXmlReader.java
               src/share/org/apache/tomcat/core BaseInterceptor.java
                        BufferedServletInputStream.java Constants.java
                        ContextInterceptor.java ContextManager.java
                        RequestSecurityProvider.java ResponseImpl.java
                        ServletWrapper.java
               src/share/org/apache/tomcat/servlets DefaultServlet.java
                        InvokerServlet.java WarFileServlet.java
               src/share/org/apache/tomcat/session ApplicationSession.java
                        ServerSession.java ServerSessionManager.java
                        StandardManager.java StandardSession.java
               src/share/org/apache/tomcat/util Ascii.java BuffTool.java
                        HexUtils.java HttpDate.java MessageBytes.java
                        MimeHeaderField.java MimeHeaders.java
                        RequestUtil.java SessionUtil.java
               src/share/org/apache/tomcat/util/xml XmlMapper.java
               src/tests/webpages/WEB-INF web.xml
  Removed:     src/share/org/apache/tomcat/session Constants.java
               src/share/org/apache/tomcat/util Constants.java
  Log:
  - Added <security-constraint>.
  
  - Removed some of the Constant subclasses, use CAPITAL style for constants,
  use the real thing when it's clear ( for example "web.xml" instead of
  Constants.WEBXML ).
  
  Revision  Changes    Path
  1.7       +1 -0      jakarta-tomcat/src/etc/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/etc/server.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- server.xml	2000/02/13 20:49:37	1.6
  +++ server.xml	2000/02/14 04:59:37	1.7
  @@ -40,6 +40,7 @@
           <!-- Request processing -->
           <RequestInterceptor className="org.apache.tomcat.request.SimpleMapper" />
           <RequestInterceptor className="org.apache.tomcat.request.SessionInterceptor" />
  +        <RequestInterceptor className="org.apache.tomcat.request.FixHeaders" />
   
           <Connector className="org.apache.tomcat.service.http.HttpAdapter">
               <Parameter name="port" value="8080"/>
  
  
  
  1.3       +1 -1      jakarta-tomcat/src/j2ee/org/apache/tomcat/context/WarWebXmlInterceptor.java
  
  Index: WarWebXmlInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/context/WarWebXmlInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarWebXmlInterceptor.java	2000/02/12 03:38:48	1.2
  +++ WarWebXmlInterceptor.java	2000/02/14 04:59:37	1.3
  @@ -101,7 +101,7 @@
   		s = s.substring(0, s.length() - 1);
   	    
   	    URL webURL = null;
  -	    webURL = new URL(s + "!/" + Constants.Context.ConfigFile);
  +	    webURL = new URL(s + "!/WEB-INF/web.xml"  );
   	    
   	    InputStream is = webURL.openConnection().getInputStream();
   	    
  
  
  
  1.2       +12 -10    jakarta-tomcat/src/j2ee/org/apache/tomcat/util/XMLParser.java
  
  Index: XMLParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/util/XMLParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLParser.java	2000/02/11 00:22:39	1.1
  +++ XMLParser.java	2000/02/14 04:59:37	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/util/XMLParser.java,v 1.1 2000/02/11 00:22:39 costin Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/02/11 00:22:39 $
  + * $Header: /home/cvs/jakarta-tomcat/src/j2ee/org/apache/tomcat/util/XMLParser.java,v 1.2 2000/02/14 04:59:37 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/02/14 04:59:37 $
    *
    * ====================================================================
    *
  @@ -65,6 +65,7 @@
   package org.apache.tomcat.util;
   
   import org.apache.tomcat.util.StringManager;
  +import org.apache.tomcat.core.Constants;
   import com.sun.xml.tree.XmlDocument;
   import com.sun.xml.tree.ElementNode;
   import com.sun.xml.tree.XmlDocumentBuilder;
  @@ -97,7 +98,7 @@
   public class XMLParser {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.util");
       private XmlDocument doc = null;
       private static final boolean DefaultCheckType = false;
       private static final String DefaultContentType =
  @@ -177,15 +178,16 @@
   	    new ValidatingParser(true) : new Parser();
   	Resolver resolver = new Resolver();
   	XmlDocumentBuilder builder = new XmlDocumentBuilder();
  -	URL serverURL = this.getClass().getResource(
  -            Constants.DTD.Server.Resource);
  +	// Server.xml is not validated and has no DTD ( and will change for a while)
  +	// 	URL serverURL = this.getClass().getResource(
  +	//             Constants.DTD.Server.Resource);
   	URL webApplicationURL = this.getClass().getResource(
  -            Constants.DTD.WebApplication.Resource);
  +            Constants.WEB_XML_Resource);
   
  -	resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
  -            serverURL.toString());
  +// 	resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
  +//             serverURL.toString());
   	resolver.registerCatalogEntry(
  -	    Constants.DTD.WebApplication.PublicId,
  +	    Constants.WEB_XML_PublicId,
   	    webApplicationURL.toString());
   
   	try {
  
  
  
  1.6       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/context/AutoSetup.java
  
  Index: AutoSetup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/AutoSetup.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AutoSetup.java	2000/02/12 03:38:49	1.5
  +++ AutoSetup.java	2000/02/14 04:59:37	1.6
  @@ -131,11 +131,11 @@
   	    
   	    if( cm.getContext(path) == null ) {
   		// if no explicit set up
  -		System.out.println("Automatic addContext( " + path + ", webapps/" + name + ")");
   		Context ctx=new Context();
   		ctx.setContextManager( cm );
   		ctx.setPath(path);
   		ctx.setDocBase(  "webapps/" + name);
  +		ctx.log("Automatic addContext webapps/" + name + ")");
   		cm.addContext(ctx);
   	    } else {
   		//System.out.println("Already set up: " + path + " " + cm.getContext(path));
  
  
  
  1.8       +1 -2      jakarta-tomcat/src/share/org/apache/tomcat/context/LoadOnStartupInterceptor.java
  
  Index: LoadOnStartupInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/LoadOnStartupInterceptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LoadOnStartupInterceptor.java	2000/02/13 20:49:39	1.7
  +++ LoadOnStartupInterceptor.java	2000/02/14 04:59:38	1.8
  @@ -171,8 +171,7 @@
   	String requestURI = path + "?jsp_precompile=true";
   	
   	request.setRequestURI(context.getPath() + path);
  -	request.setQueryString( Constants.JSP.Directive.Compile.Name + "=" +
  -			     Constants.JSP.Directive.Compile.Value );
  +	request.setQueryString( "jsp_precompile=true" );
   	
   	request.setContext(context);
   	request.getSession(true);
  
  
  
  1.2       +30 -0     jakarta-tomcat/src/share/org/apache/tomcat/context/LogEvents.java
  
  Index: LogEvents.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/LogEvents.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogEvents.java	2000/02/13 20:49:39	1.1
  +++ LogEvents.java	2000/02/14 04:59:38	1.2
  @@ -144,6 +144,36 @@
   	ctx.log( "Remove mapping ");
       }
   
  +    /** 
  +     */
  +    public void addSecurityConstraint( Context ctx, String path[], String methods[],
  +				       String transport, String roles[] )
  +	throws TomcatException
  +    {
  +	StringBuffer sb=new StringBuffer();
  +	sb.append("Add security constraint ");
  +	if( methods!=null ) {
  +	    sb.append("Methods: ");
  +	    for( int i=0; i< methods.length; i++ ) {
  +		sb.append(" " + methods[i]);
  +	    }
  +	}
  +	if( path!=null) {
  +	    sb.append(" Paths: ");
  +	    for( int i=0; i< path.length; i++ ) {
  +		sb.append(" " + path[i]);
  +	    }
  +	}
  +	if( roles!=null) {
  +	    sb.append(" Roles: ");
  +	    for( int i=0; i< roles.length; i++ ) {
  +		sb.append(" " + roles[i]);
  +	    }
  +	}
  +	sb.append(" Transport " + transport );
  +	ctx.log(sb.toString());
  +    }
  +
       /** Called when the ContextManger is started
        */
       public void engineInit(ContextManager cm) throws TomcatException {
  
  
  
  1.8       +175 -15   jakarta-tomcat/src/share/org/apache/tomcat/context/WebXmlReader.java
  
  Index: WebXmlReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/WebXmlReader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebXmlReader.java	2000/02/13 01:16:17	1.7
  +++ WebXmlReader.java	2000/02/14 04:59:38	1.8
  @@ -81,10 +81,6 @@
   
   	    xh.addRule("web-app/welcome-file-list/welcome-file", xh.methodSetter("addWelcomeFile", 0) );
   
  -	    //	    xh.addRule("web-app/taglib", xh.methodSetter("addTagLib", 2) );
  -	    //	    xh.addRule("web-app/taglib/taglib-uri", xh.methodParam(0) );
  -	    //	    xh.addRule("web-app/taglib/taglib-location", xh.methodParam(1) ); 
  -
   	    xh.addRule("web-app/error-page", xh.methodSetter("addErrorPage",2) );
   	    xh.addRule("web-app/error-page/error-code", xh.methodParam(0) );
   	    xh.addRule("web-app/error-page/exception-type", xh.methodParam(0) );
  @@ -109,25 +105,189 @@
   	    xh.addRule("web-app/servlet/init-param/param-name", xh.methodParam(0) );
   	    xh.addRule("web-app/servlet/init-param/param-value", xh.methodParam(1) );
   
  -	    xh.addRule("web-app/servlet/icon/small-icon", xh.methodSetter("setIcon",0) ); // icon, body
  +	    xh.addRule("web-app/servlet/icon/small-icon", xh.methodSetter("setIcon",0 )); // icon, body
   	    xh.addRule("web-app/servlet/description", xh.methodSetter("setDescription", 0) ); // description, body
   	    xh.addRule("web-app/servlet/load-on-startup", xh.methodSetter("setLoadOnStartUp", 0 ));
  -	    //	    xh.addRule("web-app/servlet/security-role-ref", new SetProperty() ); // xxx, body
  -	    
  -	    // 	    xh.addRule("",
  -	    // 		       new XmlAction() {
  -	    // 			       public void end( SaxContext ctx) {
  -	    // 				   for( int i=0; i<ctx.getTagCount(); i++) System.out.print( ctx.getTag(i)+"/");
  -	    // 				   System.out.println();
  -	    // 			       }
  -	    // 			   });
  -	    
  +
  +
  +	    addSecurity( xh );
  +
   	    Object ctx1=xh.readXml(f, ctx);
   	} catch(Exception ex ) {
   	    ex.printStackTrace();
   	}
       }
   
  +    // Add security rules - complex code
  +    void addSecurity( XmlMapper xh ) {
  +	xh.addRule("web-app/security-constraint",
  +		   new SCAction() );
  +	
  +	xh.addRule("web-app/security-constraint/user-data-constraint/transport-guarantee",
  +		   new XmlAction() {
  +			   public void end( SaxContext ctx) throws Exception {
  +			       Stack st=ctx.getObjectStack();
  +			       SecurityConstraint rc=(SecurityConstraint)st.peek();
  +			       String  body=ctx.getBody().trim();
  +			       rc.setTransport( body );
  +			   }
  +		       }
  +		   );
  +	xh.addRule("web-app/security-constraint/auth-constraint/role-name",
  +		   new XmlAction() {
  +			   public void end( SaxContext ctx) throws Exception {
  +			       Stack st=ctx.getObjectStack();
  +			       SecurityConstraint rc=(SecurityConstraint)st.peek();
  +			       String  body=ctx.getBody().trim();
  +			       rc.addRole( body );
  +			   }
  +		       }
  +		   );
  +	
  +	xh.addRule("web-app/security-constraint/web-resource-collection",
  +		   new XmlAction() {
  +			   public void start( SaxContext ctx) throws Exception {
  +			       Stack st=ctx.getObjectStack();
  +			       st.push(new ResourceCollection());
  +			   }
  +			   public void end( SaxContext ctx) throws Exception {
  +			       Stack st=ctx.getObjectStack();
  +			       ResourceCollection rc=(ResourceCollection)st.pop();
  +			       SecurityConstraint sc=(SecurityConstraint)st.peek();
  +			       st.push( rc );
  +			       sc.addResourceCollection( rc );
  +			   }
  +			   public void cleanup( SaxContext ctx) {
  +			       Stack st=ctx.getObjectStack();
  +			       Object o=st.pop();
  +			   }
  +		       }
  +		   );
  +
  +	xh.addRule("web-app/security-constraint/web-resource-collection/url-pattern",
  +		   new XmlAction() {
  +			   public void end( SaxContext ctx) throws Exception {
  +			       Stack st=ctx.getObjectStack();
  +			       ResourceCollection rc=(ResourceCollection)st.peek();
  +			       String  body=ctx.getBody().trim();
  +			       rc.addUrlPattern( body );
  +			   }
  +		       }
  +		   );
  +	xh.addRule("web-app/security-constraint/web-resource-collection/http-method",
  +		   new XmlAction() {
  +			   public void end( SaxContext ctx) throws Exception {
  +			       Stack st=ctx.getObjectStack();
  +			       ResourceCollection rc=(ResourceCollection)st.peek();
  +			       String  body=ctx.getBody().trim();
  +			       rc.addHttpMethod( body );
  +			   }
  +		       }
  +		   );
  +    }
       
   }
   
  +/** Specific action for Security-constraint
  + */
  +class SCAction extends XmlAction {
  +    public void start( SaxContext ctx) throws Exception {
  +	Stack st=ctx.getObjectStack();
  +	st.push(new SecurityConstraint());
  +    }
  +    public void end( SaxContext ctx) throws Exception {
  +	Stack st=ctx.getObjectStack();
  +	String tag=ctx.getTag(ctx.getTagCount()-1);
  +	SecurityConstraint sc=(SecurityConstraint)st.pop();
  +	Context context=(Context)st.peek();
  +	ContextManager cm=context.getContextManager();
  +	
  +	st.push( sc ); // restore stack
  +	// add all patterns that will need security
  +	
  +	String roles[]=sc.getRoles();
  +	String transport=sc.getTransport();
  +	Enumeration en=sc.getResourceCollections();
  +	while( en.hasMoreElements()) {
  +	    ResourceCollection rc=(ResourceCollection)en.nextElement();
  +	    String paths[]=rc.getPatterns();
  +	    String meths[]=rc.getMethods();
  +	    cm.addSecurityConstraint( context, paths, meths ,
  +				      transport, roles);
  +	}
  +    }
  +    public void cleanup( SaxContext ctx) {
  +	Stack st=ctx.getObjectStack();
  +	Object o=st.pop();
  +    }
  +}
  +
  +class SecurityConstraint {
  +    Vector roles=new Vector();
  +    String transport;
  +    Vector resourceC=new Vector();
  +    
  +    public SecurityConstraint() {
  +    }
  +
  +    public void setTransport( String transport ) {
  +	this.transport=transport;
  +    }
  +
  +    public String getTransport() {
  +	return this.transport;
  +    }
  +
  +    public void addRole(String role ) {
  +	roles.addElement( role );
  +    }
  +
  +    public void addResourceCollection( ResourceCollection rc ) {
  +	resourceC.addElement( rc );
  +    }
  +
  +    public String []getRoles() {
  +	String rolesA[]=new String[roles.size()];
  +	for( int i=0; i< rolesA.length; i++ ) {
  +	    rolesA[i]=(String)roles.elementAt( i );
  +	}
  +	return rolesA;
  +    }
  +    public Enumeration getResourceCollections() {
  +	return resourceC.elements();
  +    }
  +}
  +
  +class ResourceCollection {
  +    Vector urlP=new Vector();
  +    Vector methods=new Vector();
  +    
  +    public ResourceCollection() {
  +    }
  +
  +    public void addUrlPattern( String pattern ) {
  +	urlP.addElement( pattern );
  +    }
  +
  +    public void addHttpMethod( String method ) {
  +	methods.addElement( method );
  +    }
  +
  +    public String []getMethods() {
  +	String methodsA[]=new String[methods.size()];
  +	for( int i=0; i< methodsA.length; i++ ) {
  +	    methodsA[i]=(String)methods.elementAt( i );
  +	}
  +	return methodsA;
  +    }
  +
  +    public String []getPatterns() {
  +	String patternsA[]=new String[urlP.size()];
  +	for( int i=0; i< patternsA.length; i++ ) {
  +	    patternsA[i]=(String)urlP.elementAt( i );
  +	}
  +	return patternsA;
  +    }
  +
  +
  +}
  
  
  
  1.3       +8 -0      jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java
  
  Index: BaseInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseInterceptor.java	2000/02/13 20:49:40	1.2
  +++ BaseInterceptor.java	2000/02/14 04:59:38	1.3
  @@ -138,6 +138,14 @@
       public void removeMapping( Context ctx, String path ) throws TomcatException {
       }
   
  +    /** 
  +     */
  +    public void addSecurityConstraint( Context ctx, String path[], String methods[],
  +				       String transport, String roles[] )
  +	throws TomcatException
  +    {
  +    }
  +
       /** Called when the ContextManger is started
        */
       public void engineInit(ContextManager cm) throws TomcatException {
  
  
  
  1.6       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletInputStream.java
  
  Index: BufferedServletInputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletInputStream.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BufferedServletInputStream.java	2000/02/03 07:11:51	1.5
  +++ BufferedServletInputStream.java	2000/02/14 04:59:38	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletInputStream.java,v 1.5 2000/02/03 07:11:51 costin Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/02/03 07:11:51 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletInputStream.java,v 1.6 2000/02/14 04:59:38 costin Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/02/14 04:59:38 $
    *
    * ====================================================================
    * 
  @@ -166,7 +166,7 @@
   	byte[] buf = new byte[1024];
   	int count = readLine(buf, 0, buf.length);
   	if (count >= 0) {
  -	    return new String(buf, 0, count, Constants.CharacterEncoding.Default);
  +	    return new String(buf, 0, count, Constants.DEFAULT_CHAR_ENCODING);
   	} else {
   	    return ""; 
   	}
  
  
  
  1.15      +45 -61    jakarta-tomcat/src/share/org/apache/tomcat/core/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Constants.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Constants.java	2000/01/17 12:25:33	1.14
  +++ Constants.java	2000/02/14 04:59:39	1.15
  @@ -91,70 +91,54 @@
   
       public static final String LOCALE_DEFAULT="en";
       
  -    public static class Context {
  -        public static final String WebInfDir = "WEB-INF";
  -        public static final String WARInfDir = "META-INF";
  -        public static final String ConfigFile = WebInfDir + "/web.xml";
  -        public static final String WARExpandDir = "docBase";
  -
  -        public static final String[] MASKED_DIR = {
  -            WebInfDir,
  -            WARInfDir
  -        };
  -    }
  -
  -    public static class Property {
  -        public static final String Name = "core.properties";
  -        public static final String EngineHeader = "engine.header";
  -        public static final String MimeType = "mimeType";
  -    }
  -
  -    public static class Cookie {
  -        public static final String SESSION_COOKIE_NAME = "JSESSIONID";
  -    }
  +//         public static final String ConfigFile = WebInfDir + "WEB-INF/web.xml";
  +//         public static final String WARExpandDir = "docBase";
   
  +
  +//     public static class Property {
  +//         public static final String Name = "core.properties";
  +//         public static final String EngineHeader = "engine.header";
  +//         public static final String MimeType = "mimeType";
  +//     }
  +
  +
       //	        "org.apache.tomcat.core.DefaultServlet";
   
  -    public static class JSP {
  -        public static final String NAME = "jsp";
  -	public static final String CLASSNAME = "org.apache.jasper.runtime.JspServlet";
  +    // 	public static final String JSP_CLASSNAME = "org.apache.jasper.runtime.JspServlet";
        
  -        public static class Directive {
  -            public static class Compile {
  -                public static final String Name = "jsp_precompile";
  -                public static final String Value = "true";
  -            }
  -        }
  -    }
  -
  -
  -    public static class Attribute {
  -        public static final String RequestURI =
  -            "javax.servlet.include.request_uri";
  -        public static final String ServletPath =
  -            "javax.servlet.include.servlet_path";
  -        public static final String PathInfo =
  -            "javax.servlet.include.path_info";
  -        public static final String QueryString =
  -            "javax.servlet.include.query_string";
  -        public static final String Dispatch =
  -            "javax.servlet.dispatch.request_uri";
  -        public static final String ERROR_EXCEPTION_TYPE =
  -            "javax.servlet.error.exception_type";
  -        public static final String ERROR_MESSAGE =
  -            "javax.servlet.error.message";
  -        public static final String RESOLVED_SERVLET =
  -            "org.apache.tomcat.servlet.resolved";
  -    }
  -
  -    public static class ContentType {
  -        public static final String Default = "text/plain";
  -        public static final String HTML = "text/html";
  -        public static final String Plain = Default;
  -    }
  -
  -    public static class CharacterEncoding {
  -        public static final String Default = "8859_1";
  -    }
  +
  +
  +    public static final String ATTRIBUTE_RequestURI =
  +	"javax.servlet.include.request_uri";
  +    public static final String ATTRIBUTE_ServletPath =
  +	"javax.servlet.include.servlet_path";
  +    public static final String ATTRIBUTE_PathInfo =
  +	"javax.servlet.include.path_info";
  +    public static final String ATTRIBUTE_QueryString =
  +	"javax.servlet.include.query_string";
  +    public static final String ATTRIBUTE_Dispatch =
  +	"javax.servlet.dispatch.request_uri";
  +    public static final String ATTRIBUTE_ERROR_EXCEPTION_TYPE =
  +	"javax.servlet.error.exception_type";
  +    public static final String ATTRIBUTE_ERROR_MESSAGE =
  +	"javax.servlet.error.message";
  +    public static final String ATTRIBUTE_RESOLVED_SERVLET =
  +	"org.apache.tomcat.servlet.resolved";
  +    
  +    public static final String WEB_XML_PublicId =
  +	"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN";
  +    public static final String WEB_XML_Resource =
  +	"/org/apache/tomcat/deployment/web.dtd";
  +
  +    public static final String HTML = "text/html";
  +
  +    public static final String DEFAULT_CONTENT_TYPE = "text/plain";
  +    public static final String DEFAULT_CHAR_ENCODING = "8859_1";
  +
  +
  +    // deprecated
  +    public static final String[] MASKED_DIR = {
  +	"META-INF","WEB-INF"
  +    };
   
   }
  
  
  
  1.7       +19 -3     jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java
  
  Index: ContextInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ContextInterceptor.java	2000/02/12 03:38:50	1.6
  +++ ContextInterceptor.java	2000/02/14 04:59:39	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java,v 1.6 2000/02/12 03:38:50 costin Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/02/12 03:38:50 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextInterceptor.java,v 1.7 2000/02/14 04:59:39 costin Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/02/14 04:59:39 $
    *
    * ====================================================================
    *
  @@ -115,6 +115,22 @@
       /** Notify when a mapping is deleted  from  a context
        */
       public void removeMapping( Context ctx, String path ) throws TomcatException;
  +
  +    
  +    /** Add a security restriction.
  +     *
  +     *  We treat the security-constraint as in Apache and most web servers,
  +     *  and reverse from web.xml - instead of defining a set of roles and the
  +     *  patterns that will be constrainted, we associate some constraints with
  +     *  url patterns. ( i.e. path->constraint instead of constraint -> path-set )
  +     *
  +     *  XXX We should unify method + path
  +     *  here and path in addMapping into UrlMatch and transport, roles and wrapper
  +     *  under UrlAction ( or something like that ).
  +     */
  +    public void addSecurityConstraint( Context ctx, String path[], String methods[],
  +				       String transport, String roles[] ) throws TomcatException;
  +
   
       /** Servlet Init  notification
        */
  
  
  
  1.40      +10 -0     jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- ContextManager.java	2000/02/13 20:49:40	1.39
  +++ ContextManager.java	2000/02/14 04:59:39	1.40
  @@ -347,6 +347,16 @@
   	}
       }
   
  +    public void addSecurityConstraint( Context ctx, String path[], String methods[],
  +				       String transport, String roles[] )
  +	throws TomcatException
  +    {
  +	ContextInterceptor cI[]=getContextInterceptors();
  +	for( int i=0; i< cI.length; i++ ) {
  +	    cI[i].addSecurityConstraint( ctx, path, methods, transport, roles );
  +	}
  +    }
  +
   
       // -------------------- Connectors and Interceptors --------------------
   
  
  
  
  1.3       +5 -3      jakarta-tomcat/src/share/org/apache/tomcat/core/RequestSecurityProvider.java
  
  Index: RequestSecurityProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestSecurityProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RequestSecurityProvider.java	1999/10/15 03:20:26	1.2
  +++ RequestSecurityProvider.java	2000/02/14 04:59:39	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestSecurityProvider.java,v 1.2 1999/10/15 03:20:26 harishp Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/15 03:20:26 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestSecurityProvider.java,v 1.3 2000/02/14 04:59:39 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/14 04:59:39 $
    *
    * ====================================================================
    *
  @@ -65,6 +65,8 @@
   package org.apache.tomcat.core;
   
   import javax.servlet.http.HttpServletRequest;
  +
  +// Not part of tomcat, will be moved to j2ee soon !
   
   /**
    * 
  
  
  
  1.14      +10 -10    jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java
  
  Index: ResponseImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ResponseImpl.java	2000/02/03 07:11:52	1.13
  +++ ResponseImpl.java	2000/02/14 04:59:39	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v 1.13 2000/02/03 07:11:52 costin Exp $
  - * $Revision: 1.13 $
  - * $Date: 2000/02/03 07:11:52 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v 1.14 2000/02/14 04:59:39 costin Exp $
  + * $Revision: 1.14 $
  + * $Date: 2000/02/14 04:59:39 $
    *
    * ====================================================================
    *
  @@ -85,9 +85,9 @@
       protected Request request;
       protected HttpServletResponseFacade responseFacade;
       protected Vector userCookies = new Vector();
  -    protected String contentType = Constants.ContentType.Default;
  +    protected String contentType = Constants.DEFAULT_CONTENT_TYPE;
       protected String contentLanguage = null;
  -    protected String characterEncoding = Constants.CharacterEncoding.Default;
  +    protected String characterEncoding = Constants.DEFAULT_CHAR_ENCODING;
       protected String sessionId;
       protected int contentLength = -1;
       protected int status = 200;
  @@ -130,9 +130,9 @@
   
       public void recycle() {
   	userCookies.removeAllElements();
  -	contentType = Constants.ContentType.Default;
  +	contentType = Constants.DEFAULT_CONTENT_TYPE;
           locale = new Locale(Constants.LOCALE_DEFAULT, "");
  -	characterEncoding = Constants.CharacterEncoding.Default;
  +	characterEncoding = Constants.DEFAULT_CHAR_ENCODING;
   	contentLength = -1;
   	status = 200;
   	headers.clear();
  @@ -250,9 +250,9 @@
           // stream before resetting the output stream
           //
   	userCookies.removeAllElements();  // keep system (session) cookies
  -	contentType = Constants.ContentType.Default;
  +	contentType = Constants.DEFAULT_CONTENT_TYPE;
           locale = new Locale(Constants.LOCALE_DEFAULT, "");
  -	characterEncoding = Constants.CharacterEncoding.Default;
  +	characterEncoding = Constants.DEFAULT_CHAR_ENCODING;
   	contentLength = -1;
   	status = 200;
   
  @@ -410,7 +410,7 @@
       public void doWrite( byte buffer[], int pos, int count) throws IOException {
           // XXX fix if charset is other than default.
           body.append(new String(buffer, pos, count, 
  -                    Constants.CharacterEncoding.Default) );
  +                    Constants.DEFAULT_CHAR_ENCODING) );
       }
   
       public StringBuffer getBody() {
  
  
  
  1.25      +6 -6      jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java
  
  Index: ServletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ServletWrapper.java	2000/02/13 20:49:40	1.24
  +++ ServletWrapper.java	2000/02/14 04:59:39	1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v 1.24 2000/02/13 20:49:40 costin Exp $
  - * $Revision: 1.24 $
  - * $Date: 2000/02/13 20:49:40 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v 1.25 2000/02/14 04:59:39 costin Exp $
  + * $Revision: 1.25 $
  + * $Date: 2000/02/14 04:59:39 $
    *
    * ====================================================================
    *
  @@ -385,16 +385,16 @@
   
           if (path != null &&
   	    request.getAttribute(
  -                Constants.Attribute.ERROR_EXCEPTION_TYPE) == null) {
  +                Constants.ATTRIBUTE_ERROR_EXCEPTION_TYPE) == null) {
               RequestDispatcher rd = contextFacade.getRequestDispatcher(path);
   
               // XXX 
               // The spec should really be changed to allow us to include
               // the full exception object.  Oh well.
   
  -            request.setAttribute(Constants.Attribute.ERROR_EXCEPTION_TYPE,
  +            request.setAttribute(Constants.ATTRIBUTE_ERROR_EXCEPTION_TYPE,
   	        t.getClass().getName());
  -            request.setAttribute(Constants.Attribute.ERROR_MESSAGE,
  +            request.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,
                   t.getMessage());
   
               try {
  
  
  
  1.6       +7 -7      jakarta-tomcat/src/share/org/apache/tomcat/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultServlet.java	2000/02/01 07:37:40	1.5
  +++ DefaultServlet.java	2000/02/14 04:59:40	1.6
  @@ -172,7 +172,7 @@
   		} else {
   		    boolean inInclude = false;
   		    Object o = request.getAttribute(
  -                        Constants.Attribute.Dispatch);
  +                        Constants.ATTRIBUTE_Dispatch);
   
   		    if (o != null) {
   		        inInclude = true;
  @@ -290,7 +290,7 @@
   	    // Figure out what we're serving
   
   	    String requestURI = (String)request.getAttribute(
  -		Constants.Attribute.RequestURI);
  +		Constants.ATTRIBUTE_RequestURI);
   
      	    if (requestURI == null) {
   	    	requestURI = request.getRequestURI();
  @@ -350,8 +350,8 @@
       }
       
       private boolean isFileMasked(String docBase, String requestedFile) {
  -        for (int i = 0; i < Constants.Context.MASKED_DIR.length; i++) {
  -            String maskFile = Constants.Context.MASKED_DIR[i];
  +        for (int i = 0; i < Constants.MASKED_DIR.length; i++) {
  +            String maskFile = Constants.MASKED_DIR[i];
   
               // case insensitive check
               if (requestedFile.toLowerCase().startsWith(
  @@ -371,8 +371,8 @@
           // contained another context, since the subcontext would have its
           // hidden dirs displayed.  So for now all masked dirs are masked.
           //
  -        for (int i = 0; i < Constants.Context.MASKED_DIR.length; i++) {
  -            if (subdir.equalsIgnoreCase(Constants.Context.MASKED_DIR[i])) {
  +        for (int i = 0; i < Constants.MASKED_DIR.length; i++) {
  +            if (subdir.equalsIgnoreCase(Constants.MASKED_DIR[i])) {
                   return true;
               }
           }
  @@ -477,7 +477,7 @@
   	// see if we are in an include
   
   	boolean inInclude = false;
  -        Object o = request.getAttribute(Constants.Attribute.Dispatch);
  +        Object o = request.getAttribute(Constants.ATTRIBUTE_Dispatch);
   
   	if (o != null) {
   	    inInclude = true;
  
  
  
  1.6       +12 -12    jakarta-tomcat/src/share/org/apache/tomcat/servlets/InvokerServlet.java
  
  Index: InvokerServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/servlets/InvokerServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InvokerServlet.java	2000/02/13 01:16:18	1.5
  +++ InvokerServlet.java	2000/02/14 04:59:40	1.6
  @@ -92,14 +92,14 @@
       {
           String requestPath = request.getRequestURI();
   	String pathInfo = (String)request.getAttribute(
  -            Constants.Attribute.PathInfo);
  +            Constants.ATTRIBUTE_PathInfo);
   
   	if (pathInfo == null) {
   	    pathInfo = request.getPathInfo();
   	}
   
   	String includedRequestURI = (String)request.getAttribute(
  -	    Constants.Attribute.RequestURI);
  +	    Constants.ATTRIBUTE_RequestURI);
   	boolean inInclude = false;
   
   	// XXX XXX XXX in the new model we are _never_ inInclude
  @@ -132,7 +132,7 @@
   		    "/" + servletName;
   	    } else {
   		newServletPath = (String)request.getAttribute
  -		    (Constants.Attribute.ServletPath)  + "/" +
  +		    (Constants.ATTRIBUTE_ServletPath)  + "/" +
                       servletName;
   	    }
   	    
  @@ -227,9 +227,9 @@
   	    savedServletPath=realRequest.getServletPath();
   	} else {
   	    savedServletPath = (String)realRequest.getAttribute(
  -			       Constants.Attribute.ServletPath);
  +			       Constants.ATTRIBUTE_ServletPath);
   	    savedPathInfo = (String)realRequest.getAttribute(
  -			       Constants.Attribute.PathInfo);
  +			       Constants.ATTRIBUTE_PathInfo);
   	}
   	
   	if (! inInclude) {
  @@ -238,19 +238,19 @@
   	} else {
   	    if (newServletPath != null) {
   		realRequest.setAttribute(
  -                    Constants.Attribute.ServletPath, newServletPath);
  +                    Constants.ATTRIBUTE_ServletPath, newServletPath);
   	    }
   
   	    if (newPathInfo != null) {
   		realRequest.setAttribute(
  -                    Constants.Attribute.PathInfo, newPathInfo);
  +                    Constants.ATTRIBUTE_PathInfo, newPathInfo);
   	    }
   
   	    if (newPathInfo == null) {
   		// Can't store a null, so remove for same effect
   
   		realRequest.removeAttribute(
  -                    Constants.Attribute.PathInfo);
  +                    Constants.ATTRIBUTE_PathInfo);
   	    }
   	}
   
  @@ -262,18 +262,18 @@
   	} else {
   	    if (savedServletPath != null) {
   		realRequest.setAttribute(
  -                    Constants.Attribute.ServletPath, savedServletPath);
  +                    Constants.ATTRIBUTE_ServletPath, savedServletPath);
   	    } else {
   		realRequest.removeAttribute(
  -                    Constants.Attribute.ServletPath);
  +                    Constants.ATTRIBUTE_ServletPath);
   	    }
   
   	    if (savedPathInfo != null) {
   		realRequest.setAttribute(
  -                    Constants.Attribute.PathInfo, savedPathInfo);
  +                    Constants.ATTRIBUTE_PathInfo, savedPathInfo);
   	    } else {
   		realRequest.removeAttribute(
  -                    Constants.Attribute.PathInfo);
  +                    Constants.ATTRIBUTE_PathInfo);
   	    }
   	}
       }
  
  
  
  1.3       +11 -11    jakarta-tomcat/src/share/org/apache/tomcat/servlets/WarFileServlet.java
  
  Index: WarFileServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/servlets/WarFileServlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarFileServlet.java	2000/02/10 22:28:23	1.2
  +++ WarFileServlet.java	2000/02/14 04:59:40	1.3
  @@ -97,9 +97,9 @@
           HttpServletResponse response)
       throws ServletException, IOException {
   	String pathInfo = (String)request.getAttribute(
  -            Constants.Attribute.PathInfo);
  +            Constants.ATTRIBUTE_PathInfo);
   	String requestURI = (String)request.getAttribute(
  -	    Constants.Attribute.RequestURI);
  +	    Constants.ATTRIBUTE_RequestURI);
   
   	if (pathInfo == null) {
   	    pathInfo = request.getPathInfo();
  @@ -173,7 +173,7 @@
           HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
   	String requestURI = (String)request.getAttribute(
  -	    Constants.Attribute.RequestURI);
  +	    Constants.ATTRIBUTE_RequestURI);
   
   	if (requestURI == null) {
   	    requestURI = request.getRequestURI();
  @@ -239,7 +239,7 @@
   		} else {
   		    boolean inInclude = false;
   		    Object o = request.getAttribute(
  -                        Constants.Attribute.Dispatch);
  +                        Constants.ATTRIBUTE_Dispatch);
   
   		    if (o != null) {
   		        inInclude = true;
  @@ -322,7 +322,7 @@
   	    // To do a good error msg, first figure out what we're serving
   
   	    String requestURI = (String)request.getAttribute(
  -		Constants.Attribute.RequestURI);
  +		Constants.ATTRIBUTE_RequestURI);
   
      	    if (requestURI == null) {
   	    	requestURI = request.getRequestURI();
  @@ -396,7 +396,7 @@
   	    // Figure out what we're serving
   
   	    String requestURI = (String)request.getAttribute(
  -		Constants.Attribute.RequestURI);
  +		Constants.ATTRIBUTE_RequestURI);
   
      	    if (requestURI == null) {
   	    	requestURI = request.getRequestURI();
  @@ -456,8 +456,8 @@
       }
       
       private boolean isFileMasked(String docBase, String requestedFile) {
  -        for (int i = 0; i < Constants.Context.MASKED_DIR.length; i++) {
  -            String maskFile = Constants.Context.MASKED_DIR[i];
  +        for (int i = 0; i < Constants.MASKED_DIR.length; i++) {
  +            String maskFile = Constants.MASKED_DIR[i];
   
               // case insensitive check
               if (requestedFile.toLowerCase().startsWith(
  @@ -477,8 +477,8 @@
           // contained another context, since the subcontext would have its
           // hidden dirs displayed.  So for now all masked dirs are masked.
           //
  -        for (int i = 0; i < Constants.Context.MASKED_DIR.length; i++) {
  -            if (subdir.equalsIgnoreCase(Constants.Context.MASKED_DIR[i])) {
  +        for (int i = 0; i < Constants.MASKED_DIR.length; i++) {
  +            if (subdir.equalsIgnoreCase(Constants.MASKED_DIR[i])) {
                   return true;
               }
           }
  @@ -583,7 +583,7 @@
   	// see if we are in an include
   
   	boolean inInclude = false;
  -        Object o = request.getAttribute(Constants.Attribute.Dispatch);
  +        Object o = request.getAttribute(Constants.ATTRIBUTE_Dispatch);
   
   	if (o != null) {
   	    inInclude = true;
  
  
  
  1.2       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/session/ApplicationSession.java
  
  Index: ApplicationSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/ApplicationSession.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplicationSession.java	2000/01/07 21:11:41	1.1
  +++ ApplicationSession.java	2000/02/14 04:59:41	1.2
  @@ -79,7 +79,7 @@
   public class ApplicationSession implements HttpSession {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.session");
       private Hashtable values = new Hashtable();
       private String id;
       private ServerSession serverSession;
  
  
  
  1.2       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/session/ServerSession.java
  
  Index: ServerSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/ServerSession.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerSession.java	2000/01/07 21:11:41	1.1
  +++ ServerSession.java	2000/02/14 04:59:41	1.2
  @@ -78,7 +78,7 @@
   public class ServerSession {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.session");
       private Hashtable values = new Hashtable();
       private Hashtable appSessions = new Hashtable();
       private String id;
  
  
  
  1.3       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/session/ServerSessionManager.java
  
  Index: ServerSessionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/ServerSessionManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerSessionManager.java	2000/01/09 22:32:43	1.2
  +++ ServerSessionManager.java	2000/02/14 04:59:41	1.3
  @@ -77,7 +77,7 @@
   public class ServerSessionManager implements SessionManager {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.session");
       private static ServerSessionManager manager; // = new ServerSessionManager();
   
       static {
  
  
  
  1.3       +5 -5      jakarta-tomcat/src/share/org/apache/tomcat/session/StandardManager.java
  
  Index: StandardManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardManager.java	2000/01/26 17:45:10	1.2
  +++ StandardManager.java	2000/02/14 04:59:41	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardManager.java,v 1.2 2000/01/26 17:45:10 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/01/26 17:45:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardManager.java,v 1.3 2000/02/14 04:59:41 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/14 04:59:41 $
    *
    * ====================================================================
    *
  @@ -103,7 +103,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/01/26 17:45:10 $
  + * @version $Revision: 1.3 $ $Date: 2000/02/14 04:59:41 $
    */
   
   public final class StandardManager
  @@ -142,7 +142,7 @@
        * The string manager for this package.
        */
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.session");
   
   
       /**
  
  
  
  1.4       +5 -5      jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardSession.java	2000/01/26 17:45:10	1.3
  +++ StandardSession.java	2000/02/14 04:59:41	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v 1.3 2000/01/26 17:45:10 costin Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/01/26 17:45:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v 1.4 2000/02/14 04:59:41 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/02/14 04:59:41 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * HttpSession view of this instance back to a Session view.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/01/26 17:45:10 $
  + * @version $Revision: 1.4 $ $Date: 2000/02/14 04:59:41 $
    */
   
   final class StandardSession
  @@ -180,7 +180,7 @@
        * The string manager for this package.
        */
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.session");
   
   
       /**
  
  
  
  1.2       +5 -5      jakarta-tomcat/src/share/org/apache/tomcat/util/Ascii.java
  
  Index: Ascii.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Ascii.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ascii.java	1999/10/09 00:20:55	1.1
  +++ Ascii.java	2000/02/14 04:59:42	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Ascii.java,v 1.1 1999/10/09 00:20:55 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:55 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Ascii.java,v 1.2 2000/02/14 04:59:42 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/02/14 04:59:42 $
    *
    * ====================================================================
    *
  @@ -192,7 +192,7 @@
   
   	if (b == null || len <= 0 || !isDigit(c = b[off++])) {
               StringManager sm =
  -                StringManager.getManager(Constants.Package);
  +                StringManager.getManager("org.apache.tomcat.util");
               String msg = sm.getString("ascii.parseInit.nfe", b);
   
   	    throw new NumberFormatException(msg);
  @@ -203,7 +203,7 @@
   	while (--len > 0) {
   	    if (!isDigit(c = b[off++])) {
                   StringManager sm =
  -                    StringManager.getManager(Constants.Package);
  +                    StringManager.getManager("org.apache.tomcat.util");
                   String msg = sm.getString("ascii.parseInit.nfe", b);
   
   		throw new NumberFormatException(msg);
  
  
  
  1.4       +7 -6      jakarta-tomcat/src/share/org/apache/tomcat/util/BuffTool.java
  
  Index: BuffTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/BuffTool.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BuffTool.java	2000/01/08 21:31:41	1.3
  +++ BuffTool.java	2000/02/14 04:59:42	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/BuffTool.java,v 1.3 2000/01/08 21:31:41 rubys Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/01/08 21:31:41 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/BuffTool.java,v 1.4 2000/02/14 04:59:42 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/02/14 04:59:42 $
    *
    * ====================================================================
    *
  @@ -65,6 +65,7 @@
   package org.apache.tomcat.util;
   
   import org.apache.tomcat.util.StringManager;
  +import org.apache.tomcat.core.Constants;
   import java.io.*;
   import javax.servlet.ServletOutputStream;
   
  @@ -106,7 +107,7 @@
       public static String getString( byte b[] , int pos, int len ) 
           throws UnsupportedEncodingException
       {
  -	return new String( b, pos, len, Constants.CharacterEncoding.Default );
  +	return new String( b, pos, len, Constants.DEFAULT_CHAR_ENCODING );
       }
   
   
  @@ -121,9 +122,9 @@
   		}
   	    }
   	    if( i+8 <len )
  -		System.out.print( new String( buff, i, 8, Constants.CharacterEncoding.Default ));
  +		System.out.print( new String( buff, i, 8, Constants.DEFAULT_CHAR_ENCODING ));
   	    else
  -		System.out.print( new String( buff, i, len-i, Constants.CharacterEncoding.Default ));
  +		System.out.print( new String( buff, i, len-i, Constants.DEFAULT_CHAR_ENCODING ));
   	    System.out.println();
   	}
   	System.out.println();
  
  
  
  1.4       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/util/HexUtils.java
  
  Index: HexUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/HexUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HexUtils.java	1999/10/29 05:13:30	1.3
  +++ HexUtils.java	2000/02/14 04:59:42	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/HexUtils.java,v 1.3 1999/10/29 05:13:30 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/10/29 05:13:30 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/HexUtils.java,v 1.4 2000/02/14 04:59:42 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/02/14 04:59:42 $
    *
    * ====================================================================
    *
  @@ -102,7 +102,7 @@
        * The string manager for this package.
        */
       private static StringManager sm =
  -	StringManager.getManager(Constants.Package);
  +	StringManager.getManager("org.apache.tomcat.util");
   
   
       /**
  
  
  
  1.3       +6 -5      jakarta-tomcat/src/share/org/apache/tomcat/util/HttpDate.java
  
  Index: HttpDate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/HttpDate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpDate.java	2000/01/08 21:31:41	1.2
  +++ HttpDate.java	2000/02/14 04:59:42	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/HttpDate.java,v 1.2 2000/01/08 21:31:41 rubys Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/01/08 21:31:41 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/HttpDate.java,v 1.3 2000/02/14 04:59:42 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/14 04:59:42 $
    *
    * ====================================================================
    *
  @@ -68,6 +68,7 @@
   import java.io.OutputStream;
   import java.util.*;
   import java.text.*;
  +import org.apache.tomcat.core.Constants;
   
   /**
    * This class can be used to efficiently parse and write an RFC 1123
  @@ -83,7 +84,7 @@
   public class HttpDate extends Ascii {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.util");
   
       // ONLY FOR COMPAT -- KILL ASAP -- just make sure that dependant
       // classes know what's up. ref. MimeHeaderField
  @@ -172,7 +173,7 @@
           // ok -- so this is pretty stoopid, but the old version of this
           // source took this arg set, so we will too for now (backwards compat)
           try {
  -            String dateString = new String(b, off, len, Constants.CharacterEncoding.Default);
  +            String dateString = new String(b, off, len, Constants.DEFAULT_CHAR_ENCODING);
               parse(dateString);
           } catch (java.io.UnsupportedEncodingException e) {
               // It seems rather unlikely that the string encoding would ever fail...
  
  
  
  1.3       +6 -5      jakarta-tomcat/src/share/org/apache/tomcat/util/MessageBytes.java
  
  Index: MessageBytes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MessageBytes.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MessageBytes.java	2000/01/09 17:24:41	1.2
  +++ MessageBytes.java	2000/02/14 04:59:43	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MessageBytes.java,v 1.2 2000/01/09 17:24:41 rubys Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/01/09 17:24:41 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MessageBytes.java,v 1.3 2000/02/14 04:59:43 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/14 04:59:43 $
    *
    * ====================================================================
    *
  @@ -66,6 +66,7 @@
   
   import java.io.OutputStream;
   import java.io.IOException;
  +import org.apache.tomcat.core.Constants;
   
   /**
    * This class is used to represent a subarray of bytes in an HTTP message.
  @@ -77,7 +78,7 @@
   public class MessageBytes extends Ascii {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.util");
   
       /**
        * The message bytes.
  @@ -178,7 +179,7 @@
           }
   
           try {
  -            return new String(bytes, offset, length, Constants.CharacterEncoding.Default);
  +            return new String(bytes, offset, length, Constants.DEFAULT_CHAR_ENCODING);
           } catch (java.io.UnsupportedEncodingException e) {
               return null;        // could return something - but why?
           }
  
  
  
  1.2       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaderField.java
  
  Index: MimeHeaderField.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaderField.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MimeHeaderField.java	1999/10/09 00:20:56	1.1
  +++ MimeHeaderField.java	2000/02/14 04:59:43	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaderField.java,v 1.1 1999/10/09 00:20:56 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:56 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaderField.java,v 1.2 2000/02/14 04:59:43 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/02/14 04:59:43 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
   public class MimeHeaderField {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.util");
   
       /**
        * The header field name.
  
  
  
  1.3       +5 -5      jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaders.java
  
  Index: MimeHeaders.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaders.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MimeHeaders.java	1999/10/24 16:53:21	1.2
  +++ MimeHeaders.java	2000/02/14 04:59:43	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaders.java,v 1.2 1999/10/24 16:53:21 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/24 16:53:21 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/MimeHeaders.java,v 1.3 2000/02/14 04:59:43 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/14 04:59:43 $
    *
    * ====================================================================
    *
  @@ -101,7 +101,7 @@
   public class MimeHeaders {
   
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.util");
   
       /**
        * The header fields.
  @@ -594,7 +594,7 @@
   
   class MimeHeadersEnumerator implements Enumeration {
       private StringManager sm =
  -        StringManager.getManager(Constants.Package);
  +        StringManager.getManager("org.apache.tomcat.util");
       private Hashtable hash;
       private Enumeration delegate;
   
  
  
  
  1.8       +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/RequestUtil.java
  
  Index: RequestUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/RequestUtil.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RequestUtil.java	2000/02/01 22:53:32	1.7
  +++ RequestUtil.java	2000/02/14 04:59:43	1.8
  @@ -61,6 +61,7 @@
   package org.apache.tomcat.util;
   
   import org.apache.tomcat.core.*;
  +import org.apache.tomcat.core.Constants;
   import java.io.*;
   import java.net.*;
   import java.util.*;
  @@ -154,7 +155,7 @@
   	// will probably try to read into the next request... bad!
           String encoding = request.getCharacterEncoding();
           if (encoding == null) {
  -            encoding = Constants.CharacterEncoding.Default;
  +            encoding = Constants.DEFAULT_CHAR_ENCODING;
           }
   	InputStreamReader r =
               new InputStreamReader(request.getInputStream(), encoding);
  
  
  
  1.3       +9 -9      jakarta-tomcat/src/share/org/apache/tomcat/util/SessionUtil.java
  
  Index: SessionUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/SessionUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SessionUtil.java	2000/01/26 17:45:10	1.2
  +++ SessionUtil.java	2000/02/14 04:59:43	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/SessionUtil.java,v 1.2 2000/01/26 17:45:10 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/01/26 17:45:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/SessionUtil.java,v 1.3 2000/02/14 04:59:43 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/14 04:59:43 $
    *
    * ====================================================================
    *
  @@ -67,15 +67,15 @@
   
   import javax.servlet.http.Cookie;
   import org.apache.tomcat.catalina.Request;
  +import org.apache.tomcat.core.Constants;
   
   
  -
   /**
    * General purpose utilities useful to <code>Manager</code> and
    * <code>Session</code> implementations.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/01/26 17:45:10 $
  + * @version $Revision: 1.3 $ $Date: 2000/02/14 04:59:43 $
    */
   
   public final class SessionUtil {
  @@ -103,7 +103,7 @@
        */
       public static Cookie createCookie(Request req, String id) {
   
  -	Cookie cookie = new Cookie(Constants.SESSION.COOKIE_NAME, id);
  +	Cookie cookie = new Cookie(Constants.SESSION_COOKIE_NAME, id);
   	String serverName = req.getRequest().getServerName();
   	if (serverName != null)
   	    cookie.setDomain(serverName);
  @@ -211,7 +211,7 @@
   	if (cookies == null)
   	    return (null);
   	for (int i = 0; i < cookies.length; i++) {
  -	    if (Constants.SESSION.COOKIE_NAME.equals(cookies[i].getName()))
  +	    if (Constants.SESSION_COOKIE_NAME.equals(cookies[i].getName()))
   		return (cookies[i].getValue());
   	}
   	return (null);
  @@ -230,7 +230,7 @@
       public static String parseSessionId(String uri) {
   
   	// Search for the required match string in the URI
  -	String match = ";" + Constants.SESSION.PARAMETER_NAME + "=";
  +	String match = ";" + Constants.SESSION_PARAMETER_NAME + "=";
   	int m = uri.indexOf(match);
   	if (m < 0)
   	    return (null);
  @@ -281,7 +281,7 @@
   	else
   	    buf.append(url.substring(0, question));
   	buf.append(';');
  -	buf.append(Constants.SESSION.PARAMETER_NAME);
  +	buf.append(Constants.SESSION_PARAMETER_NAME);
   	buf.append('=');
   	buf.append(id);
   	if (question >= 0)
  
  
  
  1.6       +0 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java
  
  Index: XmlMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XmlMapper.java	2000/02/14 02:25:23	1.5
  +++ XmlMapper.java	2000/02/14 04:59:44	1.6
  @@ -641,7 +641,6 @@
   	    }
   	}
   
  -	//	System.out.println(" XXX  " + parent.getClass().getName() + " " + mName + " " + paramT[0]);
   	Method m=parent.getClass().getMethod( mName, paramT );
   	m.invoke( parent, realParam );
   	    
  
  
  
  1.3       +25 -0     jakarta-tomcat/src/tests/webpages/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/web.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- web.xml	1999/11/04 00:12:57	1.2
  +++ web.xml	2000/02/14 04:59:44	1.3
  @@ -120,4 +120,29 @@
           </init-param>
       </servlet>          
   
  +
  +    <security-constraint>
  +      <web-resource-collection>
  +         <web-resource-name>a<web-resource-name>
  +         <url-pattern>/foo/*</url-pattern>
  +         <url-pattern>/bar/*</url-pattern>
  +         <http-method>GET</http-method>
  +         <http-method>POST</http-method>
  +      </web-resource-collection>
  +
  +      <web-resource-collection>
  +         <web-resource-name>a<web-resource-name>
  +         <url-pattern>/foo1/*</url-pattern>
  +         <url-pattern>/bar1/*</url-pattern>
  +      </web-resource-collection>
  +
  +      <auth-constraint>
  +         <role-name>manager</role-name>
  +         <role-name>role1</role-name>
  +      </auth-constraint>
  +
  +      <user-data-constraint>
  +         <transport-guarantee>CONFIDENTIAL<transport-guarantee>
  +      </user-data-constraint>
  +    </security-constraint>
   </web-app>