You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/12/14 23:13:12 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteAdapter.java
remm 2003/12/14 14:13:12
Modified: catalina/src/share/org/apache/coyote/tomcat5
CoyoteAdapter.java
Log:
- When redirecting, append the query string if not null, to avoid losing query parameters.
- Refactor to use the new postParseRequest processing.
Revision Changes Path
1.15 +25 -15 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java
Index: CoyoteAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- CoyoteAdapter.java 16 Nov 2003 04:19:03 -0000 1.14
+++ CoyoteAdapter.java 14 Dec 2003 22:13:12 -0000 1.15
@@ -198,21 +198,17 @@
}
try {
+
// Parse and set Catalina and configuration specific
// request parameters
- if( !postParseRequest(req, request, res, response) ) {
- return;
- }
- if (!request.getMappingData().redirectPath.isNull()) {
- response.sendRedirect
- (request.getMappingData().redirectPath.toString());
- } else {
+ if ( postParseRequest(req, request, res, response) ) {
// Calling the container
connector.getContainer().invoke(request, response);
}
- response.finishResponse();
+ response.finishResponse();
req.action( ActionCode.ACTION_POST_REQUEST , null);
+
} catch (IOException e) {
;
} catch (Throwable t) {
@@ -233,7 +229,7 @@
* Parse additional request parameters.
*/
protected boolean postParseRequest(Request req, CoyoteRequest request,
- Response res, CoyoteResponse response)
+ Response res, CoyoteResponse response)
throws Exception {
// XXX the processor needs to set a correct scheme and port prior to this point,
// in ajp13 protocols dont make sense to get the port from the connector..
@@ -249,9 +245,9 @@
req.scheme().setString(connector.getScheme());
request.setSecure(connector.getSecure());
}
-
- // FIXME: the code below doesnt belongs to here, this is only have sense
+ // FIXME: the code below doesnt belongs to here,
+ // this is only have sense
// in Http11, not in ajp13..
// At this point the Host header has been processed.
// Override if the proxyPort/proxyHost are set
@@ -309,6 +305,20 @@
request.getMappingData());
request.setContext((Context) request.getMappingData().context);
request.setWrapper((Wrapper) request.getMappingData().wrapper);
+
+ // Possible redirect
+ MessageBytes redirectPathMB = request.getMappingData().redirectPath;
+ if (!redirectPathMB.isNull()) {
+ String redirectPath = redirectPathMB.toString();
+ String query = request.getQueryString();
+ if (query != null) {
+ // This is not optimal, but as this is not very common, it
+ // shouldn't matter
+ redirectPath = redirectPath + "?" + query;
+ }
+ response.sendRedirect(redirectPath);
+ return false;
+ }
// Parse cookies
parseCookies(req, request);
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org