You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2002/05/24 02:42:17 UTC
cvs commit: jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/upload TurbineUploadService.java
jmcnally 02/05/23 17:42:17
Modified: src/services/org/apache/fulcrum/upload
TurbineUploadService.java
Log:
use and expose new method from commons-fileupload
Revision Changes Path
1.9 +41 -7 jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/upload/TurbineUploadService.java
Index: TurbineUploadService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/upload/TurbineUploadService.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TurbineUploadService.java 24 Mar 2002 21:45:11 -0000 1.8
+++ TurbineUploadService.java 24 May 2002 00:42:17 -0000 1.9
@@ -59,6 +59,7 @@
import java.io.OutputStream;
import java.io.File;
import java.util.Map;
+import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Properties;
@@ -92,7 +93,7 @@
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: TurbineUploadService.java,v 1.8 2002/03/24 21:45:11 jmcnally Exp $
+ * @version $Id: TurbineUploadService.java,v 1.9 2002/05/24 00:42:17 jmcnally Exp $
*/
public class TurbineUploadService
extends BaseService
@@ -100,7 +101,10 @@
{
protected Object component;
private boolean automatic;
-
+
+ private int sizeThreshold;
+ private int sizeMax;
+
/**
* Initializes the service.
*
@@ -134,13 +138,15 @@
UploadService.AUTOMATIC_KEY,
UploadService.AUTOMATIC_DEFAULT);
- upload.setSizeMax( getConfiguration().getInt(
+ sizeMax = getConfiguration().getInt(
UploadService.SIZE_MAX_KEY,
- UploadService.SIZE_MAX_DEFAULT) );
+ UploadService.SIZE_MAX_DEFAULT);
+ upload.setSizeMax(sizeMax);
- upload.setSizeThreshold( getConfiguration().getInt(
+ sizeThreshold = getConfiguration().getInt(
UploadService.SIZE_THRESHOLD_KEY,
- UploadService.SIZE_THRESHOLD_DEFAULT) );
+ UploadService.SIZE_THRESHOLD_DEFAULT);
+ upload.setSizeThreshold(sizeThreshold);
upload.setRepositoryPath( getConfiguration().getString(
UploadService.REPOSITORY_KEY,
@@ -211,7 +217,35 @@
try
{
return (ArrayList)
- ((FileUpload)getComponent()).parseRequest(req, path);
+ ((FileUpload)getComponent())
+ .parseRequest(req, sizeThreshold, sizeMax, path);
+ }
+ catch (FileUploadException e)
+ {
+ throw new ServiceException(e);
+ }
+ }
+
+
+ /**
+ * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * compliant <code>multipart/form-data</code> stream.</p>
+ *
+ * @param req The servlet request to be parsed.
+ * @param sizeThreshold the max size in bytes to be stored in memory
+ * @param sizeMax the maximum allowed upload size in bytes
+ * @param path The location where the files should be stored.
+ * @exception ServiceException Problems reading/parsing the
+ * request or storing the uploaded file(s).
+ */
+ public List parseRequest(HttpServletRequest req, int sizeThreshold,
+ int sizeMax, String path)
+ throws ServiceException
+ {
+ try
+ {
+ return ((FileUpload)getComponent())
+ .parseRequest(req, sizeThreshold, sizeMax, path);
}
catch (FileUploadException e)
{
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>