You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2007/06/16 18:34:07 UTC
svn commit: r547949 [1/2] - in /tapestry/tapestry5/trunk/tapestry-upload: ./
src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/tapestry/
src/main/java/org/apache/tapestry/upload/ src/main/java/org/apach...
Author: hlship
Date: Sat Jun 16 09:34:04 2007
New Revision: 547949
URL: http://svn.apache.org/viewvc?view=rev&rev=547949
Log:
TAPESTRY-1354: Implement a file upload component
Added:
tapestry/tapestry5/trunk/tapestry-upload/LICENSE-2.0.txt
tapestry/tapestry5/trunk/tapestry-upload/NOTICE.txt
tapestry/tapestry5/trunk/tapestry-upload/pom.xml
tapestry/tapestry5/trunk/tapestry-upload/src/
tapestry/tapestry5/trunk/tapestry-upload/src/main/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/fileupload/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/multipart/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoder.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoderImpl.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartServletRequestFilter.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadMessages.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadModule.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadSymbols.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFile.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFileItem.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/
tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/UploadStrings.properties (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/site/
tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/
tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/index.apt (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/
tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/
tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/jdstyle.css (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/site.css (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/site/site.xml (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/
tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/
tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/testng.xml (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/webdefault.xml (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/data/
tapestry/tapestry5/trunk/tapestry-upload/src/test/data/upload.txt (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/StubValidationDecorator.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/UploadIntegrationTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/multipart/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartDecoderImplTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartServletRequestFilterTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParameterValueTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapperTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/StubFileItem.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/UploadedFileItemTest.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/Start.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/
tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/
tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/
tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/Start.html (with props)
tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/web.xml (with props)
Modified:
tapestry/tapestry5/trunk/tapestry-upload/ (props changed)
Propchange: tapestry/tapestry5/trunk/tapestry-upload/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jun 16 09:34:04 2007
@@ -0,0 +1,5 @@
+target
+null
+bin
+cobertura.ser
+temp-testng-customsuite.xml
Added: tapestry/tapestry5/trunk/tapestry-upload/LICENSE-2.0.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/LICENSE-2.0.txt?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/LICENSE-2.0.txt (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/LICENSE-2.0.txt Sat Jun 16 09:34:04 2007
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Added: tapestry/tapestry5/trunk/tapestry-upload/NOTICE.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/NOTICE.txt?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/NOTICE.txt (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/NOTICE.txt Sat Jun 16 09:34:04 2007
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: tapestry/tapestry5/trunk/tapestry-upload/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/pom.xml?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/pom.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/pom.xml Sat Jun 16 09:34:04 2007
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-upload</artifactId>
+ <name>Tapestry-File Upload Library</name>
+ <packaging>jar</packaging>
+ <description>Provides a file upload component for Tapestry.</description>
+ <parent>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-project</artifactId>
+ <version>5.0.5-SNAPSHOT</version>
+ <!-- Fix to point at Tapestry-Project -->
+ <relativePath>../tapestry-project/pom.xml</relativePath>
+ </parent>
+ <inceptionYear>2007</inceptionYear>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ </plugin>
+ <!-- This gets the plugin to clean up the cobertura.ser file left
+ in the root directory. -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>${cobertura-plugin-version}</version>
+ <executions>
+ <execution>
+ <id>clean</id>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Tapestry-Module-Classes>org.apache.tapestry.upload.UploadModule</Tapestry-Module-Classes>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <!--
+ <tags>
+ <tag>
+ <name>todo</name>
+ <!- - Should be a combinaison of the letters Xaoptcmf - ->
+ <placement>a</placement>
+ <head>To do something:</head>
+ </tag>
+ </tags> -->
+ <linksource>true</linksource>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
+ <link>http://tapestry.apache.org/tapestry5/tapestry-ioc/apidocs/</link>
+ <link>http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/</link>
+ </links>
+ <stylesheetfile>${basedir}/src/site/resources/css/jdstyle.css</stylesheetfile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>${cobertura-plugin-version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-component-report</artifactId>
+ <version>5.0.4</version>
+ <configuration>
+ <rootPackage>org.apache.tapestry.upload</rootPackage>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,159 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.components;
+
+import java.util.Locale;
+
+import org.apache.tapestry.Binding;
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.FieldValidator;
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.ValidationException;
+import org.apache.tapestry.ValidationTracker;
+import org.apache.tapestry.annotations.Environmental;
+import org.apache.tapestry.annotations.Inject;
+import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.corelib.base.AbstractField;
+import org.apache.tapestry.services.FieldValidatorDefaultSource;
+import org.apache.tapestry.services.FormSupport;
+import org.apache.tapestry.upload.services.MultipartDecoder;
+import org.apache.tapestry.upload.services.UploadedFile;
+
+/**
+ * A component to upload a file.
+ */
+public class Upload extends AbstractField
+{
+ public static final String MULTIPART_ENCTYPE = "multipart/form-data";
+
+ /**
+ * The uploaded file. Note: This is only guaranteed to be valid while processing the form
+ * submission. Subsequently the content may have been cleaned up.
+ */
+ @Parameter(required = true, principal = true)
+ private UploadedFile _value;
+
+ /**
+ * The object that will peform input validation. The "validate:" binding prefix is generally
+ * used to provide this object in a declarative fashion.
+ */
+ @Parameter(defaultPrefix = "validate")
+ @SuppressWarnings("unchecked")
+ private FieldValidator<Object> _validate = NOOP_VALIDATOR;
+
+ @Environmental
+ private ValidationTracker _tracker;
+
+ @Inject
+ private MultipartDecoder _decoder;
+
+ @Environmental
+ private FormSupport _formSupport;
+
+ @Inject
+ private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
+
+ @Inject
+ private ComponentResources _resources;
+
+ @Inject
+ private Locale _locale;
+
+ /**
+ * Computes a default value for the "validate" parameter using
+ * {@link FieldValidatorDefaultSource}.
+ */
+ final FieldValidator defaultValidate()
+ {
+ Class type = _resources.getBoundType("value");
+
+ if (type == null) return null;
+
+ return _fieldValidatorDefaultSource.createDefaultValidator(
+ this,
+ _resources.getId(),
+ _resources.getContainerMessages(),
+ _locale,
+ type,
+ _resources.getAnnotationProvider("value"));
+ }
+
+ public Upload()
+ {
+ }
+
+ // For testing
+ Upload(UploadedFile value, FieldValidator<Object> validate, MultipartDecoder decoder,
+ ValidationTracker tracker)
+ {
+ _value = value;
+ if (validate != null) _validate = validate;
+ _decoder = decoder;
+ _tracker = tracker;
+ }
+
+ protected void processSubmission(FormSupport formSupport, String elementName)
+ {
+ UploadedFile uploaded = _decoder.getFileUpload(elementName);
+
+ if (uploaded != null)
+ {
+ if (uploaded.getFileName() == null || uploaded.getFileName().length() == 0)
+ uploaded = null;
+ }
+
+ try
+ {
+ _validate.validate(uploaded);
+ }
+ catch (ValidationException ex)
+ {
+ _tracker.recordError(this, ex.getMessage());
+ }
+
+ _value = uploaded;
+ }
+
+ /**
+ * Render the upload tags.
+ *
+ * @param writer
+ * Writer to output markup
+ */
+ protected void beginRender(MarkupWriter writer)
+ {
+ _formSupport.setEncodingType(MULTIPART_ENCTYPE);
+
+ writer.element("input", "type", "file", "name", getElementName(), "id", getClientId());
+
+ _validate.render(writer);
+ getValidationDecorator().insideField(this);
+ }
+
+ public void afterRender(MarkupWriter writer)
+ {
+ writer.end();
+ }
+
+ public UploadedFile getValue()
+ {
+ return _value;
+ }
+
+ Binding defaultValue()
+ {
+ return createDefaultParameterBinding("value");
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/components/Upload.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoder.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoder.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoder.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,42 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.upload.services;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Responsible for detecting and processing file upload requests, using Jakarta Commons FileUpload.
+ * Implementations of this service typically use the threaded service lifecycle model.
+ */
+public interface MultipartDecoder
+{
+
+ /**
+ * @param parameterName
+ * Name of the query parameter associated with the uploaded file
+ * @return a file upload with the given name, or null if no such file upload was in the request.
+ */
+ UploadedFile getFileUpload(String parameterName);
+
+ /**
+ * Decodes the request, returning a new {@link javax.servlet.http.HttpServletRequest}
+ * implementation that will allow access to the form fields submitted in the request (but omits
+ * uploaded files).
+ *
+ * @param request
+ * The incoming servlet request
+ * @return decoded http request
+ */
+ HttpServletRequest decode(HttpServletRequest request);
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoder.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoderImpl.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoderImpl.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoderImpl.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,128 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.tapestry.ioc.services.ThreadCleanupListener;
+
+/**
+ * Implementation of multipart decoder for servlets.
+ */
+class MultipartDecoderImpl implements MultipartDecoder, ThreadCleanupListener
+{
+ private final Map<String, UploadedFileItem> _uploads = newMap();
+
+ private final String _repositoryLocation;
+
+ private final int _repositoryThreshold;
+
+ private final long _maxRequestSize ;
+
+ private final long _maxFileSize;
+
+ public MultipartDecoderImpl(String repositoryLocation, int repositoryThreshold, long maxRequestSize, long maxFileSize)
+ {
+ _repositoryLocation = repositoryLocation;
+ _repositoryThreshold = repositoryThreshold;
+ _maxRequestSize = maxRequestSize;
+ _maxFileSize = maxFileSize;
+ }
+
+ public UploadedFile getFileUpload(String parameterName)
+ {
+ return _uploads.get(parameterName);
+ }
+
+ public HttpServletRequest decode(HttpServletRequest request)
+ {
+ // String encoding = request.getCharacterEncoding();
+ List<FileItem> fileItems = parseRequest(request);
+ return processFileItems(request, fileItems);
+ }
+
+ public void threadDidCleanup()
+ {
+ for (UploadedFileItem uploaded : _uploads.values())
+ {
+ uploaded.cleanup();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<FileItem> parseRequest(HttpServletRequest request)
+ {
+ try
+ {
+ return createFileUpload().parseRequest(request);
+ }
+ catch (FileUploadException e)
+ {
+ throw new RuntimeException(UploadMessages.unableToDecode(), e);
+ }
+ }
+
+ protected ServletFileUpload createFileUpload()
+ {
+ FileItemFactory factory = new DiskFileItemFactory(_repositoryThreshold, new File(
+ _repositoryLocation));
+ ServletFileUpload upload = new ServletFileUpload(factory);
+
+ // set maximum file upload size
+ upload.setSizeMax(_maxRequestSize);
+ upload.setFileSizeMax(_maxFileSize);
+
+ return upload;
+ }
+
+ protected HttpServletRequest processFileItems(HttpServletRequest request,
+ List<FileItem> fileItems)
+ {
+ if (fileItems == null || fileItems.isEmpty()) { return request; }
+
+ ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+
+ for (FileItem item : fileItems)
+ {
+ if (item.isFormField())
+ {
+ wrapper.addParameter(item.getFieldName(), item.getString());
+ }
+ else
+ {
+ wrapper.addParameter(item.getFieldName(), item.getName());
+ addUploadedFile(item.getFieldName(), new UploadedFileItem(item));
+ }
+ }
+
+ return wrapper;
+ }
+
+ protected void addUploadedFile(String name, UploadedFileItem file)
+ {
+ _uploads.put(name, file);
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartDecoderImpl.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartServletRequestFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartServletRequestFilter.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartServletRequestFilter.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartServletRequestFilter.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,45 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.tapestry.services.HttpServletRequestFilter;
+import org.apache.tapestry.services.HttpServletRequestHandler;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * Filter that decodes an incoming multipart request.
+ */
+public class MultipartServletRequestFilter implements HttpServletRequestFilter
+{
+ private final MultipartDecoder _decoder;
+
+ public MultipartServletRequestFilter(MultipartDecoder multipartDecoder)
+ {
+ _decoder = multipartDecoder;
+ }
+
+ public boolean service(HttpServletRequest request, HttpServletResponse response,
+ HttpServletRequestHandler handler) throws IOException
+ {
+ if (ServletFileUpload.isMultipartContent(request)) request = _decoder.decode(request);
+
+ return handler.service(request, response);
+ }
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/MultipartServletRequestFilter.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,79 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
+
+import java.util.List;
+
+/**
+ * Holds single or multivalued values.
+ */
+public class ParameterValue
+{
+ private final List<String> _values = newList();
+
+ public static final ParameterValue NULL = new ParameterValue()
+ {
+ public String single()
+ {
+ return null;
+ }
+
+ public String[] multi()
+ {
+ return null;
+ }
+ };
+
+ public ParameterValue(String value)
+ {
+ _values.add(value);
+ }
+
+ public ParameterValue(String... values)
+ {
+ for (String v : values)
+ {
+ add(v);
+ }
+ }
+
+ /**
+ * @return Single value of parameter (or first value if there are multiple values)
+ */
+ public String single()
+ {
+ return _values.get(0);
+ }
+
+ /**
+ * @return All values of parameter
+ */
+ public String[] multi()
+ {
+ return _values.toArray(new String[_values.size()]);
+ }
+
+ public void add(String value)
+ {
+ _values.add(value);
+ }
+
+ public boolean isMulti()
+ {
+ return _values.size() > 1;
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParameterValue.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,88 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * Wrapper for HttpServletRequest that overrides the parameter methods of the wrapped request. i.e.
+ * parameters are retreived from the wrapper rather than the real request.
+ */
+public class ParametersServletRequestWrapper extends HttpServletRequestWrapper
+{
+ private final Map<String, ParameterValue> _parameters = newMap();
+
+ public ParametersServletRequestWrapper(HttpServletRequest httpServletRequest)
+ {
+ super(httpServletRequest);
+ }
+
+ public String getParameter(String name)
+ {
+ return getValueFor(name).single();
+ }
+
+ public Map<String, Object> getParameterMap()
+ {
+ Map<String, Object> paramMap = newMap();
+
+ for (Map.Entry<String, ParameterValue> e : _parameters.entrySet())
+ {
+ ParameterValue value = e.getValue();
+
+ paramMap.put(e.getKey(), value.isMulti() ? value.multi() : value.single());
+ }
+
+ return paramMap;
+ }
+
+ public Enumeration getParameterNames()
+ {
+ return Collections.enumeration(_parameters.keySet());
+ }
+
+ public String[] getParameterValues(String name)
+ {
+ return getValueFor(name).multi();
+ }
+
+ public void addParameter(String name, String value)
+ {
+ ParameterValue pv = _parameters.get(name);
+ if (pv == null)
+ {
+ pv = new ParameterValue(value);
+ _parameters.put(name, pv);
+ }
+ else
+ {
+ pv.add(value);
+ }
+ }
+
+ ParameterValue getValueFor(String name)
+ {
+ ParameterValue value = _parameters.get(name);
+
+ return value == null ? ParameterValue.NULL : value;
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapper.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadMessages.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadMessages.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadMessages.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,61 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.internal.util.MessagesImpl;
+
+import java.io.File;
+
+class UploadMessages
+{
+ private static final Messages MESSAGES = MessagesImpl.forClass(UploadMessages.class);
+
+ static String unableToDecode()
+ {
+ return MESSAGES.format("unable-to-decode");
+ }
+
+ static String unsupportedEncoding(String encoding)
+ {
+ return MESSAGES.format("unsupported-encoding", encoding);
+ }
+
+ static String unableToOpenContentFile(UploadedFile item)
+ {
+ return MESSAGES.format("unable-to-open-content-file", item.getFilePath());
+ }
+
+ static String writeFailure(File file)
+ {
+ return MESSAGES.format("write-failure", file);
+ }
+
+ static String unableToCreateTempFile()
+ {
+ return MESSAGES.get("unable-to-create-temp-file");
+ }
+
+ static String encloseUploadInForm()
+ {
+ return MESSAGES.get("enclose-upload-in-form");
+ }
+
+ static String encodingTypeAlreadySet(String formId, String requiredEncType,
+ String existingEncType)
+ {
+ return MESSAGES.format("enctype-already-set", formId, requiredEncType, existingEncType);
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadMessages.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadModule.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadModule.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,104 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.io.FileCleaner;
+import org.apache.tapestry.ioc.Configuration;
+import org.apache.tapestry.ioc.MappedConfiguration;
+import org.apache.tapestry.ioc.OrderedConfiguration;
+import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.ioc.annotations.Scope;
+import org.apache.tapestry.ioc.annotations.Symbol;
+import org.apache.tapestry.ioc.services.RegistryShutdownHub;
+import org.apache.tapestry.ioc.services.RegistryShutdownListener;
+import org.apache.tapestry.ioc.services.SymbolSource;
+import org.apache.tapestry.ioc.services.ThreadCleanupHub;
+import org.apache.tapestry.services.HttpServletRequestFilter;
+import org.apache.tapestry.services.LibraryMapping;
+
+public class UploadModule
+{
+ private static boolean _shutdownListenerSet;
+
+ public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration)
+ {
+ // Add the component to the "core" library.
+
+ configuration.add(new LibraryMapping("core", "org.apache.tapestry.upload"));
+ }
+
+ @Scope("perthread")
+ public synchronized static MultipartDecoder buildMultipartDecoder(
+ ThreadCleanupHub threadCleanupHub,
+
+ RegistryShutdownHub shutdownHub,
+
+ @Inject
+ @Symbol(UploadSymbols.REPOSITORY_LOCATION)
+ String repositoryPath,
+
+ @Symbol(UploadSymbols.REPOSITORY_THRESHOLD)
+ int repositoryThreshold,
+
+ @Symbol(UploadSymbols.REQUESTSIZE_MAX)
+ long maxRequestSize,
+
+ @Symbol(UploadSymbols.FILESIZE_MAX)
+ long maxFileSize,
+
+ SymbolSource symbolSource)
+ {
+ MultipartDecoderImpl multipartDecoder = new MultipartDecoderImpl(repositoryPath,
+ repositoryThreshold, maxRequestSize, maxFileSize);
+
+ // This is proabably overkill since the FileCleaner should catch temporary files, but lets
+ // be safe.
+ threadCleanupHub.addThreadCleanupListener(multipartDecoder);
+
+ if (_shutdownListenerSet)
+ {
+ shutdownHub.addRegistryShutdownListener(new RegistryShutdownListener()
+ {
+ public void registryDidShutdown()
+ {
+ FileCleaner.exitWhenFinished();
+ }
+ });
+
+ _shutdownListenerSet = true;
+ }
+
+ return multipartDecoder;
+ }
+
+ public static void contributeHttpServletRequestHandler(
+ OrderedConfiguration<HttpServletRequestFilter> configuration,
+ MultipartDecoder multipartDecoder)
+ {
+ configuration.add("MultipartFilter", new MultipartServletRequestFilter(multipartDecoder));
+ }
+
+ public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
+ {
+ configuration.add(UploadSymbols.REPOSITORY_THRESHOLD, Integer
+ .toString(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD));
+ configuration.add(UploadSymbols.REPOSITORY_LOCATION, System.getProperty("java.io.tmpdir"));
+ // No limit
+ configuration.add(UploadSymbols.REQUESTSIZE_MAX, "-1");
+ // No limit
+ configuration.add(UploadSymbols.FILESIZE_MAX, "-1");
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadModule.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadSymbols.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadSymbols.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadSymbols.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadSymbols.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,46 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+/**
+ * Configuration symbols.
+ */
+public final class UploadSymbols
+{
+ /**
+ * Location where temporary files will be written. Defaults to java.io.tmpdir property
+ */
+ public static final String REPOSITORY_LOCATION = "upload.repository-location";
+
+ /**
+ * Threshold (in bytes) that determines when an uploaded file will be written to the repository
+ */
+ public static final String REPOSITORY_THRESHOLD = "upload.repository-threshold";
+
+ /**
+ * Maximum size (in bytes) of a single upload request Defaults to -1 ( no limit)
+ */
+ public static final String REQUESTSIZE_MAX = "upload.requestsize-max";
+
+ /**
+ * Maximum size (in bytes) of a single file within an upload request Defaults to -1 ( no limit)
+ */
+ public static final String FILESIZE_MAX = "upload.filesize-max";
+
+ private UploadSymbols()
+ {
+ }
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadSymbols.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFile.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFile.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFile.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFile.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,66 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.tapestry.upload.components.Upload;
+
+/**
+ * Represents an uploaded file.
+ *
+ * @see Upload
+ */
+public interface UploadedFile
+{
+ /**
+ * @return the MIME type specified when the file was uploaded.
+ */
+ String getContentType();
+
+ /**
+ * @return the name of the file that was uploaded.
+ */
+ String getFileName();
+
+ /**
+ * @return the complete path, as reported by the client browser.
+ */
+ String getFilePath();
+
+ /**
+ * @return the size, in bytes, of the uploaded content.
+ */
+ long getSize();
+
+ /**
+ * @return an input stream of the content of the file.
+ */
+ InputStream getStream();
+
+ /**
+ * @return true if the uploaded content is in memory.
+ */
+ boolean isInMemory();
+
+ /**
+ * Writes the content of the file to a known location.
+ *
+ * @param file
+ * Location to write file to
+ */
+ void write(File file);
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFile.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFileItem.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFileItem.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFileItem.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFileItem.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,89 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.io.FilenameUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Implentation of {@link UploadedFile} for FileItems.
+ */
+public class UploadedFileItem implements UploadedFile
+{
+ private final FileItem _item;
+
+ public UploadedFileItem(FileItem item)
+ {
+ _item = item;
+ }
+
+ public String getContentType()
+ {
+ return _item.getContentType();
+ }
+
+ public String getFileName()
+ {
+ return FilenameUtils.getName(getFilePath());
+ }
+
+ public String getFilePath()
+ {
+ return _item.getName();
+ }
+
+ public long getSize()
+ {
+ return _item.getSize();
+ }
+
+ public InputStream getStream()
+ {
+ try
+ {
+ return _item.getInputStream();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(UploadMessages.unableToOpenContentFile(this), e);
+ }
+ }
+
+ public boolean isInMemory()
+ {
+ return _item.isInMemory();
+ }
+
+ public void write(File file)
+ {
+ try
+ {
+ _item.write(file);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(UploadMessages.writeFailure(file), e);
+ }
+ }
+
+ public void cleanup()
+ {
+ _item.delete();
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry/upload/services/UploadedFileItem.java
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/UploadStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/UploadStrings.properties?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/UploadStrings.properties (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/UploadStrings.properties Sat Jun 16 09:34:04 2007
@@ -0,0 +1,21 @@
+# Copyright 2007 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+unable-to-decode=Unable to decode multipart encoded request.
+unsupported-encoding=Unsupported character encoding '%s' when decoding multipart encoded request
+write-failure=Unable to write uploaded file content to %s
+unable-to-open-content-file=Unable to open uploaded file '%s'
+unable-to-create-temp-file=Unable to create a temporary file to write upload to.
+enclose-upload-in-form=Upload component must be enclosed by a Form component.
+enctype-already-set=Unable to set encoding type on form '%s' to '%s'. Already has encoding type of '%s'.
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/main/resources/org/apache/tapestry/upload/services/UploadStrings.properties
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/index.apt?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/index.apt (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/index.apt Sat Jun 16 09:34:04 2007
@@ -0,0 +1,73 @@
+ ----
+ Tapestry Upload Component
+ ----
+
+Tapestry Upload Component
+
+ Provides a file upload component for Tapestry based on
+ {{{http://jakarta.apache.org/commons/fileupload/}Jakarata Commons FileUpload}}.
+
+ This is packaged as an add-on to Tapestry because of the number of additional dependencies
+ it adds. However, Maven takes care of that for you!
+
+
+Usage
+
+ The upload component supports default value binding (based on id) and validation.
+
+* Component Template
+
++---+
+ <t:form>
+ <t:errors/>
+ <input t:type="upload" t:id="file" validate="required"/>
+ <br/>
+ <input type="submit" value="Upload"/>
+ </t:form>
++---+
+
+ Here, because the value parameter was not bound, the component used the file property of its container (because the
+ component's id is 'file'). If you want to upload as a different property, either bind the value parameter or
+ change the component's id.
+
+* Page class
+
++---+
+ public class UploadExample
+ {
+ private UploadedFile _file;
+
+ public UploadedFile getFile()
+ {
+ return _file;
+ }
+
+ public void setFile(UploadedFile file)
+ {
+ _file = file;
+ }
+
+ public void onSuccess()
+ {
+ File copied = new File("/my/file/location/" + _file.getFileName());
+
+ _file.write(copied);
+ }
+ }
++---+
+
+
+
+
+Potential Issues
+
+ The Commons FileUpload library uses the CommonsIO file cleaner service to remove temporary files when
+ they are no longer needed. This service creates a thread to carry out its work. If the commons-io library
+ is shared amongst multiple applications (e.g. added to server classpath) it is possible for an application
+ to terminate this thread prematurely and cause errors for the other applications.
+ (see the {{{http://jakarta.apache.org/commons/fileupload/using.html}Resource Cleanup}} section in for more discussion)
+
+ Technically the file cleanup service is not need by Tapestry Upload (which deletes temporary files at the end
+ of request processing). However it is currently not possible to disable it (enhancment request has been filed
+ as {{{https://issues.apache.org/jira/browse/FILEUPLOAD-133}FILEUPLOAD-133}}).
+
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/site/apt/index.apt
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/jdstyle.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/jdstyle.css?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/jdstyle.css (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/jdstyle.css Sat Jun 16 09:34:04 2007
@@ -0,0 +1,117 @@
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults */
+
+/* Page background color */
+body { font-family: Arial;
+ background-color: white;
+ font-size: 10pt;
+ }
+td { font-family: Arial;
+ font-size: 10pt;
+ }
+/* Table colors */
+.TableHeadingColor { background: #F4F4F4 }
+.TableSubHeadingColor { background: #F4F4F4 }
+.TableRowColor { background: #FFFFFF }
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont { font-size: normal; font-family: Arial }
+.FrameHeadingFont { font-size: normal; font-family: Arial }
+.FrameItemFont { font-size: normal; font-family: Arial }
+
+/* Example of smaller, sans-serif font in frames */
+/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
+
+/* Navigation bar fonts and colors */
+.NavBarCell1 { background-color:#F4F4F4;}
+.NavBarCell1Rev { background-color:silver;}
+
+.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
+
+.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+
+A {
+ color: #003399;
+}
+
+A:active {
+ color: #003399;
+}
+
+A:visited {
+ color: #888888;
+}
+
+P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+}
+
+TD, TH, SPAN {
+ color: #000000;
+}
+
+BLOCKQUOTE {
+ margin-right: 0px;
+}
+
+
+/*H1, H2, H3, H4, H5, H6 {
+ color: #000000;
+ font-weight:500;
+ margin-top:10px;
+ padding-top:15px;
+}
+
+H1 { font-size: 150%; }
+H2 { font-size: 140%; }
+H3 { font-size: 110%; font-weight: bold; }
+H4 { font-size: 110%; font-weight: bold;}
+H5 { font-size: 100%; font-style: italic; }
+H6 { font-size: 100%; font-style: italic; }*/
+
+TT {
+font-size: 90%;
+ font-family: "Courier New", Courier, monospace;
+ color: #000000;
+}
+
+PRE {
+font-size: 90%;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #CCCCCC;
+ background-color: #F4F4F4;
+}
+
+UL, OL, LI {
+ list-style: disc;
+}
+
+HR {
+ width: 100%;
+ height: 1px;
+ background-color: #CCCCCC;
+ border-width: 0px;
+ padding: 0px;
+ color: #CCCCCC;
+}
+
+.variablelist {
+ padding-top: 10;
+ padding-bottom:10;
+ margin:0;
+}
+
+.itemizedlist, UL {
+ padding-top: 0;
+ padding-bottom:0;
+ margin:0;
+}
+
+.term {
+ font-weight:bold;
+}
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/jdstyle.css
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/site.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/site.css?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/site.css (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/site.css Sat Jun 16 09:34:04 2007
@@ -0,0 +1,40 @@
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+ background: none;
+ padding-right: 0;
+}
+
+body ul {
+ list-style-type: square;
+}
+
+#downloadbox {
+ float: right;
+ margin: 0 1em 2em 2em;
+ padding: 1em;
+ border: 1px solid #999;
+ background-color: #eee;
+}
+
+#downloadbox h5 {
+ color: #000;
+ margin: 0;
+ border-bottom: 1px solid #aaaaaa;
+ font-size: smaller;
+ padding: 0;
+}
+
+#downloadbox p {
+ margin-top: 1em;
+ margin-bottom: 0;
+}
+
+#downloadbox ul {
+ margin-top: 0;
+ margin-bottom: 1em;
+ list-style-type: disc;
+}
+
+#downloadbox li {
+ font-size: smaller;
+}
+
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/site/resources/css/site.css
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/site/site.xml?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/site/site.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/site/site.xml Sat Jun 16 09:34:04 2007
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 2007 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="Tapestry File Upload">
+ <bannerLeft>
+ <name>Tapestry 5</name>
+ <href>http://tapestry.apache.org/tapestry5/</href>
+ <src>images/tapestry_banner.gif</src>
+ </bannerLeft>
+ <bannerRight>
+ <name>Apache</name>
+ <href>http://www.apache.org</href>
+ <src>images/asf_logo_wide.gif</src>
+ </bannerRight>
+ <skin>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>maven-skin</artifactId>
+ <version>1.1</version>
+ </skin>
+
+ <publishDate format="dd MMM yyyy"/>
+
+ <body>
+ <links>
+ <item name="Tapestry" href="http://tapestry.apache.org/"/>
+ <item name="Apache" href="http://www.apache.org/"/>
+ </links>
+
+ <menu name="Quick Links">
+ <item name="Download" href="http://tapestry.apache.org/download.html"/>
+ </menu>
+
+ <menu name="Documentation">
+ <item name="Reference" href="index.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ </body>
+</project>
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/site/site.xml
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/testng.xml?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/testng.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/testng.xml Sat Jun 16 09:34:04 2007
@@ -0,0 +1,28 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<!--
+ Copyright 2007 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<suite name="Tapesty Upload Component" parallel="false" annotations="1.5" verbose="2">
+ <test name="Tapesty Upload Component">
+ <parameter name="tapestry.integration-webapp" value="src/test/webapp"/>
+ <packages>
+ <package name="org.apache.tapestry.upload.components"/>
+ <package name="org.apache.tapestry.upload.services"/>
+ <!-- One day might be able to run this too -->
+ <!--package name="org.apache.tapestry.upload.integration"/-->
+ </packages>
+ </test>
+</suite>
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/testng.xml
------------------------------------------------------------------------------
svn:executable = *
Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/webdefault.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/webdefault.xml?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/webdefault.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/webdefault.xml Sat Jun 16 09:34:04 2007
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 2007 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<web-app
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <description>
+ Default web.xml file.
+ This file is applied to a Web application before it's own WEB_INF/web.xml file
+ </description>
+
+
+
+ <!-- ==================================================================== -->
+ <!-- Context params to control Session Cookies -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- UNCOMMENT TO ACTIVATE
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name>
+ <param-value>127.0.0.1</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
+ <param-value>/</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.MaxAge</param-name>
+ <param-value>-1</param-value>
+ </context-param>
+ -->
+
+
+
+ <!-- ==================================================================== -->
+ <!-- The default servlet. -->
+ <!-- This servlet, normally mapped to /, provides the handling for static -->
+ <!-- content, OPTIONS and TRACE methods for the context. -->
+ <!-- The following initParameters are supported: -->
+ <!-- -->
+ <!-- acceptRanges If true, range requests and responses are -->
+ <!-- supported -->
+ <!-- -->
+ <!-- dirAllowed If true, directory listings are returned if no -->
+ <!-- welcome file is found. Else 403 Forbidden. -->
+ <!-- -->
+ <!-- putAllowed If true, the PUT method is allowed -->
+ <!-- -->
+ <!-- delAllowed If true, the DELETE method is allowed -->
+ <!-- -->
+ <!-- redirectWelcome If true, redirect welcome file requests -->
+ <!-- else use request dispatcher forwards -->
+ <!-- -->
+ <!-- minGzipLength If set to a positive integer, then static content -->
+ <!-- larger than this will be served as gzip content -->
+ <!-- encoded if a matching resource is found ending -->
+ <!-- with ".gz" -->
+ <!-- -->
+ <!-- resoureBase Can be set to replace the context resource base -->
+ <!-- -->
+ <!-- relativeResourceBase -->
+ <!-- Set with a pathname relative to the base of the -->
+ <!-- servlet context root. Useful for only serving -->
+ <!-- static content from only specific subdirectories. -->
+ <!-- -->
+ <!-- The MOVE method is allowed if PUT and DELETE are allowed -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.mortbay.jetty.servlet.Default</servlet-class>
+ <init-param>
+ <param-name>acceptRanges</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>dirAllowed</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>putAllowed</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>delAllowed</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirectWelcome</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>minGzipLength</param-name>
+ <param-value>8192</param-value>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+
+ <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
+
+ <!-- ==================================================================== -->
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+
+ <!-- ==================================================================== -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ </welcome-file-list>
+
+ <!-- ==================================================================== -->
+ <locale-encoding-mapping-list>
+ <locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping>
+ </locale-encoding-mapping-list>
+
+
+
+</web-app>
+
Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/conf/webdefault.xml
------------------------------------------------------------------------------
svn:executable = *