martinc 2002/07/07 16:15:36
Modified: . STATUS
src/share/org/apache/struts/action RequestProcessor.java
src/share/org/apache/struts/tiles
ActionComponentServlet.java
TilesRequestProcessor.java
Log:
Move the unwrapping of MultipartRequestWrapper to doForward() and
doInclude() to centralise handling of this, rather than having it
scattered through the code. Also updated Tiles to do the same thing.
PR: 8732, 7663
Submitted by: Robby Reinicke, Neal Sanche
Revision Changes Path
1.6 +1 -3 jakarta-struts/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/jakarta-struts/STATUS,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- STATUS 7 Jul 2002 22:18:45 -0000 1.5
+++ STATUS 7 Jul 2002 23:15:36 -0000 1.6
@@ -34,8 +34,6 @@
-----------
4170 MaxLengthExceeded doesn't stop file upload
5274 OutOfMemoryError when uploading big files
- 7663 FileUpload example throws exception on JBoss 3.0
- 8732 RequestProcessor doesn't uncast the Request properly
9198 First line feed in text parameters lost
10388 ServletException: Multipart data doesn't start with boundary
1.14 +13 -22
jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java
Index: RequestProcessor.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- RequestProcessor.java 5 Jul 2002 22:09:21 -0000 1.13
+++ RequestProcessor.java 7 Jul 2002 23:15:36 -0000 1.14
@@ -392,11 +392,6 @@
return;
}
- //unwrap the multipart request if there is one
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
-
String uri = RequestUtils.forwardURL(request, forward);
if (forward.getRedirect()) {
response.sendRedirect
@@ -529,11 +524,6 @@
return (true);
}
- // Unwrap the multipart request (if any)
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
-
// Construct a request dispatcher for the specified path
String uri = appConfig.getPrefix() + forward;
@@ -568,11 +558,6 @@
return (true);
}
- // Unwrap the multipart request (if any)
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
-
// Construct a request dispatcher for the specified path
String uri = appConfig.getPrefix() + include;
@@ -937,9 +922,6 @@
log.debug(" Validation failed, returning to '" + input + "'");
}
request.setAttribute(Action.ERROR_KEY, errors);
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
String uri = null;
if (appConfig.getControllerConfig().getInputForward()) {
ForwardConfig forward = mapping.findForward(input);
@@ -964,6 +946,10 @@
HttpServletResponse response)
throws IOException, ServletException
{
+ // Unwrap the multipart request, if there is one.
+ if (request instanceof MultipartRequestWrapper) {
+ request = ((MultipartRequestWrapper) request).getRequest();
+ }
RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
if (rd == null) {
@@ -988,6 +974,11 @@
HttpServletResponse response)
throws IOException, ServletException
{
+ // Unwrap the multipart request, if there is one.
+ if (request instanceof MultipartRequestWrapper) {
+ request = ((MultipartRequestWrapper) request).getRequest();
+ }
+
RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
if (rd == null) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
1.2 +12 -19
jakarta-struts/src/share/org/apache/struts/tiles/ActionComponentServlet.java
Index: ActionComponentServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/ActionComponentServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ActionComponentServlet.java 25 Jun 2002 03:14:49 -0000 1.1
+++ ActionComponentServlet.java 7 Jul 2002 23:15:36 -0000 1.2
@@ -160,7 +160,7 @@
path = request.getContextPath() + path;
response.sendRedirect(response.encodeRedirectURL(path));
} else {
- doForward( path, request, response );
+ doForward(path, request, response);
}
}
@@ -242,11 +242,7 @@
if (debug >= 1)
log(" Validation error(s), redirecting to: " + uri);
request.setAttribute(Action.ERROR_KEY, errors);
- //unwrap the multipart request if there is one
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
- doForward( uri, request, response);
+ doForward(uri, request, response);
return (false);
}
@@ -280,12 +276,8 @@
if (forward == null)
return (true);
- //unwrap the multipart request if there is one
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
// process forward and give Tiles a chance to catch definition names
- doForward( forward, request, response);
+ doForward(forward, request, response);
return (false);
}
@@ -320,12 +312,8 @@
if (include == null)
return (true);
- //unwrap the multipart request if there is one
- if (request instanceof MultipartRequestWrapper) {
- request = ((MultipartRequestWrapper) request).getRequest();
- }
// process forward and give Tiles a chance to catch definition names
- doForward( include, request, response);
+ doForward(include, request, response);
return (false);
}
@@ -434,6 +422,11 @@
internal.getMessage("requestDispatcher", uri));
return;
} // end if
+
+ // Unwrap the multipart request, if there is one.
+ if (request instanceof MultipartRequestWrapper) {
+ request = ((MultipartRequestWrapper) request).getRequest();
+ }
// If request comes from a previous Tile, do an include.
// This allows to insert an action in a Tile.
1.2 +8 -3
jakarta-struts/src/share/org/apache/struts/tiles/TilesRequestProcessor.java
Index: TilesRequestProcessor.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesRequestProcessor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TilesRequestProcessor.java 25 Jun 2002 03:14:49 -0000 1.1
+++ TilesRequestProcessor.java 7 Jul 2002 23:15:36 -0000 1.2
@@ -227,6 +227,11 @@
return;
} // end if
+ // Unwrap the multipart request, if there is one.
+ if (request instanceof MultipartRequestWrapper) {
+ request = ((MultipartRequestWrapper) request).getRequest();
+ }
+
// If request comes from a previous Tile, do an include.
// This allows to insert an action in a Tile.
if( doInclude )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>