cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationContextFacade.java ApplicationDispatcher.java ApplicationFilterChain.java ApplicationFilterConfig.java ApplicationHttpRequest.java ApplicationHttpResponse.java ApplicationRequest.java ApplicationResponse.java Constants.java ContainerBase.java FastEngineMapper.java MappingRequest.java NamingContextListener.java
markt 2004/08/26 14:31:22 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationContextFacade.java ApplicationDispatcher.java ApplicationFilterChain.java ApplicationFilterConfig.java ApplicationHttpRequest.java ApplicationHttpResponse.java ApplicationRequest.java ApplicationResponse.java Constants.java ContainerBase.java FastEngineMapper.java MappingRequest.java NamingContextListener.java Log: Update TC4 branch to Apache License 2.0. Revision ChangesPath 1.45 +14 -61 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- ApplicationContext.java 30 Jun 2004 22:36:21 - 1.44 +++ ApplicationContext.java 26 Aug 2004 21:31:21 - 1.45 @@ -1,64 +1,17 @@ /* - * $Header$ - * $Revision$ - * $Date$ - * - * - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - *notice, this list of conditions and the following disclaimer in - *the documentation and/or other materials provided with the - *distribution. - * - * 3. The end-user documentation included with the redistribution, if - *any, must include the following acknowlegement: - * This product includes software developed by the - *Apache Software Foundation (http://www.apache.org/). - *Alternately, this acknowlegement may appear in the software itself, - *if and wherever such third-party acknowlegements normally appear. - * - * 4. The names The Jakarta Project, Tomcat, and Apache Software - *Foundation must not be used to endorse or promote products derived - *from this software without prior written permission. For written - *permission, please contact [EMAIL PROTECTED] - * - * 5. Products derived from this software may not be called Apache - *nor may Apache appear in their names without prior written - *permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * http://www.apache.org/. - * - * [Additional notices, if required by prior licensing conditions] - * + * Copyright 1999,2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ 1.4 +14 -61
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
markt 2004/04/01 12:07:21 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Remove unused imports identified by Eclipse - Fix getContext(/) so current context is returned if called whilst in the root context Revision ChangesPath 1.43 +6 -26 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- ApplicationContext.java 25 Mar 2004 23:17:40 - 1.42 +++ ApplicationContext.java 1 Apr 2004 20:07:21 - 1.43 @@ -65,28 +65,18 @@ package org.apache.catalina.core; -import java.io.BufferedReader; import java.io.InputStream; -import java.io.IOException; import java.io.File; -import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; -import java.net.Socket; import java.net.URL; import java.security.AccessController; -import java.security.Principal; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.Locale; -import java.util.Map; import java.util.Set; import javax.naming.NamingException; import javax.naming.Binding; @@ -96,25 +86,14 @@ import javax.servlet.ServletContext; import javax.servlet.ServletContextAttributeEvent; import javax.servlet.ServletContextAttributeListener; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; import org.apache.naming.resources.Resource; import org.apache.naming.resources.DirContextURLStreamHandler; -import org.apache.naming.resources.DirContextURLConnection; -import org.apache.catalina.Connector; -import org.apache.catalina.Container; import org.apache.catalina.Context; -import org.apache.catalina.Globals; import org.apache.catalina.Host; - import org.apache.catalina.HttpRequest; import org.apache.catalina.Logger; -import org.apache.catalina.Response; import org.apache.catalina.Wrapper; -import org.apache.catalina.connector.HttpRequestBase; import org.apache.catalina.deploy.ApplicationParameter; import org.apache.catalina.util.Enumerator; import org.apache.catalina.util.ResourceSet; @@ -446,7 +425,8 @@ if (!contextPath.endsWith(/)) contextPath = contextPath + /; -if ((contextPath.length() 1) (uri.startsWith(contextPath))) { +if (((contextPath.length() 1) (uri.startsWith(contextPath))) || +((contextPath.equals(/)) (uri.equals(/ { return (this); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2003/02/12 02:24:10 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Add an often requested kludge (which doesn't make the spec any less broken), to allow getting contexts from the root context. - Submitted by Martin Algesten. Revision ChangesPath 1.41 +1159 -1159jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- ApplicationContext.java 6 Nov 2002 13:39:36 - 1.40 +++ ApplicationContext.java 12 Feb 2003 10:24:09 - 1.41 @@ -1,1159 +1,1159 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - *notice, this list of conditions and the following disclaimer in - *the documentation and/or other materials provided with the - *distribution. - * - * 3. The end-user documentation included with the redistribution, if - *any, must include the following acknowlegement: - * This product includes software developed by the - *Apache Software Foundation (http://www.apache.org/). - *Alternately, this acknowlegement may appear in the software itself, - *if and wherever such third-party acknowlegements normally appear. - * - * 4. The names The Jakarta Project, Tomcat, and Apache Software - *Foundation must not be used to endorse or promote products derived - *from this software without prior written permission. For written - *permission, please contact [EMAIL PROTECTED] - * - * 5. Products derived from this software may not be called Apache - *nor may Apache appear in their names without prior written - *permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * http://www.apache.org/. - * - * [Additional notices, if required by prior licensing conditions] - * - */ - - -package org.apache.catalina.core; - - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.IOException; -import java.io.File; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.Socket; -import java.net.URL; -import java.security.AccessController; -import java.security.Principal; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import javax.naming.NamingException; -import javax.naming.Binding; -import javax.naming.directory.DirContext; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextAttributeEvent; -import
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2002/11/06 05:39:36 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Port patch for bug 13583. Revision ChangesPath 1.40 +15 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- ApplicationContext.java 28 Jun 2002 01:35:34 - 1.39 +++ ApplicationContext.java 6 Nov 2002 13:39:36 - 1.40 -589,7 +589,8 if (!path.startsWith(/)) throw new IllegalArgumentException (sm.getString(applicationContext.requestDispatcher.iae, path)); -if (normalize(path) == null) +path = normalize(path); +if (path == null) return (null); // Construct a fake request to be mapped by our Context -649,6 +650,11 */ public URL getResource(String path) throws MalformedURLException { + +path = normalize(path); +if (path == null) +return (null); + DirContext resources = context.getResources(); if (resources != null) { String fullPath = context.getName() + path; -687,6 +693,10 * param path The path to the desired resource. */ public InputStream getResourceAsStream(String path) { + +path = normalize(path); +if (path == null) +return (null); DirContext resources = context.getResources(); if (resources != null) { -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2002/06/05 09:47:32 Modified:catalina/src/share/org/apache/catalina/core Tag: tomcat_40_branch ApplicationContext.java Log: - GetResourcePaths used on a non existing path must return null. Revision ChangesPath No revision No revision 1.32.2.3 +5 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.32.2.2 retrieving revision 1.32.2.3 diff -u -r1.32.2.2 -r1.32.2.3 --- ApplicationContext.java 29 Apr 2002 07:54:37 - 1.32.2.2 +++ ApplicationContext.java 5 Jun 2002 16:47:31 - 1.32.2.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32.2.2 2002/04/29 07:54:37 remm Exp $ - * $Revision: 1.32.2.2 $ - * $Date: 2002/04/29 07:54:37 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32.2.3 2002/06/05 16:47:31 remm Exp $ + * $Revision: 1.32.2.3 $ + * $Date: 2002/06/05 16:47:31 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.32.2.2 $ $Date: 2002/04/29 07:54:37 $ + * @version $Revision: 1.32.2.3 $ $Date: 2002/06/05 16:47:31 $ */ public class ApplicationContext @@ -717,7 +717,7 @@ try { listCollectionPaths(set, resources, path); } catch (NamingException e) { -; // Ignore +return (null); } set.setLocked(true); return (set); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2002/06/05 09:48:25 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - GetResourcePaths used on a non existing path must return null (bug 9629). - Patch submitted by Gidado-Yisa Immanuel avm3 at cdc.gov Revision ChangesPath 1.38 +5 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- ApplicationContext.java 26 Apr 2002 21:18:18 - 1.37 +++ ApplicationContext.java 5 Jun 2002 16:48:25 - 1.38 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.37 2002/04/26 21:18:18 remm Exp $ - * $Revision: 1.37 $ - * $Date: 2002/04/26 21:18:18 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.38 2002/06/05 16:48:25 remm Exp $ + * $Revision: 1.38 $ + * $Date: 2002/06/05 16:48:25 $ * * * @@ -114,7 +114,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.37 $ $Date: 2002/04/26 21:18:18 $ + * @version $Revision: 1.38 $ $Date: 2002/06/05 16:48:25 $ */ public class ApplicationContext @@ -717,7 +717,7 @@ try { listCollectionPaths(set, resources, path); } catch (NamingException e) { -; // Ignore +return (null); } set.setLocked(true); return (set); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm02/04/29 00:54:37 Modified:catalina/src/share/org/apache/catalina/core Tag: tomcat_40_branch ApplicationContext.java Log: - Port patch for bug 6662. Revision ChangesPath No revision No revision 1.32.2.2 +6 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.32.2.1 retrieving revision 1.32.2.2 diff -u -r1.32.2.1 -r1.32.2.2 --- ApplicationContext.java 27 Feb 2002 19:20:18 - 1.32.2.1 +++ ApplicationContext.java 29 Apr 2002 07:54:37 - 1.32.2.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32.2.1 2002/02/27 19:20:18 remm Exp $ - * $Revision: 1.32.2.1 $ - * $Date: 2002/02/27 19:20:18 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32.2.2 2002/04/29 07:54:37 remm Exp $ + * $Revision: 1.32.2.2 $ + * $Date: 2002/04/29 07:54:37 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.32.2.1 $ $Date: 2002/02/27 19:20:18 $ + * @version $Revision: 1.32.2.2 $ $Date: 2002/04/29 07:54:37 $ */ public class ApplicationContext @@ -421,6 +421,8 @@ // Return the current context if requested String contextPath = context.getPath(); +if (!contextPath.endsWith(/)) +contextPath = contextPath + /; if ((contextPath.length() 0) (uri.startsWith(contextPath))) { return (this); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm02/04/24 01:39:53 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Fixes bug 6662. - The problem was that, given two context /foo and /foobar, doing ServletContext.getContext(/foobar) in context /foo would have returned context /foo instead of context /foobar because of the startsWith test. Now, the test is an equals. - This needs some testing, but the change looks safe. Revision ChangesPath 1.36 +5 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- ApplicationContext.java 27 Feb 2002 19:16:16 - 1.35 +++ ApplicationContext.java 24 Apr 2002 08:39:53 - 1.36 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.35 2002/02/27 19:16:16 remm Exp $ - * $Revision: 1.35 $ - * $Date: 2002/02/27 19:16:16 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.36 2002/04/24 08:39:53 remm Exp $ + * $Revision: 1.36 $ + * $Date: 2002/04/24 08:39:53 $ * * * @@ -114,7 +114,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.35 $ $Date: 2002/02/27 19:16:16 $ + * @version $Revision: 1.36 $ $Date: 2002/04/24 08:39:53 $ */ public class ApplicationContext @@ -422,8 +422,7 @@ // Return the current context if requested String contextPath = context.getPath(); -if ((contextPath.length() 0) -(uri.startsWith(contextPath))) { +if ((contextPath.length() 0) (uri.equals(contextPath))) { return (this); } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm02/02/27 11:16:16 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Normalize RD paths, so that we prevent getting a RD for a path below the context path. Revision ChangesPath 1.35 +41 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- ApplicationContext.java 21 Dec 2001 21:15:45 - 1.34 +++ ApplicationContext.java 27 Feb 2002 19:16:16 - 1.35 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.34 2001/12/21 21:15:45 craigmcc Exp $ - * $Revision: 1.34 $ - * $Date: 2001/12/21 21:15:45 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.35 2002/02/27 19:16:16 remm Exp $ + * $Revision: 1.35 $ + * $Date: 2002/02/27 19:16:16 $ * * * @@ -114,7 +114,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.34 $ $Date: 2001/12/21 21:15:45 $ + * @version $Revision: 1.35 $ $Date: 2002/02/27 19:16:16 $ */ public class ApplicationContext @@ -570,6 +570,8 @@ if (!path.startsWith(/)) throw new IllegalArgumentException (sm.getString(applicationContext.requestDispatcher.iae, path)); +if (normalize(path) == null) +return (null); // Construct a fake request to be mapped by our Context String contextPath = context.getPath(); @@ -998,6 +1000,41 @@ // Private Methods + + +/** + * Return a context-relative path, beginning with a /, that represents + * the canonical version of the specified path after .. and . elements + * are resolved out. If the specified path attempts to go outside the + * boundaries of the current context (i.e. too many .. path elements + * are present), return codenull/code instead. + * + * @param path Path to be normalized + */ +private String normalize(String path) { + + String normalized = path; + + // Normalize the slashes and add leading slash if necessary + if (normalized.indexOf('\\') = 0) + normalized = normalized.replace('\\', '/'); + + // Resolve occurrences of /../ in the normalized path + while (true) { + int index = normalized.indexOf(/../); + if (index 0) + break; + if (index == 0) + return (null); // Trying to go outside our context + int index2 = normalized.lastIndexOf('/', index - 1); + normalized = normalized.substring(0, index2) + + normalized.substring(index + 3); + } + + // Return the normalized path that we have completed + return (normalized); + +} /** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm02/02/27 11:20:18 Modified:catalina/src/share/org/apache/catalina/core Tag: tomcat_40_branch ApplicationContext.java Log: - Port patch. - Normalize RD paths, so that we prevent getting a RD for a path below the context path. Revision ChangesPath No revision No revision 1.32.2.1 +41 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.32 retrieving revision 1.32.2.1 diff -u -r1.32 -r1.32.2.1 --- ApplicationContext.java 11 Sep 2001 01:34:50 - 1.32 +++ ApplicationContext.java 27 Feb 2002 19:20:18 - 1.32.2.1 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32 2001/09/11 01:34:50 remm Exp $ - * $Revision: 1.32 $ - * $Date: 2001/09/11 01:34:50 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32.2.1 2002/02/27 19:20:18 remm Exp $ + * $Revision: 1.32.2.1 $ + * $Date: 2002/02/27 19:20:18 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.32 $ $Date: 2001/09/11 01:34:50 $ + * @version $Revision: 1.32.2.1 $ $Date: 2002/02/27 19:20:18 $ */ public class ApplicationContext @@ -569,6 +569,8 @@ if (!path.startsWith(/)) throw new IllegalArgumentException (sm.getString(applicationContext.requestDispatcher.iae, path)); +if (normalize(path) == null) +return (null); // Construct a fake request to be mapped by our Context String contextPath = context.getPath(); @@ -997,6 +999,41 @@ // Private Methods + + +/** + * Return a context-relative path, beginning with a /, that represents + * the canonical version of the specified path after .. and . elements + * are resolved out. If the specified path attempts to go outside the + * boundaries of the current context (i.e. too many .. path elements + * are present), return codenull/code instead. + * + * @param path Path to be normalized + */ +private String normalize(String path) { + + String normalized = path; + + // Normalize the slashes and add leading slash if necessary + if (normalized.indexOf('\\') = 0) + normalized = normalized.replace('\\', '/'); + + // Resolve occurrences of /../ in the normalized path + while (true) { + int index = normalized.indexOf(/../); + if (index 0) + break; + if (index == 0) + return (null); // Trying to go outside our context + int index2 = normalized.lastIndexOf('/', index - 1); + normalized = normalized.substring(0, index2) + + normalized.substring(index + 3); + } + + // Return the normalized path that we have completed + return (normalized); + +} /** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
craigmcc01/11/19 10:25:39 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Avoid double slashes in the values returned by something like ServletContext.getResourcePaths(/images/). Revision ChangesPath 1.33 +5 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- ApplicationContext.java 2001/09/11 01:34:50 1.32 +++ ApplicationContext.java 2001/11/19 18:25:39 1.33 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32 2001/09/11 01:34:50 remm Exp $ - * $Revision: 1.32 $ - * $Date: 2001/09/11 01:34:50 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.33 2001/11/19 18:25:39 craigmcc Exp $ + * $Revision: 1.33 $ + * $Date: 2001/11/19 18:25:39 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.32 $ $Date: 2001/09/11 01:34:50 $ + * @version $Revision: 1.33 $ $Date: 2001/11/19 18:25:39 $ */ public class ApplicationContext @@ -1063,7 +1063,7 @@ Binding binding = (Binding) childPaths.nextElement(); String name = binding.getName(); StringBuffer childPath = new StringBuffer(path); -if (!/.equals(path)) +if (!/.equals(path) !path.endsWith(/)) childPath.append(/); childPath.append(name); Object object = binding.getObject(); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
glenn 01/09/10 08:21:02 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Bug fix, add path separator between host and path Revision ChangesPath 1.31 +7 -7 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- ApplicationContext.java 2001/07/25 04:25:58 1.30 +++ ApplicationContext.java 2001/09/10 15:21:02 1.31 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.30 2001/07/25 04:25:58 remm Exp $ - * $Revision: 1.30 $ - * $Date: 2001/07/25 04:25:58 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.31 2001/09/10 15:21:02 glenn Exp $ + * $Revision: 1.31 $ + * $Date: 2001/09/10 15:21:02 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.30 $ $Date: 2001/07/25 04:25:58 $ + * @version $Revision: 1.31 $ $Date: 2001/09/10 15:21:02 $ */ public class ApplicationContext @@ -172,10 +172,9 @@ } public Object run() throws Exception { -return new URL(jndi, null, 0, / + host + path, +return new URL(jndi, null, 0, / + host + / + path, new DirContextURLStreamHandler(resources)); } - } @@ -641,7 +640,8 @@ throw pe.getException(); } } else { -return new URL(jndi, null, 0, / + hostName + fullPath, +return new URL(jndi, null, 0, + / + hostName + / + fullPath, new DirContextURLStreamHandler(resources)); } } catch (Exception e) {
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm01/09/10 18:34:50 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - The URLs returned had extra '/' in many cases. Revision ChangesPath 1.32 +20 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- ApplicationContext.java 2001/09/10 15:21:02 1.31 +++ ApplicationContext.java 2001/09/11 01:34:50 1.32 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.31 2001/09/10 15:21:02 glenn Exp $ - * $Revision: 1.31 $ - * $Date: 2001/09/10 15:21:02 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.32 2001/09/11 01:34:50 remm Exp $ + * $Revision: 1.32 $ + * $Date: 2001/09/11 01:34:50 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.31 $ $Date: 2001/09/10 15:21:02 $ + * @version $Revision: 1.32 $ $Date: 2001/09/11 01:34:50 $ */ public class ApplicationContext @@ -172,8 +172,8 @@ } public Object run() throws Exception { -return new URL(jndi, null, 0, / + host + / + path, - new DirContextURLStreamHandler(resources)); +return new URL(jndi, null, 0, getJNDIUri(host, path), + new DirContextURLStreamHandler(resources)); } } @@ -640,9 +640,9 @@ throw pe.getException(); } } else { -return new URL(jndi, null, 0, - / + hostName + / + fullPath, - new DirContextURLStreamHandler(resources)); +return new URL +(jndi, null, 0, getJNDIUri(hostName, fullPath), + new DirContextURLStreamHandler(resources)); } } catch (Exception e) { //e.printStackTrace(); @@ -1073,6 +1073,17 @@ set.add(childPath.toString()); } +} + + +/** + * Get full path, based on the host name and the context path. + */ +public static String getJNDIUri(String hostName, String path) { +if (!path.startsWith(/)) +return / + hostName + / + path; +else +return / + hostName + path; }
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java LocalStrings.properties
remm01/07/24 21:25:58 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java LocalStrings.properties Log: - Throw IAE if name is nul in setAttribute call. Revision ChangesPath 1.30 +9 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- ApplicationContext.java 2001/07/22 20:25:08 1.29 +++ ApplicationContext.java 2001/07/25 04:25:58 1.30 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.29 2001/07/22 20:25:08 pier Exp $ - * $Revision: 1.29 $ - * $Date: 2001/07/22 20:25:08 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.30 2001/07/25 04:25:58 remm Exp $ + * $Revision: 1.30 $ + * $Date: 2001/07/25 04:25:58 $ * * * @@ -113,7 +113,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.29 $ $Date: 2001/07/22 20:25:08 $ + * @version $Revision: 1.30 $ $Date: 2001/07/25 04:25:58 $ */ public class ApplicationContext @@ -908,6 +908,11 @@ * @param value New attribute value to be bound */ public void setAttribute(String name, Object value) { + +// Name cannot be null +if (name == null) +throw new IllegalArgumentException +(sm.getString(applicationContext.setAttribute.namenull)); // Null value is the same as removeAttribute() if (value == null) { 1.35 +1 -0 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/LocalStrings.properties Index: LocalStrings.properties === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/LocalStrings.properties,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- LocalStrings.properties 2001/07/22 18:38:05 1.34 +++ LocalStrings.properties 2001/07/25 04:25:58 1.35 @@ -1,5 +1,6 @@ applicationContext.attributeEvent=Exception thrown by attributes event listener applicationContext.requestDispatcher.iae=Path {0} does not start with a / character +applicationContext.setAttribute.namenull=Name cannot be null applicationDispatcher.allocateException=Allocate exception for servlet {0} applicationDispatcher.deallocateException=Deallocate exception for servlet {0} applicationDispatcher.forward.ise=Cannot forward after response has been committed
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationContextFacade.java StandardWrapperFacade.java
craigmcc01/05/14 19:24:18 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationContextFacade.java StandardWrapperFacade.java Log: ServletContext.getContext() needs to return the same ApplicationContextFacade that would be handed to a servlet in the other context. Revision ChangesPath 1.25 +24 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- ApplicationContext.java 2001/05/12 03:04:08 1.24 +++ ApplicationContext.java 2001/05/15 02:24:17 1.25 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.24 2001/05/12 03:04:08 craigmcc Exp $ - * $Revision: 1.24 $ - * $Date: 2001/05/12 03:04:08 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.25 2001/05/15 02:24:17 craigmcc Exp $ + * $Revision: 1.25 $ + * $Date: 2001/05/15 02:24:17 $ * * * @@ -112,7 +112,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.24 $ $Date: 2001/05/12 03:04:08 $ + * @version $Revision: 1.25 $ $Date: 2001/05/15 02:24:17 $ */ public class ApplicationContext @@ -294,6 +294,12 @@ /** + * The facade around this object. + */ +private ServletContext facade = new ApplicationContextFacade(this); + + +/** * The merged context initialization parameters for this Context. */ private HashMap parameters = null; @@ -933,6 +939,20 @@ } } + + +// Package Methods + + +/** + * Return the facade associated with this ApplicationContext. + */ +ServletContext getFacade() { + +return (this.facade); + +} + // Private Methods 1.2 +10 -19 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContextFacade.java Index: ApplicationContextFacade.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContextFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ApplicationContextFacade.java 2001/05/14 04:07:31 1.1 +++ ApplicationContextFacade.java 2001/05/15 02:24:17 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContextFacade.java,v 1.1 2001/05/14 04:07:31 remm Exp $ - * $Revision: 1.1 $ - * $Date: 2001/05/14 04:07:31 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContextFacade.java,v 1.2 2001/05/15 02:24:17 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/05/15 02:24:17 $ * * * @@ -96,7 +96,7 @@ * object from the web application. * * @author Remy Maucherat - * @version $Revision: 1.1 $ $Date: 2001/05/14 04:07:31 $ + * @version $Revision: 1.2 $ $Date: 2001/05/15 02:24:17 $ */ public final class ApplicationContextFacade @@ -114,18 +114,6 @@ */ public ApplicationContextFacade(ApplicationContext context) { super(); - this.context = (ServletContext) context; -} - - -/** - * Construct a new instance of this class, associated with the specified - * Context instance. - * - * @param context The associated Context instance - */ -public ApplicationContextFacade(ServletContext context) { - super(); this.context = context; } @@ -136,15 +124,18 @@ /** * Wrapped application context. */ -private ServletContext context = null; +private ApplicationContext context = null; // - ServletContext Methods public ServletContext getContext(String uripath) { -// FIXME : Create a facade for the returned object ? -return context.getContext(uripath); +ServletContext theContext = context.getContext(uripath); +if ((theContext != null) +(theContext instanceof ApplicationContext)) +
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
glenn 01/04/25 18:14:04 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Wrap servlet logging with doPrivileged Revision ChangesPath 1.22 +88 -7 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ApplicationContext.java 2001/04/25 17:17:49 1.21 +++ ApplicationContext.java 2001/04/26 01:14:02 1.22 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.21 2001/04/25 17:17:49 craigmcc Exp $ - * $Revision: 1.21 $ - * $Date: 2001/04/25 17:17:49 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.22 2001/04/26 01:14:02 glenn Exp $ + * $Revision: 1.22 $ + * $Date: 2001/04/26 01:14:02 $ * * * @@ -111,7 +111,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.21 $ $Date: 2001/04/25 17:17:49 $ + * @version $Revision: 1.22 $ $Date: 2001/04/26 01:14:02 $ */ public final class ApplicationContext @@ -158,10 +158,10 @@ protected class PrivilegedGetResource implements PrivilegedExceptionAction { - - private String path; + +private String path; private String host; - private DirContext resources; +private DirContext resources; PrivilegedGetResource(String host, String path, DirContext resources) { this.host = host; @@ -176,7 +176,59 @@ } +protected class PrivilegedLogMessage +implements PrivilegedAction { + +private String message; + +PrivilegedLogMessage(String message) { +this.message = message; +} + +public Object run() { +internalLog(message); +return null; +} + +} + +protected class PrivilegedLogException +implements PrivilegedAction { + +private String message; +private Exception exception; + +PrivilegedLogException(Exception exception,String message) { +this.message = message; +this.exception = exception; +} + +public Object run() { +internalLog(exception,message); +return null; +} + +} + +protected class PrivilegedLogThrowable +implements PrivilegedAction { + +private String message; +private Throwable throwable; + +PrivilegedLogThrowable(String message,Throwable throwable) { +this.message = message; +this.throwable = throwable; +} + +public Object run() { +internalLog(message,throwable); +return null; +} + +} + // --- Constructors @@ -682,7 +734,17 @@ * @param message Message to be written */ public void log(String message) { +if( System.getSecurityManager() != null ) { +PrivilegedLogMessage dp = +new PrivilegedLogMessage(message); +AccessController.doPrivileged(dp); +} else { +internalLog(message); +} +} +private void internalLog(String message) { + Logger logger = context.getLogger(); if (logger != null) logger.log(message); @@ -700,7 +762,16 @@ * codelog(String, Throwable)/code instead */ public void log(Exception exception, String message) { +if( System.getSecurityManager() != null ) { +PrivilegedLogException dp = +new
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java ContainerBase.java
remm01/04/06 12:31:20 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ContainerBase.java Log: - Fix for bug 1219. It makes the URLs generated more unique, to avoid confusing the JDK's JAR URL cache. Revision ChangesPath 1.19 +20 -14 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ApplicationContext.java 2001/03/22 00:51:17 1.18 +++ ApplicationContext.java 2001/04/06 19:31:17 1.19 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.18 2001/03/22 00:51:17 remm Exp $ - * $Revision: 1.18 $ - * $Date: 2001/03/22 00:51:17 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.19 2001/04/06 19:31:17 remm Exp $ + * $Revision: 1.19 $ + * $Date: 2001/04/06 19:31:17 $ * * * @@ -111,7 +111,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.18 $ $Date: 2001/03/22 00:51:17 $ + * @version $Revision: 1.19 $ $Date: 2001/04/06 19:31:17 $ */ public final class ApplicationContext @@ -160,15 +160,17 @@ implements PrivilegedExceptionAction { private String path; +private String host; private DirContext resources; -PrivilegedGetResource(String path, DirContext resources) { +PrivilegedGetResource(String host, String path, DirContext resources) { +this.host = host; this.path = path; this.resources = resources; } public Object run() throws Exception { -return new URL("jndi", null, 0, path, +return new URL("jndi", host, 0, path, new DirContextURLStreamHandler(resources)); } @@ -185,7 +187,6 @@ * @param context The associated Context instance */ public ApplicationContext(String basePath, StandardContext context) { - super(); this.context = context; this.basePath = basePath; @@ -495,7 +496,8 @@ return (null); // Construct a RequestDispatcher to process this request - HttpServletRequest hrequest = (HttpServletRequest) request.getRequest(); + HttpServletRequest hrequest = +(HttpServletRequest) request.getRequest(); return (RequestDispatcher) new ApplicationDispatcher(wrapper, hrequest.getServletPath(), hrequest.getPathInfo(), @@ -516,22 +518,26 @@ * @exception MalformedURLException if the path is not given * in the correct form */ -public URL getResource(String path) throws MalformedURLException { +public URL getResource(String path) +throws MalformedURLException { DirContext resources = context.getResources(); if (resources != null) { +String fullPath = context.getName() + path; +String hostName = context.getParent().getName(); try { resources.lookup(path); if( System.getSecurityManager() != null ) { try { PrivilegedGetResource dp = - new PrivilegedGetResource(path,resources); + new PrivilegedGetResource +(hostName, fullPath, resources); return (URL)AccessController.doPrivileged(dp); } catch( PrivilegedActionException pe) { throw pe.getException(); } } else { -return new URL("jndi", null, 0, path, - new DirContextURLStreamHandler(resources)); +return new URL("jndi", hostName, 0, fullPath, + new DirContextURLStreamHandler(resources)); } } catch (Exception e) { //e.printStackTrace(); @@ -805,8 +811,8 @@ (ServletContextAttributeListener) listeners[i]; try { if (replaced) { -context.fireContainerEvent("beforeContextAttributeReplaced", - listener); +context.fireContainerEvent +
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm01/03/21 16:51:20 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Add possibility to make some servlet context attributes read only. Of course, the object can still be mutated. - This functionality is NOT exposed to servlets (at least to servlets which are outside the Catalina core). Revision ChangesPath 1.18 +29 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ApplicationContext.java 2001/03/17 00:28:01 1.17 +++ ApplicationContext.java 2001/03/22 00:51:17 1.18 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.17 2001/03/17 00:28:01 craigmcc Exp $ - * $Revision: 1.17 $ - * $Date: 2001/03/17 00:28:01 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.18 2001/03/22 00:51:17 remm Exp $ + * $Revision: 1.18 $ + * $Date: 2001/03/22 00:51:17 $ * * * @@ -111,7 +111,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.17 $ $Date: 2001/03/17 00:28:01 $ + * @version $Revision: 1.18 $ $Date: 2001/03/22 00:51:17 $ */ public final class ApplicationContext @@ -202,6 +202,12 @@ /** + * List of read only attributes for this context. + */ +private HashMap readOnlyAttributes = new HashMap(); + + +/** * The Context instance with which we are associated. */ private StandardContext context = null; @@ -248,6 +254,19 @@ } +/** + * Set an attribute as read only. + */ +public void setAttributeReadOnly(String name) { + +synchronized (attributes) { +if (attributes.containsKey(name)) +readOnlyAttributes.put(name, name); +} + +} + + // - ServletContext Methods @@ -710,6 +729,9 @@ // Remove the specified attribute synchronized (attributes) { +// Check for read only attribute +if (readOnlyAttributes.containsKey(name)) +return; found = attributes.containsKey(name); if (found) { value = attributes.get(name); @@ -761,6 +783,9 @@ // Add or replace the specified attribute synchronized (attributes) { +// Check for read only attribute +if (readOnlyAttributes.containsKey(name)) +return; if (attributes.get(name) != null) replaced = true; attributes.put(name, value);
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm01/03/16 15:31:01 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Add new servlet API call : getResourcePaths(String path) which can be used to get an immutable Set listing the members of a collection. Revision ChangesPath 1.16 +55 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ApplicationContext.java 2001/02/05 05:41:57 1.15 +++ ApplicationContext.java 2001/03/16 23:30:58 1.16 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.15 2001/02/05 05:41:57 remm Exp $ - * $Revision: 1.15 $ - * $Date: 2001/02/05 05:41:57 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.16 2001/03/16 23:30:58 remm Exp $ + * $Revision: 1.16 $ + * $Date: 2001/03/16 23:30:58 $ * * * @@ -111,7 +111,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.15 $ $Date: 2001/02/05 05:41:57 $ + * @version $Revision: 1.16 $ $Date: 2001/03/16 23:30:58 $ */ public final class ApplicationContext @@ -574,6 +574,34 @@ /** + * Return a Set containing the resource paths of resources member of the + * specified collection. Each path will be a String starting with + * a "/" character. The returned set is immutable. + * + * @param path Collection path + */ +public Set getResourcePaths(String path) { + +ResourceSet set = new ResourceSet(); +DirContext resources = context.getResources(); +if (resources == null) { +set.setLocked(true); +return (set); +} + +try { +listCollectionPaths(set, resources, path); +} catch (NamingException e) { +// Ignore +} + +set.setLocked(true); +return (set); + +} + + +/** * Return the name and version of the servlet container. */ public String getServerInfo() { @@ -828,6 +856,29 @@ if (object instanceof DirContext) { listPaths(set, resources, childPath); } +} + +} + + +/** + * List resource paths (recursively), and store all of them in the given + * Set. + */ +private static void listCollectionPaths +(Set set, DirContext resources, String path) +throws NamingException { + +Enumeration childPaths = resources.listBindings(path); +while (childPaths.hasMoreElements()) { +Binding binding = (Binding) childPaths.nextElement(); +String name = binding.getName(); +String childPath = path + "/" + name; +Object object = binding.getObject(); +if (object instanceof DirContext) { +childPath = childPath + "/"; +} +set.add(childPath); } }
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
glenn 01/02/03 16:49:41 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Implement SecurityManager Revision ChangesPath 1.14 +92 -25 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ApplicationContext.java 2001/01/25 19:09:15 1.13 +++ ApplicationContext.java 2001/02/04 00:49:41 1.14 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.13 2001/01/25 19:09:15 remm Exp $ - * $Revision: 1.13 $ - * $Date: 2001/01/25 19:09:15 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.14 2001/02/04 00:49:41 glenn Exp $ + * $Revision: 1.14 $ + * $Date: 2001/02/04 00:49:41 $ * * * @@ -69,6 +69,10 @@ import java.io.File; import java.net.MalformedURLException; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; @@ -107,12 +111,60 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.13 $ $Date: 2001/01/25 19:09:15 $ + * @version $Revision: 1.14 $ $Date: 2001/02/04 00:49:41 $ */ public final class ApplicationContext implements ServletContext { +protected class PrivilegedGetRequestDispatcher implements PrivilegedAction { +private String contextPath; +private String relativeURI; +private String queryString; + +PrivilegedGetRequestDispatcher(String contextPath, String relativeURI, + String queryString) +{ +this.contextPath = contextPath; +this.relativeURI = relativeURI; +this.queryString = queryString; +} + +public Object run() { + HttpRequestBase request = new HttpRequestBase(); +request.setContext(context); +request.setContextPath(context.getPath()); +request.setRequestURI(contextPath + relativeURI); +request.setQueryString(queryString); +Wrapper wrapper = (Wrapper) context.map(request, true); +if (wrapper == null) +return (null); + +// Construct a RequestDispatcher to process this request +HttpServletRequest hrequest = (HttpServletRequest) request.getRequest(); +return (RequestDispatcher) new ApplicationDispatcher(wrapper, +hrequest.getServletPath(), +hrequest.getPathInfo(), +hrequest.getQueryString(), +null); +} +} + +protected class PrivilegedGetResource implements PrivilegedExceptionAction { + private String path; + private DirContext resources; + +PrivilegedGetResource(String path, DirContext resources) +{ +this.path = path; +this.resources = resources; +} + +public Object run() throws Exception { +return new URL("jndi", null, 0, path, + new DirContextURLStreamHandler(resources)); +} +} // --- Constructors @@ -128,7 +180,6 @@ super(); this.context = context; this.basePath = basePath; - } @@ -397,25 +448,31 @@ relativeURI = path.substring(0, question); queryString = path.substring(question + 1); } -HttpRequestBase request = new HttpRequestBase(); -request.setContext(context); -request.setContextPath(context.getPath()); -request.setRequestURI(contextPath + relativeURI); -request.setQueryString(queryString); -Wrapper wrapper = (Wrapper) context.map(request, true); -if (wrapper == null) -return (null); + if( System.getSecurityManager() != null ) { + PrivilegedGetRequestDispatcher dp = + new
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm01/01/24 14:39:57 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Reimplement ServletContext.getResourcePaths() using directory contexts (instead of Resources). Revision ChangesPath 1.12 +36 -13 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ApplicationContext.java 2001/01/23 06:14:20 1.11 +++ ApplicationContext.java 2001/01/24 22:39:56 1.12 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.11 2001/01/23 06:14:20 remm Exp $ - * $Revision: 1.11 $ - * $Date: 2001/01/23 06:14:20 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.12 2001/01/24 22:39:56 remm Exp $ + * $Revision: 1.12 $ + * $Date: 2001/01/24 22:39:56 $ * * * @@ -75,6 +75,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Set; +import javax.naming.NamingException; +import javax.naming.Binding; import javax.naming.directory.DirContext; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; @@ -105,7 +107,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.11 $ $Date: 2001/01/23 06:14:20 $ + * @version $Revision: 1.12 $ $Date: 2001/01/24 22:39:56 $ */ public final class ApplicationContext @@ -475,19 +477,18 @@ public Set getResourcePaths() { ResourceSet set = new ResourceSet(); -// FIXME ! -/* -Resources resources = context.getResources(); +DirContext resources = context.getResources(); if (resources == null) { set.setLocked(true); return (set); +} + +try { +listPaths(set, resources, ""); +} catch (NamingException e) { +// Ignore } -String paths[] = resources.getResourcePaths(); -if (paths == null) -paths = new String[0]; -for (int i = 0; i paths.length; i++) -set.add(paths[i]); -*/ + set.setLocked(true); return (set); @@ -728,6 +729,28 @@ } } parameters = results; + +} + + +/** + * List resource paths (recursively), and store all of them in the given + * Set. + */ +private static void listPaths(Set set, DirContext resources, String path) +throws NamingException { + +Enumeration childPaths = resources.listBindings(path); +while (childPaths.hasMoreElements()) { +Binding binding = (Binding) childPaths.nextElement(); +String name = binding.getName(); +String childPath = path + "/" + name; +set.add(childPath); +Object object = binding.getObject(); +if (object instanceof DirContext) { +listPaths(set, resources, childPath); +} +} } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm01/01/22 22:14:20 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Should fix watchdog failure in /servlet-tests/GetResource_1Test. A URL object was returned regardless of the existence of a resource at the requested path. Revision ChangesPath 1.11 +13 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ApplicationContext.java 2001/01/23 05:05:46 1.10 +++ ApplicationContext.java 2001/01/23 06:14:20 1.11 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.10 2001/01/23 05:05:46 remm Exp $ - * $Revision: 1.10 $ - * $Date: 2001/01/23 05:05:46 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.11 2001/01/23 06:14:20 remm Exp $ + * $Revision: 1.11 $ + * $Date: 2001/01/23 06:14:20 $ * * * @@ -105,7 +105,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.10 $ $Date: 2001/01/23 05:05:46 $ + * @version $Revision: 1.11 $ $Date: 2001/01/23 06:14:20 $ */ public final class ApplicationContext @@ -430,11 +430,15 @@ public URL getResource(String path) throws MalformedURLException { DirContext resources = context.getResources(); - if (resources == null) - return (null); - else - return new URL("jndi", null, 0, path, - new DirContextURLStreamHandler(resources)); + if (resources != null) { +try { +resources.lookup(path); +return new URL("jndi", null, 0, path, + new DirContextURLStreamHandler(resources)); +} catch (Exception e) { +} +} +return (null); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]