cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2005/08/29 03:38:39 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Simplify code: no change. Revision ChangesPath 1.29 +3 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- ApplicationContext.java 3 May 2005 17:24:10 - 1.28 +++ ApplicationContext.java 29 Aug 2005 10:38:38 - 1.29 @@ -335,11 +335,7 @@ if (wrapper == null) return (null); -ApplicationDispatcher dispatcher; -dispatcher = - new ApplicationDispatcher(wrapper, null, null, null, null, name); - -return ((RequestDispatcher) dispatcher); +return new ApplicationDispatcher(wrapper, null, null, null, null, name); } @@ -450,7 +446,7 @@ mappingData.recycle(); // Construct a RequestDispatcher to process this request -return (RequestDispatcher) new ApplicationDispatcher +return new ApplicationDispatcher (wrapper, uriCC.toString(), wrapperPath, pathInfo, queryString, null); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java LocalStrings.properties
luehe 2005/05/03 10:24:10 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java LocalStrings.properties Log: Prevent NPE when passing null path argument in several places Revision ChangesPath 1.28 +18 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- ApplicationContext.java 17 Mar 2005 10:53:44 - 1.27 +++ ApplicationContext.java 3 May 2005 17:24:10 - 1.28 @@ -355,6 +355,10 @@ if (!context.isFilesystemBased()) return null; +if (path == null) { +return null; +} + File file = new File(basePath, path); return (file.getAbsolutePath()); @@ -547,6 +551,15 @@ */ public Set getResourcePaths(String path) { +// Validate the path argument +if (path == null) { +return null; +} +if (!path.startsWith(/)) { +throw new IllegalArgumentException +(sm.getString(applicationContext.resourcePaths.iae, path)); +} + path = normalize(path); if (path == null) return (null); @@ -867,6 +880,10 @@ */ private String normalize(String path) { +if (path == null) { +return null; +} + String normalized = path; // Normalize the slashes and add leading slash if necessary 1.21 +1 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/LocalStrings.properties Index: LocalStrings.properties === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/LocalStrings.properties,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- LocalStrings.properties 19 Apr 2005 18:42:29 - 1.20 +++ LocalStrings.properties 3 May 2005 17:24:10 - 1.21 @@ -1,6 +1,7 @@ applicationContext.attributeEvent=Exception thrown by attributes event listener applicationContext.mapping.error=Error during mapping applicationContext.requestDispatcher.iae=Path {0} does not start with a / character +applicationContext.resourcePaths.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} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2005/03/17 02:53:44 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Ignore ';' if it is in the query string. Revision ChangesPath 1.27 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- ApplicationContext.java 23 Jun 2004 13:51:35 - 1.26 +++ ApplicationContext.java 17 Mar 2005 10:53:44 - 1.27 @@ -417,6 +417,9 @@ * purposes */ int semicolon = path.indexOf(';'); +if (pos = 0 semicolon pos) { +semicolon = -1; +} uriCC.append(path, 0, semicolon 0 ? semicolon : pos); context.getMapper().map(uriMB, mappingData); if (mappingData.wrapper == null) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
From: Remy Maucherat [mailto:[EMAIL PROTECTED] Mark Thomas wrote: Fixing bug 13040 requires an additional patch that uses equals() for the whole algorithm. Hence the complications. This is what I was discussing above. The matching rule can't be fully implemented AFAIK. I think the current algorithm is a nice compromise. Please give examples where you think it's not good enough (and is worthwhile to support), but you will likely end up breaking other stuff. Consider a server with the following contexts configured: A: / B: /foo/ C: /foo/bar/ Assuming cross-context is enabled, the current behaviour of getContext(String uripath) for different values of uri in each context is as follows: Context uripath result -- A / A A /foo/ B A /foo/bar/ C A /foo/bar/xxx/ C B / A B /foo/ B B /foo/bar/ B B /foo/bar/xxx/ B C / A C /foo/ B C /foo/bar/ C C /foo/bar/xxx/ C The thing that really bothers me about this is how the return from getContext(/foo/bar/) and getContext(/foo/bar/xxx) varies depending on the context from which the call is made. I think this is bad. To quote from the spec: uripath - a String specifying the context path of another web application in the container. My proposal is to change getContext to provide the following behaviour: Context uripath result -- A / A A /foo/ B A /foo/bar/ C A /foo/bar/xxx/ null B / A B /foo/ B B /foo/bar/ C B /foo/bar/xxx/ null C / A C /foo/ B C /foo/bar/ C C /foo/bar/xxx/ null I know that making this change will break a watchdog test but my reading of the spec is that the current behaviour is wrong. A number of users have indicated, via bugzilla, that the current behaviour is causing them problems. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
Mark Thomas wrote: From: Remy Maucherat [mailto:[EMAIL PROTECTED] Mark Thomas wrote: Fixing bug 13040 requires an additional patch that uses equals() for the whole algorithm. Hence the complications. This is what I was discussing above. The matching rule can't be fully implemented AFAIK. I think the current algorithm is a nice compromise. Please give examples where you think it's not good enough (and is worthwhile to support), but you will likely end up breaking other stuff. Consider a server with the following contexts configured: A: / B: /foo/ C: /foo/bar/ Assuming cross-context is enabled, the current behaviour of getContext(String uripath) for different values of uri in each context is as follows: Context uripath result -- A / A A /foo/ B A /foo/bar/ C A /foo/bar/xxx/ C B / A B /foo/ B B /foo/bar/ B B /foo/bar/xxx/ B C / A C /foo/ B C /foo/bar/ C C /foo/bar/xxx/ C The thing that really bothers me about this is how the return from getContext(/foo/bar/) and getContext(/foo/bar/xxx) varies depending on the context from which the call is made. I think this is bad. To quote from the spec: uripath - a String specifying the context path of another web application in the container. My proposal is to change getContext to provide the following behaviour: Context uripath result -- A / A A /foo/ B A /foo/bar/ C A /foo/bar/xxx/ null B / A B /foo/ B B /foo/bar/ C B /foo/bar/xxx/ null C / A C /foo/ B C /foo/bar/ C C /foo/bar/xxx/ null I know that making this change will break a watchdog test but my reading of the spec is that the current behaviour is wrong. Well, this breaks the spec, so this is not acceptable. The getContext method accepts a String which is not the exact context path. For the example above, I've had trouble with the case B - C as well. Thanks for giving it, it makes me remind everything. A number of users have indicated, via bugzilla, that the current behaviour is causing them problems. Yes, but what you propose would cause even more users to come out and complain. A better patch is needed (although I don't quite know how to write it). Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
From: Remy Maucherat [mailto:[EMAIL PROTECTED] My proposal is to change getContext to provide the following behaviour: Context uripath result -- A / A A /foo/ B A /foo/bar/ C A /foo/bar/xxx/ null B / A B /foo/ B B /foo/bar/ C B /foo/bar/xxx/ null C / A C /foo/ B C /foo/bar/ C C /foo/bar/xxx/ null I know that making this change will break a watchdog test but my reading of the spec is that the current behaviour is wrong. Well, this breaks the spec, so this is not acceptable. The getContext method accepts a String which is not the exact context path. How does this break the spec? I have re-read the section on getContext several times and I don't see where it says the that the input to getContext accepts a String which is not the exact context path. Re-quoting the spec: uripath - a String specifying the context path of another web application in the container. I read this to mean an exact match. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
Mark Thomas wrote: Remy, Looking at bug 13040 I did a bugzilla search and came across bug 11411. I am still thinking about bug 13040 but saw that bug 11411 could be fixed (I had previously closed it without looking at the source closely enough) without getting into the equals()/startsWith() debate that is part of bug 13040. In the circumstances where crossContext is false and getContext(/) is called from within the root web application getContext() was returning null rather than the root context. I am guessing I have done something stupid but I cant for the life of me see what it is ;) I suppose your patch merely allows for a shortcut, so it could be acceptable. Rmy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
OK then. Now for the tricky bit. Bug 13040 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13040) highlights a rather knotty problem. Having mulled this over for the last few days I have come to the conclusion that we should be using equals() rather than startsWith() My reasons for this are: - The spec says match which to my mind says equals() - It removes the need for special handling for root - It fixes bug 13040 However, changing this will break anything that assumes that the matching is performed on a startsWith() basis. This is bad. Have we ever received clarification from the spec team in this area? If not could someone point me towards someone who may be able to offer some advice. As I see it there are three ways to deal with this: - ignore it - not an option I like - leave the code as is, closing bug 13040 as WONTFIX with an explantion as to why - make the change Thoughts anyone? Mark From: Remy Maucherat [mailto:[EMAIL PROTECTED] I suppose your patch merely allows for a shortcut, so it could be acceptable. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
Mark Thomas wrote: OK then. Now for the tricky bit. Bug 13040 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13040) highlights a rather knotty problem. Having mulled this over for the last few days I have come to the conclusion that we should be using equals() rather than startsWith() My reasons for this are: - The spec says match which to my mind says equals() - It removes the need for special handling for root - It fixes bug 13040 However, changing this will break anything that assumes that the matching is performed on a startsWith() basis. This is bad. Have we ever received clarification from the spec team in this area? If not could someone point me towards someone who may be able to offer some advice. As I see it there are three ways to deal with this: - ignore it - not an option I like - leave the code as is, closing bug 13040 as WONTFIX with an explantion as to why - make the change Thoughts anyone? The rest of the algorithm will do the startsWith, right ? This is why I said it was a shortcut: it will handle the simple case where / is the parameter. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
From: Remy Maucherat [mailto:[EMAIL PROTECTED] Sent: Friday, April 02, 2004 8:30 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina /core ApplicationContext.java Mark Thomas wrote: OK then. Now for the tricky bit. Bug 13040 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13040) highlights a rather knotty problem. Having mulled this over for the last few days I have come to the conclusion that we should be using equals() rather than startsWith() My reasons for this are: - The spec says match which to my mind says equals() - It removes the need for special handling for root - It fixes bug 13040 However, changing this will break anything that assumes that the matching is performed on a startsWith() basis. This is bad. Have we ever received clarification from the spec team in this area? If not could someone point me towards someone who may be able to offer some advice. As I see it there are three ways to deal with this: - ignore it - not an option I like - leave the code as is, closing bug 13040 as WONTFIX with an explantion as to why - make the change Thoughts anyone? The rest of the algorithm will do the startsWith, right ? This is why I said it was a shortcut: it will handle the simple case where / is the parameter. Fixing bug 13040 requires an additional patch that uses equals() for the whole algorithm. Hence the complications. This is what I was discussing above. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
Mark Thomas wrote: Fixing bug 13040 requires an additional patch that uses equals() for the whole algorithm. Hence the complications. This is what I was discussing above. The matching rule can't be fully implemented AFAIK. I think the current algorithm is a nice compromise. Please give examples where you think it's not good enough (and is worthwhile to support), but you will likely end up breaking other stuff. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
markt 2004/04/01 12:09:21 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Fix getContext(/) so current context is returned if called whilst in the root context - Port from TC5 Revision ChangesPath 1.25 +4 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/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 5 Mar 2004 23:52:55 - 1.24 +++ ApplicationContext.java 1 Apr 2004 20:09:21 - 1.25 @@ -213,9 +213,9 @@ String contextPath = context.getPath(); if (!contextPath.endsWith(/)) contextPath = contextPath + /; -if ((contextPath.length() 1) -((uri.equals(context.getPath())) - || (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]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
[EMAIL PROTECTED] wrote: markt 2004/04/01 12:09:21 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Fix getContext(/) so current context is returned if called whilst in the root context - Port from TC5 I disagree with this patch. Please explain. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
Remy, Looking at bug 13040 I did a bugzilla search and came across bug 11411. I am still thinking about bug 13040 but saw that bug 11411 could be fixed (I had previously closed it without looking at the source closely enough) without getting into the equals()/startsWith() debate that is part of bug 13040. In the circumstances where crossContext is false and getContext(/) is called from within the root web application getContext() was returning null rather than the root context. I am guessing I have done something stupid but I cant for the life of me see what it is ;) Mark -Original Message- From: Remy Maucherat [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 9:47 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina /core ApplicationContext.java [EMAIL PROTECTED] wrote: markt 2004/04/01 12:09:21 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Fix getContext(/) so current context is returned if called whilst in the root context - Port from TC5 I disagree with this patch. Please explain. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationDispatcher.java
remm2004/03/05 15:52:55 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationDispatcher.java Log: - Fix crossContext flag when dispatching back to the original context. - Bug 27478. Revision ChangesPath 1.24 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ApplicationContext.java 27 Feb 2004 14:58:42 - 1.23 +++ ApplicationContext.java 5 Mar 2004 23:52:55 - 1.24 @@ -228,7 +228,7 @@ String mapuri = uri; while (true) { child = (Context) host.findChild(mapuri); -if (context != null) +if (child != null) break; int slash = mapuri.lastIndexOf('/'); if (slash 0) 1.31 +15 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java Index: ApplicationDispatcher.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- ApplicationDispatcher.java27 Feb 2004 14:58:42 - 1.30 +++ ApplicationDispatcher.java5 Mar 2004 23:52:55 - 1.31 @@ -969,8 +969,20 @@ (current instanceof HttpServletRequest)) { // Compute a crossContext flag HttpServletRequest hcurrent = (HttpServletRequest) current; -boolean crossContext = -!(context.getPath().equals(hcurrent.getContextPath())); +boolean crossContext = false; +if ((outerRequest instanceof ApplicationHttpRequest) || +(outerRequest instanceof HttpRequest) || +(outerRequest instanceof HttpServletRequest)) { +HttpServletRequest houterRequest = +(HttpServletRequest) outerRequest; +Object contextPath = houterRequest.getAttribute +(Globals.INCLUDE_CONTEXT_PATH_ATTR); +if (contextPath == null) { +// Forward +contextPath = houterRequest.getContextPath(); +} +crossContext = !(context.getPath().equals(contextPath)); +} wrapper = new ApplicationHttpRequest (hcurrent, context, crossContext); } else { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
luehe 2004/01/26 15:13:51 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Fixed Bugtraq 4873423 by ignoring any (trailing) path params (separated by ;) when attempting to map path passed to ServletContext.getRequestDispatcher(path). For example, with this change, the following path will be correctly mapped to /test.jsp: jsp:forward page=/test.jsp;abcd=xyz/ This is consistent with how CoyoteAdapter has the mapper ignore any path params separated by ; in an initial request URI. Revision ChangesPath 1.22 +22 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/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 24 Nov 2003 21:48:27 - 1.21 +++ ApplicationContext.java 26 Jan 2004 23:13:51 - 1.22 @@ -439,6 +439,8 @@ } else { uriMB.recycle(); } + +// Get query string String queryString = null; int pos = path.indexOf('?'); if (pos = 0) { @@ -446,7 +448,7 @@ } else { pos = path.length(); } - + // Retrieve the thread local mapping data MappingData mappingData = (MappingData) localMappingData.get(); if (mappingData == null) { @@ -458,11 +460,24 @@ CharChunk uriCC = uriMB.getCharChunk(); try { uriCC.append(context.getPath(), 0, context.getPath().length()); -uriCC.append(path, 0, pos); +/* + * Ignore any trailing path params (separated by ';') for mapping + * purposes + */ +int semicolon = path.indexOf(';'); +uriCC.append(path, 0, semicolon 0 ? semicolon : pos); context.getMapper().map(uriMB, mappingData); if (mappingData.wrapper == null) { return (null); } +/* + * Append any trailing path params (separated by ';') that were + * ignored for mapping purposes, so that they're reflected in the + * RequestDispatcher's requestURI + */ +if (semicolon 0) { +uriCC.append(path, semicolon, pos - semicolon); +} } catch (Exception e) { // Should never happen log(sm.getString(applicationContext.mapping.error), e); @@ -474,7 +489,7 @@ String pathInfo = mappingData.pathInfo.toString(); mappingData.recycle(); - + // Construct a RequestDispatcher to process this request return (RequestDispatcher) new ApplicationDispatcher (wrapper, uriCC.toString(), wrapperPath, pathInfo, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
jfarcand2003/11/24 13:48:27 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: When calling ServletContext.log, append the application's name so we know from which application the log is coming. Feel free to revert if it breaks something. Revision ChangesPath 1.21 +7 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ApplicationContext.java 4 Sep 2003 17:45:40 - 1.20 +++ ApplicationContext.java 24 Nov 2003 21:48:27 - 1.21 @@ -665,7 +665,7 @@ Logger logger = context.getLogger(); if (logger != null) -logger.log(message); +logger.log(context.logName() + message); } @@ -683,7 +683,7 @@ Logger logger = context.getLogger(); if (logger != null) -logger.log(exception, message); +logger.log(exception, context.logName() + message); } @@ -698,7 +698,7 @@ Logger logger = context.getLogger(); if (logger != null) -logger.log(message, throwable); +logger.log(context.logName() + message, throwable); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
luehe 2003/09/04 10:45:40 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Get the absolute path to the work dir, so that JARs in /WEB-INF/lib can be found Revision ChangesPath 1.20 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ApplicationContext.java 2 Sep 2003 21:22:04 - 1.19 +++ ApplicationContext.java 4 Sep 2003 17:45:40 - 1.20 @@ -511,7 +511,7 @@ if (context.isFilesystemBased()) { jarFile = new File(basePath, path); } else { -jarFile = new File(context.getWorkDir(), path); +jarFile = new File(context.getWorkPath(), path); } if (jarFile.exists()) { return jarFile.toURL(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationFilterChain.java StandardHostValve.java StandardPipeline.java
remm2003/08/29 16:11:31 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationFilterChain.java StandardHostValve.java StandardPipeline.java Log: - Avoid references leak: ckean up and recycle any TL resources. - Reset the context CL after invoking the pipeline. Revision ChangesPath 1.18 +12 -9 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/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 16 Aug 2003 00:35:32 - 1.17 +++ ApplicationContext.java 29 Aug 2003 23:11:31 - 1.18 @@ -478,8 +478,6 @@ if (mappingData == null) { mappingData = new MappingData(); localMappingData.set(mappingData); -} else { -mappingData.recycle(); } // Map the URI @@ -497,11 +495,16 @@ return (null); } +Wrapper wrapper = (Wrapper) mappingData.wrapper; +String wrapperPath = mappingData.wrapperPath.toString(); +String pathInfo = mappingData.pathInfo.toString(); + +mappingData.recycle(); + // Construct a RequestDispatcher to process this request return (RequestDispatcher) new ApplicationDispatcher -((Wrapper) mappingData.wrapper, uriCC.toString(), - mappingData.wrapperPath.toString(), - mappingData.pathInfo.toString(), queryString, null); +(wrapper, uriCC.toString(), wrapperPath, pathInfo, + queryString, null); } 1.7 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java Index: ApplicationFilterChain.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ApplicationFilterChain.java 25 May 2003 14:27:01 - 1.6 +++ ApplicationFilterChain.java 29 Aug 2003 23:11:31 - 1.7 @@ -343,6 +343,7 @@ n = 0; pos = 0; servlet = null; +support = null; } 1.10 +7 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java Index: StandardHostValve.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- StandardHostValve.java16 Aug 2003 13:43:43 - 1.9 +++ StandardHostValve.java29 Aug 2003 23:11:31 - 1.10 @@ -206,6 +206,9 @@ status(request, response); } +Thread.currentThread().setContextClassLoader +(StandardHostValve.class.getClassLoader()); + } 1.14 +4 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardPipeline.java Index: StandardPipeline.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardPipeline.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- StandardPipeline.java 23 Jul 2003 13:31:59 - 1.13 +++ StandardPipeline.java 29 Aug 2003 23:11:31 - 1.14 @@ -562,6 +562,7 @@ valveContext.set(basic, valves); valveContext.invokeNext(request, response); +valveContext.set(null, null); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
luehe 2003/08/15 17:35:32 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Clone attribute names iterator, to avoid java.lang.ConcurrentModificationException when removing attribute while iterating over attribute names Revision ChangesPath 1.17 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ApplicationContext.java 12 Aug 2003 23:01:36 - 1.16 +++ ApplicationContext.java 16 Aug 2003 00:35:32 - 1.17 @@ -260,7 +260,7 @@ public Enumeration getAttributeNames() { synchronized (attributes) { -return (new Enumerator(attributes.keySet())); +return new Enumerator(attributes.keySet(), true); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
luehe 2003/08/12 16:01:36 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Avoid NPE when ensuring that resource path start with '/' Revision ChangesPath 1.16 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/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 9 Aug 2003 19:04:29 - 1.15 +++ ApplicationContext.java 12 Aug 2003 23:01:36 - 1.16 @@ -520,7 +520,7 @@ public URL getResource(String path) throws MalformedURLException { -if (!path.startsWith(/)) { +if (path == null || !path.startsWith(/)) { throw new MalformedURLException(sm.getString(applicationContext.requestDispatcher.iae, path)); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationDispatcher.java ApplicationHttpRequest.java
remm2003/08/05 06:22:03 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationDispatcher.java ApplicationHttpRequest.java Log: - Fix for three related bugs. - Bug 22013: The wrapped request must actually override getRequestDispatcher. Thanks to Stephane Riviere for the test case. - Bug 4690: Fix for cross context sessions scoping (previously, the visible session would be the one from the context which first recieved the request). - Fix ServletContext.getContext(...) when using the root context. (but the spec should really be modified so that it says that only exact matches of the target context are allowed). Revision ChangesPath 1.14 +7 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/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 12 Jun 2003 22:06:30 - 1.13 +++ ApplicationContext.java 5 Aug 2003 13:22:03 - 1.14 @@ -286,7 +286,9 @@ String contextPath = context.getPath(); if (!contextPath.endsWith(/)) contextPath = contextPath + /; -if ((contextPath.length() 0) (uri.startsWith(contextPath))) { +if ((contextPath.length() 1) +((uri.equals(context.getPath())) + || (uri.startsWith(contextPath { return (this); } 1.22 +13 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java Index: ApplicationDispatcher.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ApplicationDispatcher.java23 Jul 2003 07:51:33 - 1.21 +++ ApplicationDispatcher.java5 Aug 2003 13:22:03 - 1.22 @@ -996,10 +996,16 @@ ServletRequest wrapper = null; if ((current instanceof ApplicationHttpRequest) || (current instanceof HttpRequest) || -(current instanceof HttpServletRequest)) -wrapper = new ApplicationHttpRequest((HttpServletRequest) current); -else +(current instanceof HttpServletRequest)) { +// Compute a crossContext flag +HttpServletRequest hcurrent = (HttpServletRequest) current; +boolean crossContext = +!(context.getPath().equals(hcurrent.getContextPath())); +wrapper = new ApplicationHttpRequest +(hcurrent, context, crossContext); +} else { wrapper = new ApplicationRequest(current); +} if (previous == null) outerRequest = wrapper; else 1.11 +128 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java Index: ApplicationHttpRequest.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ApplicationHttpRequest.java 25 Jun 2003 19:39:09 - 1.10 +++ ApplicationHttpRequest.java 5 Aug 2003 13:22:03 - 1.11 @@ -72,10 +72,16 @@ import java.util.Iterator; import java.util.Set; import java.util.Map; + +import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; +import javax.servlet.http.HttpSession; + +import org.apache.catalina.Context; import org.apache.catalina.Globals; import org.apache.catalina.HttpRequest; +import org.apache.catalina.Session; import org.apache.catalina.util.Enumerator; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.StringManager; @@ -130,9 +136,12 @@ * * @param request The servlet request being wrapped */ -public ApplicationHttpRequest(HttpServletRequest request) { +public ApplicationHttpRequest(HttpServletRequest request, Context context, + boolean crossContext) { super(request); +this.context = context; +this.crossContext = crossContext; setRequest(request); } @@ -142,12 +151,25 @@ /** + * The context for this
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2003/06/12 15:06:30 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Use regular file URLs with everything from /WEB-INF/lib. - I'm not sure this is useful, and will be reverted to rev 1.12 otherwise. Revision ChangesPath 1.13 +32 -15 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ApplicationContext.java 21 May 2003 17:49:03 - 1.12 +++ ApplicationContext.java 12 Jun 2003 22:06:30 - 1.13 @@ -526,19 +526,36 @@ if (path == null) return (null); -DirContext resources = context.getResources(); -if (resources != null) { -String fullPath = context.getName() + path; -String hostName = context.getParent().getName(); -try { -resources.lookup(path); -return new URL -(jndi, null, 0, getJNDIUri(hostName, fullPath), - new DirContextURLStreamHandler(resources)); -} catch (Exception e) { -//e.printStackTrace(); +String libPath = /WEB-INF/lib/; +if ((path.startsWith(libPath)) (path.endsWith(.jar))) { +File jarFile = null; +if (context.isFilesystemBased()) { +jarFile = new File(basePath, path); +} else { +jarFile = new File(context.getWorkDir(), path); +} +if (jarFile.exists()) { +return jarFile.toURL(); +} else { +return null; +} +} else { + +DirContext resources = context.getResources(); +if (resources != null) { +String fullPath = context.getName() + path; +String hostName = context.getParent().getName(); +try { +resources.lookup(path); +return new URL +(jndi, null, 0, getJNDIUri(hostName, fullPath), + new DirContextURLStreamHandler(resources)); +} catch (Exception e) { +// Ignore +} } } + return (null); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationContextFacade.java
jfarcand2003/03/26 10:21:51 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationContextFacade.java Log: Better handle exception: - throw only expected exception - throw RuntimeException if a method throw an unexpected exception Revision ChangesPath 1.10 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ApplicationContext.java 4 Mar 2003 01:57:05 - 1.9 +++ ApplicationContext.java 26 Mar 2003 18:21:50 - 1.10 @@ -467,7 +467,7 @@ throws MalformedURLException { if (!path.startsWith(/)) { -throw new MalformedURLException(sm.getString(applicationContext.requestDispatcher.iae)); +throw new MalformedURLException(sm.getString(applicationContext.requestDispatcher.iae, path)); } path = normalize(path); 1.5 +87 -24 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContextFacade.java Index: ApplicationContextFacade.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContextFacade.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ApplicationContextFacade.java 20 Mar 2003 20:06:37 - 1.4 +++ ApplicationContextFacade.java 26 Mar 2003 18:21:50 - 1.5 @@ -118,7 +118,7 @@ private HashMap objectCache; -private static org.apache.commons.logging.Log log= +private static org.apache.commons.logging.Log sysLog= org.apache.commons.logging.LogFactory.getLog( ApplicationContextFacade.class ); @@ -206,7 +206,14 @@ public URL getResource(String path) throws MalformedURLException { -return (URL)doPrivileged(getResource, new Object[]{path}); +try{ +return (URL)invokeMethod(context, getResource, new Object[]{path}); +}catch(Throwable t){ +if (t instanceof MalformedURLException){ +throw (MalformedURLException)t; +} +return null; +} } @@ -227,7 +234,14 @@ public Servlet getServlet(String name) throws ServletException { - return (Servlet)doPrivileged(getServlet, new Object[]{name}); +try{ +return (Servlet)invokeMethod(context, getServlet, new Object[]{name}); +} catch (Throwable t){ +if (t instanceof ServletException){ +throw (ServletException) t; +} +return null; +} } @@ -301,8 +315,39 @@ } +/** + * Use reflection to invoke the requested method. Cache the method object + * to speed up the process + * @param appContext The AppliationContext object on which the method + * will be invoked + * @param methodName The method to call. + * @param params The arguments passed to the called method. + */ +private Object doPrivileged(ApplicationContext appContext, +final String methodName, +final Object[] params) { +try{ +return invokeMethod(appContext, methodName, params ); +} catch (Throwable t){ +throw new RuntimeException(t.getMessage()); +} + +} + + +/** + * Use reflection to invoke the requested method. Cache the method object + * to speed up the process + * will be invoked + * @param methodName The method to call. + * @param params The arguments passed to the called method. + */ private Object doPrivileged(final String methodName, final Object[] params){ -return doPrivileged(context, methodName,params); +try{ +return invokeMethod(context, methodName, params); +}catch(Throwable t){ +throw new RuntimeException(t.getMessage()); +} } @@ -314,9 +359,11 @@ * @param methodName The method to call. * @param params The arguments passed to the called method. */ -private Object doPrivileged(ApplicationContext appContext, +private Object invokeMethod(ApplicationContext appContext, final String methodName, -
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
jfarcand2003/02/26 10:37:46 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: More missing doPrivilege blocks. Revision ChangesPath 1.8 +97 -16 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ApplicationContext.java 27 Jan 2003 22:19:24 - 1.7 +++ ApplicationContext.java 26 Feb 2003 18:37:43 - 1.8 @@ -133,7 +133,49 @@ public class ApplicationContext implements ServletContext { +protected class PrivilegedGetInitParameter +implements PrivilegedAction { + +private String name; + +PrivilegedGetInitParameter(String name){ +this.name = name; +} + +public Object run(){ +return ((String) parameters.get(name)); +} +} + + +protected class PrivilegedGetInitParameterNames +implements PrivilegedAction { + +PrivilegedGetInitParameterNames(){ +} +public Object run() { +return (new Enumerator(parameters.keySet())); +} +} + +protected class PrivilegedGetNamedDispatcher +implements PrivilegedAction { + +private Wrapper wrapper; +private String name; + +PrivilegedGetNamedDispatcher(Wrapper wrapper, String name) { +this.wrapper = wrapper; +this.name = name; +} + +public Object run() { +return new ApplicationDispatcher(wrapper, null, null, null, name); +} +} + + protected class PrivilegedGetRequestDispatcher implements PrivilegedAction { @@ -422,13 +464,19 @@ * * @param name Name of the initialization parameter to retrieve */ -public String getInitParameter(String name) { +public String getInitParameter(final String name) { mergeParameters(); synchronized (parameters) { -return ((String) parameters.get(name)); +if (System.getSecurityManager() != null){ +PrivilegedGetInitParameter ip = +new PrivilegedGetInitParameter(name); +return (String)AccessController.doPrivileged(ip); + +} else { + return ((String) parameters.get(name)); +} } - } @@ -440,7 +488,13 @@ mergeParameters(); synchronized (parameters) { -return (new Enumerator(parameters.keySet())); +if (System.getSecurityManager() != null){ +PrivilegedGetInitParameterNames pn = +new PrivilegedGetInitParameterNames(); +return (Enumeration)AccessController.doPrivileged(pn); +} else { + return (new Enumerator(parameters.keySet())); +} } } @@ -503,8 +557,17 @@ Wrapper wrapper = (Wrapper) context.findChild(name); if (wrapper == null) return (null); -ApplicationDispatcher dispatcher = - new ApplicationDispatcher(wrapper, null, null, null, name); + +ApplicationDispatcher dispatcher; +if (System.getSecurityManager() != null){ +PrivilegedGetNamedDispatcher nd = +new PrivilegedGetNamedDispatcher(wrapper, name); +dispatcher = (ApplicationDispatcher)AccessController.doPrivileged(nd); +} else { +dispatcher = + new ApplicationDispatcher(wrapper, null, null, null, name); +} + return ((RequestDispatcher) dispatcher); } @@ -745,9 +808,18 @@ * @deprecated As of Java Servlet API 2.1, with no direct replacement. */ public Enumeration getServletNames() { - -return (new Enumerator(empty)); - +if (System.getSecurityManager() != null){ +return (Enumeration)AccessController.doPrivileged( +new PrivilegedAction(){ + +public Object run(){ +return (new Enumerator(empty)); +} +} +); +} else { +return (new Enumerator(empty)); +} } @@ -755,9 +827,18 @@ * @deprecated As of Java Servlet API 2.1, with no direct replacement. */ public
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
amyroh 2003/01/27 14:19:24 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Fix to return MalformedURLException when the path doesn't begin with a /. Bugtraq 4806986. Revision ChangesPath 1.7 +8 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ApplicationContext.java 6 Nov 2002 13:37:03 - 1.6 +++ ApplicationContext.java 27 Jan 2003 22:19:24 - 1.7 @@ -598,6 +598,10 @@ public URL getResource(String path) throws MalformedURLException { +if (!path.startsWith(/)) { +throw new MalformedURLException(sm.getString(applicationContext.requestDispatcher.iae)); +} + path = normalize(path); if (path == null) return (null); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2002/11/06 05:27:54 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Should fix bug 13583. - Normalize request dispatcher path. Revision ChangesPath 1.5 +24 -23 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ApplicationContext.java 23 Oct 2002 19:57:30 - 1.4 +++ ApplicationContext.java 6 Nov 2002 13:27:54 - 1.5 -542,7 +542,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 -1019,26 +1020,26 */ private String normalize(String path) { -String normalized = 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); -} +// 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); +// Return the normalized path that we have completed +return (normalized); } -- 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-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java
remm2002/11/06 05:37:03 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: - Add path normalization for getResource and getResourceAsStream. Revision ChangesPath 1.6 +17 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ApplicationContext.java 6 Nov 2002 13:27:54 - 1.5 +++ ApplicationContext.java 6 Nov 2002 13:37:03 - 1.6 -597,6 +597,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; -636,6 +641,10 */ public InputStream getResourceAsStream(String path) { +path = normalize(path); +if (path == null) +return (null); + DirContext resources = context.getResources(); if (resources != null) { try { -658,6 +667,10 * param path Collection path */ public Set getResourcePaths(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-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java MappingRequest.java
remm2002/09/05 05:06:08 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java MappingRequest.java Log: - Remove references to deprecated components. Revision ChangesPath 1.2 +4 -12 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ApplicationContext.java 18 Jul 2002 16:48:10 - 1.1 +++ ApplicationContext.java 5 Sep 2002 12:06:08 - 1.2 @@ -113,7 +113,6 @@ 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; @@ -152,13 +151,6 @@ public Object run() { HttpRequest request = new MappingRequest (context.getPath(), contextPath + relativeURI, queryString); -/* -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); 1.2 +4 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/MappingRequest.java Index: MappingRequest.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/MappingRequest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MappingRequest.java 18 Jul 2002 16:48:05 - 1.1 +++ MappingRequest.java 5 Sep 2002 12:06:08 - 1.2 @@ -113,7 +113,6 @@ 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; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]