Revision: 372
Author: tfenne
Date: 2006-08-12 04:27:58 -0700 (Sat, 12 Aug 2006)
ViewCVS: http://svn.sourceforge.net/stripes/?rev=372&view=rev
Log Message:
-----------
A little refactoring so that it's easier to override and avoid the construction
of a multi-part request when in an environment with another filter that's
consuming the request stream.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java
===================================================================
---
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java
2006-08-11 12:06:16 UTC (rev 371)
+++
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java
2006-08-12 11:27:58 UTC (rev 372)
@@ -102,15 +102,30 @@
int maxTotalPostSize) throws
StripesServletException {
super(request);
+ String contentType = request.getContentType();
+ if (contentType != null &&
contentType.startsWith("multipart/form-data")) {
+ constructMultipartRequest(request, pathToTempDir,
maxTotalPostSize);
+ }
+ }
+
+ /**
+ * Responsible for constructing the MultipartRequest object and setting it
on to
+ * the instnace variable 'multipart'.
+ *
+ * @param request the HttpServletRequest to wrap
+ * @param pathToTempDir the path to a temporary directory in which to
store files during upload
+ * @param maxTotalPostSize a limit on how much can be uploaded in a single
request. Note that
+ * this is not a file size limit, but a post size limit.
+ * @throws StripesServletException if any other error occurs constructing
the wrapper
+ */
+ protected void constructMultipartRequest(HttpServletRequest request,
+ String pathToTempDir,
+ int maxTotalPostSize) throws
StripesServletException {
try {
- String contentType = request.getContentType();
-
- if (contentType != null &&
contentType.startsWith("multipart/form-data")) {
- this.multipart = new MultipartRequest(request,
- pathToTempDir,
- maxTotalPostSize,
-
request.getCharacterEncoding());
- }
+ this.multipart = new MultipartRequest(request,
+ pathToTempDir,
+ maxTotalPostSize,
+
request.getCharacterEncoding());
}
catch (IOException e) {
Matcher matcher = exceptionPattern.matcher(e.getMessage());
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development