You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2012/06/17 17:59:21 UTC
svn commit: r1351114 - in /turbine/fulcrum/trunk/upload: ./
src/java/org/apache/fulcrum/upload/ src/site/ xdocs/
Author: tv
Date: Sun Jun 17 15:59:20 2012
New Revision: 1351114
URL: http://svn.apache.org/viewvc?rev=1351114&view=rev
Log:
Prepare release of RC2
- fix documentation
- fix typos
- fix Javadoc
- update year in NOTICE.txt
Removed:
turbine/fulcrum/trunk/upload/xdocs/properties.xml
Modified:
turbine/fulcrum/trunk/upload/NOTICE.txt
turbine/fulcrum/trunk/upload/pom.xml
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java
turbine/fulcrum/trunk/upload/src/site/site.xml
turbine/fulcrum/trunk/upload/xdocs/changes.xml
turbine/fulcrum/trunk/upload/xdocs/index.xml
Modified: turbine/fulcrum/trunk/upload/NOTICE.txt
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/NOTICE.txt?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/NOTICE.txt (original)
+++ turbine/fulcrum/trunk/upload/NOTICE.txt Sun Jun 17 15:59:20 2012
@@ -1,5 +1,5 @@
Turbine Fulcrum Upload Component
-Copyright 2005-2009 The Apache Software Foundation.
+Copyright 2005-2012 The Apache Software Foundation.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Modified: turbine/fulcrum/trunk/upload/pom.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/pom.xml?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/pom.xml (original)
+++ turbine/fulcrum/trunk/upload/pom.xml Sun Jun 17 15:59:20 2012
@@ -24,7 +24,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>fulcrum-upload</artifactId>
- <version>1.0.6-SNAPSHOT</version>
+ <version>1.0.5-SNAPSHOT</version>
<name>Fulcrum Upload</name>
<inceptionYear>2005</inceptionYear>
<description>Fulcrum Upload Service</description>
@@ -135,7 +135,7 @@
<maven.compile.target>1.5</maven.compile.target>
<!-- This bits are used for the staging directory -->
<fulcrum.release.version>1.0.5</fulcrum.release.version>
- <fulcrum.rc.version>RC1</fulcrum.rc.version>
+ <fulcrum.rc.version>RC2</fulcrum.rc.version>
<fulcrum.deployment.protocol>scpexe</fulcrum.deployment.protocol>
</properties>
Modified: turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java (original)
+++ turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java Sun Jun 17 15:59:20 2012
@@ -54,7 +54,7 @@ import org.apache.commons.fileupload.ser
* type, as specified by RFC 1867. Use {@link
* org.apache.fulcrum.parser.ParameterParser#getFileItems(String)} to
* acquire an array of {@link
- * org.apache.commons.fileupload.FileItem} onjects associated with given
+ * org.apache.commons.fileupload.FileItem} objects associated with given
* html form.
*
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
@@ -114,7 +114,7 @@ public class DefaultUploadService
}
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -128,7 +128,7 @@ public class DefaultUploadService
}
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -143,7 +143,7 @@ public class DefaultUploadService
}
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -161,7 +161,7 @@ public class DefaultUploadService
}
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -171,6 +171,7 @@ public class DefaultUploadService
* @exception ServiceException Problems reading/parsing the
* request or storing the uploaded file(s).
*/
+ @SuppressWarnings("unchecked")
protected List<FileItem> parseRequest(HttpServletRequest req, int sizeMax, DiskFileItemFactory factory)
throws ServiceException
{
@@ -188,6 +189,54 @@ public class DefaultUploadService
}
/**
+ * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
+ * compliant <code>multipart/form-data</code> stream.
+ *
+ * @param req The servlet request to be parsed.
+ *
+ * @return An iterator to instances of <code>FileItemStream</code>
+ * parsed from the request, in the order that they were
+ * transmitted.
+ *
+ * @throws ServiceException if there are problems reading/parsing
+ * the request or storing files. This
+ * may also be a network error while
+ * communicating with the client or a
+ * problem while storing the uploaded
+ * content.
+ */
+ public FileItemIterator getItemIterator(HttpServletRequest req) throws ServiceException
+ {
+ ServletFileUpload upload = new ServletFileUpload();
+ try
+ {
+ return upload.getItemIterator(req);
+ }
+ catch (FileUploadException e)
+ {
+ throw new ServiceException(UploadService.ROLE, e.getMessage(), e);
+ }
+ catch (IOException e)
+ {
+ throw new ServiceException(UploadService.ROLE, e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Utility method that determines whether the request contains multipart
+ * content.
+ *
+ * @param req The servlet request to be evaluated. Must be non-null.
+ *
+ * @return <code>true</code> if the request is multipart;
+ * <code>false</code> otherwise.
+ */
+ public boolean isMultipart(HttpServletRequest req)
+ {
+ return ServletFileUpload.isMultipartContent(req);
+ }
+
+ /**
* @see org.apache.fulcrum.ServiceBroker#getRealPath(String)
*/
private String getRealPath(String path)
@@ -229,6 +278,8 @@ public class DefaultUploadService
}
/**
+ * Avalon component lifecycle method
+ *
* Initializes the service.
*
* This method processes the repository path, to make it relative to the
@@ -251,55 +302,11 @@ public class DefaultUploadService
itemFactory = new DiskFileItemFactory(sizeThreshold, new File(repositoryPath));
}
+ /**
+ * Avalon component lifecycle method
+ */
public void contextualize(Context context) throws ContextException
{
this.applicationRoot = context.get( "urn:avalon:home" ).toString();
}
-
- /**
- * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
- * compliant <code>multipart/form-data</code> stream.
- *
- * @param request The servlet request to be parsed.
- *
- * @return An iterator to instances of <code>FileItemStream</code>
- * parsed from the request, in the order that they were
- * transmitted.
- *
- * @throws ServiceException if there are problems reading/parsing
- * the request or storing files. This
- * may also be a network error while
- * communicating with the client or a
- * problem while storing the uploaded
- * content.
- */
- public FileItemIterator getItemIterator(HttpServletRequest req) throws ServiceException {
- ServletFileUpload upload = new ServletFileUpload();
- try
- {
- return upload.getItemIterator(req);
- }
- catch (FileUploadException e)
- {
- throw new ServiceException(UploadService.ROLE, e.getMessage(), e);
- }
- catch (IOException e)
- {
- throw new ServiceException(UploadService.ROLE, e.getMessage(), e);
- }
- }
-
- /**
- * Utility method that determines whether the request contains multipart
- * content.
- *
- * @param request The servlet request to be evaluated. Must be non-null.
- *
- * @return <code>true</code> if the request is multipart;
- * <code>false</code> otherwise.
- */
- public boolean isMultipart(HttpServletRequest req)
- {
- return ServletFileUpload.isMultipartContent(req);
- }
}
Modified: turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java (original)
+++ turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java Sun Jun 17 15:59:20 2012
@@ -34,7 +34,7 @@ import org.apache.commons.fileupload.Fil
* POST requests and turning them into form fields and uploaded files.
* This can be either performed automatically by the {@link
* org.apache.fulcrum.parser.ParameterParser} or manually by an user
- * definded {@link org.apache.turbine.modules.Action}.
+ * defined {@link org.apache.turbine.modules.Action}.
*
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
@@ -145,7 +145,7 @@ public interface UploadService
String HEADER_ENCODING_DEFAULT = "ISO-8859-1";
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -156,7 +156,7 @@ public interface UploadService
throws ServiceException;
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -168,7 +168,7 @@ public interface UploadService
throws ServiceException;
/**
- * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a>
+ * <p>Parses a <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.</p>
*
* @param req The servlet request to be parsed.
@@ -187,22 +187,22 @@ public interface UploadService
* Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
* compliant <code>multipart/form-data</code> stream.
*
- * @param request The servlet request to be parsed.
+ * @param req The servlet request to be parsed.
*
* @return An iterator to instances of <code>FileItemStream</code>
* parsed from the request, in the order that they were
* transmitted.
*
* @throws ServiceException if there are problems reading/parsing
- * the request or storing files. This
- * may also be a network error while
- * communicating with the client or a
- * problem while storing the uploaded
+ * the request or storing files. This
+ * may also be a network error while
+ * communicating with the client or a
+ * problem while storing the uploaded
* content.
*/
FileItemIterator getItemIterator(HttpServletRequest req) throws ServiceException;
-
-
+
+
/**
* <p> Retrieves the value of <code>size.max</code> property of the
* {@link org.apache.fulcrum.upload.UploadService}.
@@ -239,11 +239,11 @@ public interface UploadService
* Utility method that determines whether the request contains multipart
* content.
*
- * @param request The servlet request to be evaluated. Must be non-null.
+ * @param req The servlet request to be evaluated. Must be non-null.
*
* @return <code>true</code> if the request is multipart;
* <code>false</code> otherwise.
- */
+ */
boolean isMultipart(HttpServletRequest req);
-
+
}
Modified: turbine/fulcrum/trunk/upload/src/site/site.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/src/site/site.xml?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/src/site/site.xml (original)
+++ turbine/fulcrum/trunk/upload/src/site/site.xml Sun Jun 17 15:59:20 2012
@@ -24,7 +24,6 @@
<body>
<menu name="Overview">
<item name="Main" href="/index.html"/>
- <item name="Properties" href="/properties.html" />
</menu>
</body>
</project>
Modified: turbine/fulcrum/trunk/upload/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/xdocs/changes.xml?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/xdocs/changes.xml (original)
+++ turbine/fulcrum/trunk/upload/xdocs/changes.xml Sun Jun 17 15:59:20 2012
@@ -24,7 +24,10 @@
</properties>
<body>
- <release version="1.0.5" date="2012-05-11">
+ <release version="1.0.5" date="2012-06-17">
+ <action dev="tv" type="update">
+ Cleanup documentation
+ </action>
<action dev="ludwig" type="update">
Add methods to use the streaming API
</action>
Modified: turbine/fulcrum/trunk/upload/xdocs/index.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/xdocs/index.xml?rev=1351114&r1=1351113&r2=1351114&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/xdocs/index.xml (original)
+++ turbine/fulcrum/trunk/upload/xdocs/index.xml Sun Jun 17 15:59:20 2012
@@ -39,45 +39,68 @@ specified location on the file system.
</p>
</section>
-<section name="Configuration">
-
- <p>
- First, here is the role configuration.
- </p>
-
- <source>
- <![CDATA[
- <role
- name="org.apache.fulcrum.upload.UploadService"
- shorthand="upload"
- default-class="org.apache.fulcrum.upload.DefaultUploadService"/>
- ]]>
- </source>
-
- <p>
- And here is the configuration:
- </p>
- <source>
-
- <![CDATA[
- <upload repository="target" sizeMax="1048576" sizeThreshold="10240" headerEncoding="UTF-8"/>
- ]]>
- </source>
-<p>
-repository is the directory where files will be temporarily stored (default is ".").
-On Win32 file systems an entry of the form <code>f:\path\to\upload\repository</code>
-is most likely necessary.
-</p>
-<p>
-sizeMax is the maximum size of a request that will be processed (default is 1048576 bytes).
-</p>
-<p>
-sizeThreshold is the maximum size of a request that will have it's elements cached in memory (default is 10240 bytes).
-</p>
-<p>
-headerEncoding is used to specify how the headers are encoded (default is "ISO-8859-1").
-</p>
-
+ <section name="Configuration">
+ <subsection name="Role Configuration">
+ <source><![CDATA[
+<role
+ name="org.apache.fulcrum.upload.UploadService"
+ shorthand="upload"
+ default-class="org.apache.fulcrum.upload.DefaultUploadService"/>
+ ]]></source>
+ </subsection>
+
+ <subsection name="Component Configuration">
+ <table>
+ <tr>
+ <th>Item</th>
+ <th>Datatype</th>
+ <th>Cardinality</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>repository</td>
+ <td>String</td>
+ <td>[0|1]</td>
+ <td>
+ The directory where files will be temporarily stored (default is ".").
+ On Win32 file systems an entry of the form
+ <code>f:\path\to\upload\repository</code> is most likely necessary.
+ </td>
+ </tr>
+ <tr>
+ <td>sizeMax</td>
+ <td>Integer</td>
+ <td>[0|1]</td>
+ <td>
+ The maximum size of a request that will be processed
+ (default is 1048576 bytes).
+ </td>
+ </tr>
+ <tr>
+ <td>sizeThreshold</td>
+ <td>Integer</td>
+ <td>[0|1]</td>
+ <td>
+ The maximum size of a request that will have it's elements cached in
+ memory (default is 10240 bytes).
+ </td>
+ </tr>
+ <tr>
+ <td>headerEncoding</td>
+ <td>String</td>
+ <td>[0|1]</td>
+ <td>
+ Used to specify how the headers are encoded (default is "ISO-8859-1").
+ </td>
+ </tr>
+ </table>
+ </subsection>
+
+ <subsection name="Component Configuration Example">
+ <source><![CDATA[
+<upload repository="target" sizeMax="1048576" sizeThreshold="10240" headerEncoding="UTF-8"/>
+ ]]></source>
+ </subsection>
</section>
<section name="Usage">
@@ -87,13 +110,11 @@ Create an HTML form of the type:
</p>
<source test=""><![CDATA[
-
<form enctype="multipart/form-data" method="POST">
-<input type="hidden" name="action" value="UploadExample" />
-<input type="file" name="filename">
-<input type="submit" value="upload" />
+ <input type="hidden" name="action" value="UploadExample" />
+ <input type="file" name="filename">
+ <input type="submit" value="upload" />
</form>
-
]]></source>
<p>
@@ -107,8 +128,8 @@ Typically a request would be parsed usin
but you can achieve this manually thus:
</p>
<source test=""><![CDATA[
- UploadService us = (UploadService) this.lookup(UploadService.ROLE);
- List fileItems = us.parse(request);
+UploadService us = (UploadService) this.lookup(UploadService.ROLE);
+List fileItems = us.parse(request);
]]></source>
<p>