cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
billbarker2004/09/29 23:02:39 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Set the correct query-string on forwards. The parameters are the sum of the forward URI and the request URI, but the query-string is the one from the forward URI according to the spec. This still needs some work to handle the post-request clean-up. Fix for Bug #31474 Reported By: Marc Daniels [EMAIL PROTECTED] Revision ChangesPath 1.29 +7 -5 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- RequestDispatcherImpl.java23 Feb 2004 06:06:13 - 1.28 +++ RequestDispatcherImpl.java30 Sep 2004 06:02:39 - 1.29 @@ -193,7 +193,7 @@ //realRequest.query().recycle(); realRequest.servletPath().recycle(); realRequest.pathInfo().recycle(); -realRequest.setChild(null); + realRequest.setChild(null); // merge query string as specified in specs - before, it may affect // the way the request is handled by special interceptors @@ -201,11 +201,11 @@ // Process existing parameters, if not already done so // ( otherwise we'll process some twice ) realRequest.parameters().handleQueryParameters(); - // Set the query string - the sum of the new one and old one. + // Set the query string - the new one. String oldQS=realRequest.queryString().toString(); - String newQS=(oldQS==null ) ? queryString : queryString + "&" + - oldQS; - realRequest.queryString().setString(newQS); + // String newQS=(oldQS==null ) ? queryString : queryString + "&" + + // oldQS; + realRequest.queryString().setString(queryString); // Process the additional parsm. We don't know if the old // params were processed ( so we need to make sure they are, @@ -215,6 +215,8 @@ child.processParameters( queryString ); //realRequest.parameters().processParameters( queryString ); + } else { + realRequest.queryString().recycle(); } // run the new request through the context manager - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/09/19 20:38:15 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Fix for 3726, reported by [EMAIL PROTECTED] In forward you should be able to set Content-Type and other headers ( this worked fine for normal forward, but not for named dispatchers - same bug is present in 3.2.x ). Revision ChangesPath 1.23 +3 -4 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- RequestDispatcherImpl.java2001/09/17 00:44:55 1.22 +++ RequestDispatcherImpl.java2001/09/20 03:38:15 1.23 @@ -491,10 +491,9 @@ getRealRequest(); Response realResponse = realRequest.getResponse(); - // Set the "included" flag so that things like header setting in the - // included servlet will be correctly ignored - boolean old_included=realResponse.isIncluded(); - if( ! old_included ) realResponse.setIncluded( true ); + // Don't set included #3726 + // boolean old_included=realResponse.isIncluded(); + // if( ! old_included ) realResponse.setIncluded( true ); if( wr!=null) { try {
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/09/16 17:44:55 Modified:.build.xml src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: #2641, thanks Daniele Gaffuri for reporting the bug. Also, removed the (unused) container/tomcat-startup.jar Revision ChangesPath 1.152 +0 -5 jakarta-tomcat/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-tomcat/build.xml,v retrieving revision 1.151 retrieving revision 1.152 diff -u -r1.151 -r1.152 --- build.xml 2001/09/07 04:25:20 1.151 +++ build.xml 2001/09/17 00:44:54 1.152 @@ -387,11 +387,6 @@ - - -
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/08/25 18:47:41 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Another fix for RD, the queryString wasn't updated in the forwarded request. I'm not sure if the query string is a 'path' property, but for consistency I think it must be updated ( including the additional parameters and the old ones ). Revision ChangesPath 1.21 +12 -4 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- RequestDispatcherImpl.java2001/08/25 18:11:12 1.20 +++ RequestDispatcherImpl.java2001/08/26 01:47:41 1.21 @@ -233,11 +233,19 @@ // merge query string as specified in specs - before, it may affect // the way the request is handled by special interceptors if( queryString != null ) { - realRequest.queryString().setString(queryString); - // Append queryString to the request parameters - - // the original request is changed. + // Process existing parameters, if not already done so + // ( otherwise we'll process some twice ) + realRequest.parameters().handleQueryParameters(); + // Set the query string - the sum of the old one and new one. + String oldQS=realRequest.queryString().toString(); + String newQS=(oldQS==null ) ? queryString : oldQS + "&" + + queryString; + realRequest.queryString().setString(newQS); + + // Process the additional parsm. We don't know if the old + // params were processed ( so we need to make sure they are, + // i.e. a known state ). realRequest.parameters().processParameters( queryString ); - // addQueryString( realRequest, queryString ); } // run the new request through the context manager
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/08/25 11:11:12 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Fix for 3162, requestDispatcher.forward must reset PathInfo and the other path related info in the passed request. Revision ChangesPath 1.20 +7 -1 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- RequestDispatcherImpl.java2001/08/21 04:56:44 1.19 +++ RequestDispatcherImpl.java2001/08/25 18:11:12 1.20 @@ -222,12 +222,18 @@ // set the context - no need to fire context parsing again realRequest.setContext( context ); - + realRequest.requestURI().setString( context.getPath() + path ); + // # 3162 + realRequest.unparsedURI().recycle(); + //realRequest.query().recycle(); + realRequest.servletPath().recycle(); + realRequest.pathInfo().recycle(); // merge query string as specified in specs - before, it may affect // the way the request is handled by special interceptors if( queryString != null ) { + realRequest.queryString().setString(queryString); // Append queryString to the request parameters - // the original request is changed. realRequest.parameters().processParameters( queryString );
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/08/20 21:56:44 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Update for the compat fix. Revision ChangesPath 1.19 +2 -2 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- RequestDispatcherImpl.java2001/03/31 21:52:33 1.18 +++ RequestDispatcherImpl.java2001/08/21 04:56:44 1.19 @@ -164,7 +164,7 @@ if( System.getSecurityManager() != null ) { try { forwardAction.prepare( request, response ); - jdk11Compat.doPrivileged( forwardAction ); + jdk11Compat.doPrivileged( forwardAction, jdk11Compat.getAccessControlContext() ); } catch( Exception e) { wrapException( e, null ); } @@ -179,7 +179,7 @@ if( System.getSecurityManager() != null ) { try { includeAction.prepare( request, response ); - jdk11Compat.doPrivileged( includeAction ); + jdk11Compat.doPrivileged( includeAction, jdk11Compat.getAccessControlContext() ); } catch( Exception e) { wrapException( e, null ); }
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/03/31 13:52:34 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Fix for #1112, set parent on the child. Revision ChangesPath 1.18 +1 -0 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- RequestDispatcherImpl.java2001/02/20 03:34:11 1.17 +++ RequestDispatcherImpl.java2001/03/31 21:52:33 1.18 @@ -369,6 +369,7 @@ } Request old_child = realRequest.getChild(); + subRequest.setParent( old_child ); realRequest.setChild( subRequest ); // now it's really strange: we call the wrapper on the subrequest
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/02/10 11:01:57 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: No debug messages in RDI. Revision ChangesPath 1.16 +1 -1 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- RequestDispatcherImpl.java2001/02/06 06:35:55 1.15 +++ RequestDispatcherImpl.java2001/02/10 19:01:57 1.16 @@ -101,7 +101,7 @@ * @author [EMAIL PROTECTED] */ final class RequestDispatcherImpl implements RequestDispatcher { -static final boolean debug=true; +static final boolean debug=false; // Use the strings from core private static StringManager sm = StringManager. getManager("org.apache.tomcat.resources"); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/02/05 22:35:56 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: A bigger change in RequestDispatcherImpl: - the parameter manipulation ( by using access to the internal representation) is removed - Parameters is used to provide merging query parameter and restoring the old parameters ( same mechanism as before - a stack, but no garbage is generated in the common case ). This also includes few changes needed to deal with the exceptions as requested by the spec. Revision ChangesPath 1.15 +156 -229 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- RequestDispatcherImpl.java2001/01/28 19:45:52 1.14 +++ RequestDispatcherImpl.java2001/02/06 06:35:55 1.15 @@ -63,6 +63,7 @@ import org.apache.tomcat.core.*; import org.apache.tomcat.util.StringManager; import org.apache.tomcat.util.compat.*; +import org.apache.tomcat.util.http.*; import java.io.*; import java.util.*; import java.security.*; @@ -100,11 +101,26 @@ * @author [EMAIL PROTECTED] */ final class RequestDispatcherImpl implements RequestDispatcher { +static final boolean debug=true; // Use the strings from core private static StringManager sm = StringManager. getManager("org.apache.tomcat.resources"); + +// Attributes that will be replaced during include +private static final String A_REQUEST_URI= + "javax.servlet.include.request_uri"; +private static final String A_CONTEXT_PATH= + "javax.servlet.include.context_path"; +private static final String A_SERVLET_PATH= + "javax.servlet.include.servlet_path"; +private static final String A_PATH_INFO= + "javax.servlet.include.path_info"; +private static final String A_QUERY_STRING= + "javax.servlet.include.query_string"; + Context context; + // path dispatchers String path; String queryString; @@ -136,6 +152,8 @@ } // Public methods + +// Wrappers for jdk1.2 priviledged actions Jdk11Compat jdk11Compat=Jdk11Compat.getJdkCompat(); RDIAction forwardAction=new RDIAction( this,false); RDIAction includeAction=new RDIAction( this,true); @@ -144,36 +162,34 @@ throws ServletException, IOException { if( System.getSecurityManager() != null ) { -// final ServletRequest req = request; -// final ServletResponse res = response; try { forwardAction.prepare( request, response ); jdk11Compat.doPrivileged( forwardAction ); - -// java.security.AccessController.doPrivileged( -// new java.security.PrivilegedExceptionAction() -// { -// public Object run() throws ServletException, IOException { -// doForward(req,res); -// return null; -// } -// } -// ); -// } catch( PrivilegedActionException pe) { -// Exception e = pe.getException(); } catch( Exception e) { - if( e instanceof ServletException ) - throw (ServletException)e; - if( e instanceof RuntimeException ) - throw (RuntimeException)e; - // can only be IOException - throw (IOException)e; + wrapException( e, null ); } } else { doForward(request,response); } } +public void include(ServletRequest request, ServletResponse response) + throws ServletException, IOException +{ + if( System.getSecurityManager() != null ) { + try { + includeAction.prepare( request, response ); + jdk11Compat.doPrivileged( includeAction ); + } catch( Exception e) { + wrapException( e, null ); + } + } else { + doInclude(request,response); + } +} + +// Actual forward/include impl + private void doForward(ServletRequest request, ServletResponse response) throws ServletException, IOException { @@ -211,8 +227,12 @@ // merge query string as specified in specs - before, it may affect // the way the request is handled by special interceptors - if( queryString != null ) - addQueryString( realRequest, queryString ); +
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/01/25 18:59:55 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Fix typo in method name - most tests are passing under sandbox. Revision ChangesPath 1.13 +1 -19 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- RequestDispatcherImpl.java2001/01/25 05:07:35 1.12 +++ RequestDispatcherImpl.java2001/01/26 02:59:55 1.13 @@ -257,22 +257,9 @@ throws ServletException, IOException { if( System.getSecurityManager() != null ) { -// final ServletRequest req = request; -// final ServletResponse res = response; try { includeAction.prepare( request, response ); jdk11Compat.doPrivileged( includeAction ); - -// java.security.AccessController.doPrivileged( -// new java.security.PrivilegedExceptionAction() -// { -// public Object run() throws ServletException, IOException { -// doInclude(req,res); -// return null; -// } -// } -// ); -// } catch( PrivilegedActionException pe) { } catch( Exception e) { if( e instanceof ServletException ) throw (ServletException)e; @@ -281,11 +268,6 @@ // can only be IOException throw (IOException)e; } -// Exception e = pe.getException(); -// if( e instanceof ServletException ) -// throw (ServletException)e; -// throw (IOException)e; -// } } else { doInclude(request,response); } @@ -637,7 +619,7 @@ this.req=req; this.res=res; } - public Object action() throws Exception { + public Object run() throws Exception { if( include ) rdi.doInclude( req, res ); else - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java
costin 01/01/06 16:08:59 Modified:src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java Log: Bug: RuntimeException should be propagated to the caller ( previous behavior: it was wrapped in a ServletException ) Bug: the included exception was lost ( ServletException(String) instead of ( String, Throwable ). Revision ChangesPath 1.9 +5 -1 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java Index: RequestDispatcherImpl.java === RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- RequestDispatcherImpl.java2000/12/26 22:58:50 1.8 +++ RequestDispatcherImpl.java2001/01/07 00:08:59 1.9 @@ -201,6 +201,8 @@ Exception ex = realResponse.getErrorException(); if ( ex instanceof IOException ) throw (IOException) ex; + if ( ex instanceof RuntimeException ) + throw (RuntimeException) ex; else if ( ex instanceof ServletException ) throw (ServletException) ex; else @@ -363,11 +365,13 @@ Exception ex = realResponse.getErrorException(); if ( ex instanceof IOException ) throw (IOException) ex; + if ( ex instanceof RuntimeException ) + throw (RuntimeException) ex; else if ( ex instanceof ServletException ) throw (ServletException) ex; else throw new ServletException - (sm.getString("dispatcher.includeException", ex)); + (sm.getString("dispatcher.includeException"), ex); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]