[CONF] Confluence Changes in the last 24 hours
- This is a daily summary of all recent changes in Confluence. - Updated Spaces: - OpenJPA (openjpa) http://cwiki.apache.org/confluence/display/openjpa | |-Pages Added or Edited in This Space |-- OpenJPA 2.0.0 Early Access 2 was created by drwoods (12:34 PM). | http://cwiki.apache.org/confluence/display/openjpa/OpenJPA+2.0.0+Early+Access+2 |-- JPA 2.0 Roadmap was last edited by drwoods (12:38 PM). | http://cwiki.apache.org/confluence/display/openjpa/JPA+2.0+Roadmap Apache Sling (SLING) http://cwiki.apache.org/confluence/display/SLING | |-Pages Added or Edited in This Space |-- Getting and Building Sling was created by mykee (01:34 PM). | http://cwiki.apache.org/confluence/display/SLING/Getting+and+Building+Sling Apache Camel (CAMEL) http://cwiki.apache.org/confluence/display/CAMEL | |-Pages Added or Edited in This Space |-- Stream caching was last edited by davsclaus (10:00 PM). | http://cwiki.apache.org/confluence/display/CAMEL/Stream+caching |-- JBI was last edited by davsclaus (09:58 PM). | http://cwiki.apache.org/confluence/display/CAMEL/JBI Apache Labs (labs) http://cwiki.apache.org/confluence/display/labs | |-Pages Added or Edited in This Space |-- CloudsThePresentations was last edited by robert burrell donkin (11:52 PM). | http://cwiki.apache.org/confluence/display/labs/CloudsThePresentations Apache Sling Website (SLINGxSITE) http://cwiki.apache.org/confluence/display/SLINGxSITE | |-Pages Added or Edited in This Space |-- Downloads was last edited by fmeschbe (03:16 AM). | http://cwiki.apache.org/confluence/display/SLINGxSITE/Downloads Apache Geronimo v2.2 (GMOxDOC22) http://cwiki.apache.org/confluence/display/GMOxDOC22 | |-Pages Added or Edited in This Space |-- Configuring Virtual Host in Tomcat was last edited by chirun...@gmail.com (11:46 PM). | http://cwiki.apache.org/confluence/display/GMOxDOC22/Configuring+Virtual+Host+in+Tomcat |-- Introducing Geronimo Administration Console was last edited by chirun...@gmail.com (07:39 PM). | http://cwiki.apache.org/confluence/display/GMOxDOC22/Introducing+Geronimo+Administration+Console |-- Geronimo GShell Commands was last edited by sophia (02:19 AM). | http://cwiki.apache.org/confluence/display/GMOxDOC22/Geronimo+GShell+Commands |-- Replacing default Realm in Geronimo was created by chirun...@gmail.com (01:13 AM). | http://cwiki.apache.org/confluence/display/GMOxDOC22/Replacing+default+Realm+in+Geronimo |-- Documentation was last edited by sophia (01:11 AM). | http://cwiki.apache.org/confluence/display/GMOxDOC22/Documentation Apache Pivot (PIVOT) http://cwiki.apache.org/confluence/display/PIVOT | |-Pages Added or Edited in This Space |-- Expanders was last edited by gkbr...@mac.com (01:39 PM). | http://cwiki.apache.org/confluence/display/PIVOT/Expanders Apache MINA (MINA) http://cwiki.apache.org/confluence/display/MINA | |-Pages Added or Edited in This Space |-- Navigation was last edited by jvermillard (06:03 AM). | http://cwiki.apache.org/confluence/display/MINA/Navigation |-- Downloads was last edited by jvermillard (06:02 AM). | http://cwiki.apache.org/confluence/display/MINA/Downloads |-- Apache MINA 2.0.0-M6 release was created by jvermillard (05:54 AM). | http://cwiki.apache.org/confluence/display/MINA/2009/06/02/Apache+MINA+2.0.0-M6+release |-- Contributors was last edited by jvermillard (12:54 AM). | http://cwiki.apache.org/confluence/display/MINA/Contributors Apache Directory Studio (DIRxSTUDIO) http://cwiki.apache.org/confluence/display/DIRxSTUDIO | |-Pages Added or Edited in This Space |-- Working was last edited by seelmann (09:57 AM). | http://cwiki.apache.org/confluence/display/DIRxSTUDIO/Working |-- Building was last edited by seelmann (09:52 AM). | http://cwiki.apache.org/confluence/display/DIRxSTUDIO/Building Apache Wicket (WICKET) http://cwiki.apache.org/confluence/display/WICKET | |-Pages Added or Edited in This Space |-- Contributing to Wicket was created by olizilla (01:54 PM). | http://cwiki.apache.org/confluence/display/WICKET/Contributing+to+Wicket |-- Index was last edited by olizilla (01:25 PM). | http://cwiki.apache.org/confluence/display/WICKET/Index - Updated User Profiles: - olizilla |- http://cwiki.apache.org/confluence/display/~olizilla - CONFLUENCE INFORMATION This message is automatically generated by Confluence Unsubscribe or edit your notifications preferences http://cwiki.apache.org/confluence/users/viewnotifications.action If you think it was sent incorrectly contact one of the administrators http:/
svn commit: r781447 - in /struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention: PackageBasedActionConfigBuilder.java classloader/ReloadingClassLoader.java
Author: musachy Date: Wed Jun 3 15:59:27 2009 New Revision: 781447 URL: http://svn.apache.org/viewvc?rev=781447&view=rev Log: change some javadocs and method visibility Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/classloader/ReloadingClassLoader.java Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=781447&r1=781446&r2=781447&view=diff == --- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java (original) +++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java Wed Jun 3 15:59:27 2009 @@ -141,6 +141,10 @@ this.devMode = "true".equals(mode); } +/** + * Reload configuration when classes change. Defaults to "false" and should not be used + * in production. + */ @Inject("struts.convention.classes.reload") public void setReload(String reload) { this.reload = "true".equals(reload); @@ -266,7 +270,7 @@ reloadingClassLoader = new ReloadingClassLoader(getClassLoader()); } -private ClassLoader getClassLoader() { +protected ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); } @@ -293,15 +297,12 @@ if (LOG.isTraceEnabled()) { LOG.trace("Loading action configurations"); -if (actionPackages != null) { +if (actionPackages != null) LOG.trace("Actions being loaded from action packages " + Arrays.asList(actionPackages)); -} -if (packageLocators != null) { +if (packageLocators != null) LOG.trace("Actions being loaded using package locators " + Arrays.asList(packageLocators)); -} -if (excludePackages != null) { +if (excludePackages != null) LOG.trace("Excluding actions from packages " + Arrays.asList(excludePackages)); -} } Set classes = findActions(); @@ -319,7 +320,7 @@ thread classloader) using this, other plugins (like OSGi) can plugin their own classloader for a while and it will be used by Convention (it cannot be a bean, as Convention is likely to be -called multiple times, and it need to use the default ClassLoaderInterface during normal startup) +called multiple times, and it needs to use the default ClassLoaderInterface during normal startup) */ ClassLoaderInterface classLoaderInterface = null; ActionContext ctx = ActionContext.getContext(); @@ -385,7 +386,8 @@ urlSet = urlSet.exclude(new ClassLoaderInterfaceDelegate(systemClassLoader.getParent())); } catch (SecurityException e) { - LOG.warn("Could not get the system classloader due to security constraints, there may be improper urls left to scan"); +if (LOG.isWarnEnabled()) + LOG.warn("Could not get the system classloader due to security constraints, there may be improper urls left to scan"); } urlSet = urlSet.excludeJavaExtDirs(); urlSet = urlSet.excludeJavaEndorsedDirs(); @@ -393,7 +395,8 @@ urlSet = urlSet.excludeJavaHome(); } catch (NullPointerException e) { // This happens in GAE since the sandbox contains no java.home directory - LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?"); +if (LOG.isWarnEnabled()) + LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?"); } urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", "")); urlSet = urlSet.exclude(".*/JavaVM.framework/.*"); @@ -813,7 +816,7 @@ } } -private List buildExceptionMappings(ExceptionMapping[] exceptions, String actionName) { +protected List buildExceptionMappings(ExceptionMapping[] exceptions, String actionName) { List exceptionMappings = new ArrayList(); for (ExceptionMapping exceptionMapping : exceptions) { @@ -830,7 +833,7 @@ return exceptionMappings; } -private PackageConfig.Builder getPackageConfig(final Map packageConfigs, +protected PackageConfig.Builder getPackageConfig(final Map packageConfigs,
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 862 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAINJ6-862 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-862/ -- Code Changes -- Musachy Barroso (781447): >change some javadocs and method visibility -- Error Summary -- [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Unable to find artifact. Embedded error: Downloaded file does not exist: /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/.m2/repository/org/apache/struts/struts2-blank/2.1.7-SNAPSHOT/struts2-blank-2.1.7-SNAPSHOT.war.tmp Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.apache.struts -DartifactId=struts2-blank -Dversion=2.1.7-SNAPSHOT -Dpackaging=war -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.apache.struts -DartifactId=struts2-blank -Dversion=2.1.7-SNAPSHOT -Dpackaging=war -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] org.apache.struts:struts2-blank:war:2.1.7-SNAPSHOT from the specified remote repositories: apache.snapshots (http://people.apache.org/maven-snapshot-repository), central (https://m2proxy.atlassian.com/repository/public) [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
svn commit: r781501 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
Author: wesw Date: Wed Jun 3 18:34:05 2009 New Revision: 781501 URL: http://svn.apache.org/viewvc?rev=781501&view=rev Log: Giving myself some room to inherit, enhance and conquer WW-3100 Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java?rev=781501&r1=781500&r2=781501&view=diff == --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java Wed Jun 3 18:34:05 2009 @@ -53,15 +53,15 @@ static final Logger LOG = LoggerFactory.getLogger(MultiPartRequest.class); // maps parameter name -> List of FileItem objects -private final Map> files = new HashMap>(); +protected Map> files = new HashMap>(); // maps parameter name -> List of param values -private final Map> params = new HashMap>(); +protected Map> params = new HashMap>(); // any errors while processing this request -private final List errors = new ArrayList(); +protected List errors = new ArrayList(); -private long maxSize; +protected long maxSize; @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE) public void setMaxSize(String maxSize) {
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 863 was SUCCESSFUL (with 1013 tests). Change made by Wes Wannemacher
--- STRUTS-MAINJ6-863 was successful. --- Code has been updated by Wes Wannemacher. 1013 tests in total. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-863/ -- Code Changes -- Wes Wannemacher (781501): >Giving myself some room to inherit, enhance and conquer WW-3100 -- Error Summary -- [copy] Warning: /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/apps/src/main/java not found. [copy] Warning: /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/apps/src/main/resources not found. -- This message is automatically generated by Atlassian Bamboo
svn commit: r781557 - /struts/sandbox/trunk/pom.xml
Author: wesw Date: Wed Jun 3 21:24:02 2009 New Revision: 781557 URL: http://svn.apache.org/viewvc?rev=781557&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/pom.xml Added: struts/sandbox/trunk/pom.xml URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/pom.xml?rev=781557&view=auto == --- struts/sandbox/trunk/pom.xml (added) +++ struts/sandbox/trunk/pom.xml Wed Jun 3 21:24:02 2009 @@ -0,0 +1,90 @@ + +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/xsd/maven-4.0.0.xsd";> + +4.0.0 + +org.apache.struts +struts2-plugins +2.1.7-SNAPSHOT + +struts2-fileupload-plugin +struts2-fileupload-plugin +1.0-SNAPSHOT +Struts 2 Advanced File Upload Plugin +jar + + +commons-fileupload +commons-fileupload +1.2.1 +compile + + +org.apache.struts +struts2-core +2.1.7-SNAPSHOT +compile + + +junit +junit +4.4 +test + + +javax.servlet +servlet-api +2.4 +provided + + + +org.springframework +spring +2.5.6 +test + + + +install + + +org.apache.maven.plugins +maven-idea-plugin + +1.5 +target,test-output,.clover +false + + + +maven-compiler-plugin + +1.5 +1.5 + + + + + \ No newline at end of file
svn commit: r781556 - /struts/sandbox/trunk/struts2-fileupload-plugin.ipr
Author: wesw Date: Wed Jun 3 21:23:58 2009 New Revision: 781556 URL: http://svn.apache.org/viewvc?rev=781556&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/struts2-fileupload-plugin.ipr Added: struts/sandbox/trunk/struts2-fileupload-plugin.ipr URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-fileupload-plugin.ipr?rev=781556&view=auto == --- struts/sandbox/trunk/struts2-fileupload-plugin.ipr (added) +++ struts/sandbox/trunk/struts2-fileupload-plugin.ipr Wed Jun 3 21:23:58 2009 @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
svn commit: r781559 - /struts/sandbox/trunk/src/main/
Author: wesw Date: Wed Jun 3 21:24:16 2009 New Revision: 781559 URL: http://svn.apache.org/viewvc?rev=781559&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/
svn commit: r781558 - /struts/sandbox/trunk/struts2-fileupload-plugin.iml
Author: wesw Date: Wed Jun 3 21:24:06 2009 New Revision: 781558 URL: http://svn.apache.org/viewvc?rev=781558&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/struts2-fileupload-plugin.iml Added: struts/sandbox/trunk/struts2-fileupload-plugin.iml URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-fileupload-plugin.iml?rev=781558&view=auto == --- struts/sandbox/trunk/struts2-fileupload-plugin.iml (added) +++ struts/sandbox/trunk/struts2-fileupload-plugin.iml Wed Jun 3 21:24:06 2009 @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
svn commit: r781560 - /struts/sandbox/trunk/src/main/java/
Author: wesw Date: Wed Jun 3 21:24:19 2009 New Revision: 781560 URL: http://svn.apache.org/viewvc?rev=781560&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/
svn commit: r781561 - /struts/sandbox/trunk/src/main/java/org/
Author: wesw Date: Wed Jun 3 21:24:25 2009 New Revision: 781561 URL: http://svn.apache.org/viewvc?rev=781561&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/
svn commit: r781563 - /struts/sandbox/trunk/src/main/java/org/apache/
Author: wesw Date: Wed Jun 3 21:24:29 2009 New Revision: 781563 URL: http://svn.apache.org/viewvc?rev=781563&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/
svn commit: r781565 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/
Author: wesw Date: Wed Jun 3 21:24:36 2009 New Revision: 781565 URL: http://svn.apache.org/viewvc?rev=781565&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/
svn commit: r781564 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/
Author: wesw Date: Wed Jun 3 21:24:32 2009 New Revision: 781564 URL: http://svn.apache.org/viewvc?rev=781564&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/
svn commit: r781567 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java
Author: wesw Date: Wed Jun 3 21:24:50 2009 New Revision: 781567 URL: http://svn.apache.org/viewvc?rev=781567&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java?rev=781567&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java Wed Jun 3 21:24:50 2009 @@ -0,0 +1,65 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +/** + * Holder for constants + * + * @author Wes Wannemacher + */ +public final class FileUploadConstants { + +/** + * + */ +public static final String PROGRESS_LISTENER = "struts.fileuploadplugin.progressListener"; + +/** + * + */ +public static final String FILE_ITEM_FACTORY = "struts.fileuploadplugin.fileitemfactory"; + +/** + * + */ +public static final String SIZE_THRESHOLD = "struts.fileuploadplugin.sizethreshold"; + +/** + * + */ +public static final String FILE_REPOSITORY_PATH = "struts.fileuploadplugin.repositorypath"; + +/** + * + */ +public static final String IS_PORTLET = "struts.fileuploadplugin.isportletupload"; + +/** + * + */ +public static final String LISTENER_UPDATE_FREQUENCY = "struts.fileuploadplugin.listenerupdatefrequency"; + +/** + * + */ +public static final String TIME_TO_KEEP_STATUS = "struts.fileupload.timetokeepstatus"; + +}
svn commit: r781568 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java
Author: wesw Date: Wed Jun 3 21:24:54 2009 New Revision: 781568 URL: http://svn.apache.org/viewvc?rev=781568&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java?rev=781568&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java Wed Jun 3 21:24:54 2009 @@ -0,0 +1,120 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.FileItemFactory; +import com.opensymphony.xwork2.inject.Inject; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +/** + * This class basically wraps the DiskFileItemFactory which is the + * default FileItemFactory for Jakarta FileUpload. The threshold + * setting specifies how large a file can get before it gets flushed + * from memory onto disk. + * + * TODO: Someone mentioned that google app engine won't let you + * write to the filesystem. It should be documented that you could + * potentially set the threshold to match your max upload size and then + * keep all files in memory. I don't know if it will work, since the + * MultiPartRequest interface insists that Files be used and I don't + * know what will happen, but it is worth trying. + * + * @author Wes W + */ +public class DiskFileItemFactoryWrapper implements FileItemFactoryWrapper { + +protected DiskFileItemFactory factory; + +/** + * + * @param sizeThreshold + * @param repositoryPath + */ +public DiskFileItemFactoryWrapper( +@Inject(FileUploadConstants.SIZE_THRESHOLD) +String sizeThreshold, +@Inject(FileUploadConstants.FILE_REPOSITORY_PATH) +String repositoryPath ) { + +int threshold ; +try { +threshold = Integer.parseInt(sizeThreshold); +} +catch (NumberFormatException nfe) { +// how hard is it to specify a valid integer? +} +finally { +threshold = 256; // I guess this is a magic number +} + +File repoPath = convertStringToFile(repositoryPath); + +factory = new DiskFileItemFactory(threshold, repoPath); +} + +/** + * + * @return + */ +public FileItemFactory getFileItemFactory() { +return factory; +} + +/** + * + * @param threshold + */ +public void setSizeThreshold(int threshold) { +this.factory.setSizeThreshold(threshold); +} + +/** + * + * @param repo + */ +public void setRepositoryPath(String repo) { +this.factory.setRepository(convertStringToFile(repo)); +} + +private File convertStringToFile(String path) { +File repoPath = new File(path); +if (repoPath == null || !repoPath.isDirectory()) { +File tempFile = null; +try { +tempFile = File.createTempFile("",""); +} +catch (IOException ioe) { +// I guess we're just sort of screwed, punt +repoPath = null; +} +if (tempFile != null ) { +repoPath = tempFile.getParentFile(); +tempFile.delete(); +} +} +return repoPath; +} + +}
svn commit: r781569 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java
Author: wesw Date: Wed Jun 3 21:24:57 2009 New Revision: 781569 URL: http://svn.apache.org/viewvc?rev=781569&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java?rev=781569&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java Wed Jun 3 21:24:57 2009 @@ -0,0 +1,35 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.apache.commons.fileupload.FileItemFactory; + +/** + * Quick interface to allow DiskFileItemFactoryWrapper to be + * wired in or replaced. + * + * @author Wes W + */ +public interface FileItemFactoryWrapper { + +public FileItemFactory getFileItemFactory(); + +}
svn commit: r781566 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java
Author: wesw Date: Wed Jun 3 21:24:43 2009 New Revision: 781566 URL: http://svn.apache.org/viewvc?rev=781566&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java?rev=781566&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java Wed Jun 3 21:24:43 2009 @@ -0,0 +1,189 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.apache.struts2.dispatcher.multipart.MultiPartRequest; +import org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest; +import org.apache.commons.fileupload.ProgressListener; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.commons.fileupload.FileUpload; +import org.apache.commons.fileupload.RequestContext; +import org.apache.commons.fileupload.portlet.PortletFileUpload; +import org.apache.commons.fileupload.servlet.ServletFileUpload; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.ArrayList; + +import com.opensymphony.xwork2.util.logging.Logger; +import com.opensymphony.xwork2.util.logging.LoggerFactory; +import com.opensymphony.xwork2.inject.Inject; + +/** + * Using Jakarta Commons File Upload, handle multipart requests. This class + * acts mostly the same as the original JakartaMultiPartRequest. + * + * @author WesW + */ +public class EnhancedJakartaMultiPartRequest +extends JakartaMultiPartRequest +implements MultiPartRequest { + +static final Logger LOG = LoggerFactory.getLogger(MultiPartRequest.class); + +protected ProgressListener progressListener; +protected FileItemFactory fileItemFactory; +protected boolean portletUpload; + +/** + * + * @param progressListener + */ +@Inject(FileUploadConstants.PROGRESS_LISTENER) +public void setProgressListener(ProgressListener progressListener) { +this.progressListener = progressListener; +} + +/** + * + * @param fileItemFactory + */ +@Inject(FileUploadConstants.FILE_ITEM_FACTORY) +public void setFileItemFactory(FileItemFactory fileItemFactory) { +this.fileItemFactory = fileItemFactory; +} + +/** + * + * @param portletUpload + */ +@Inject(FileUploadConstants.IS_PORTLET) +public void setPortletUpload(String portletUpload) { +this.portletUpload = "true".equalsIgnoreCase(portletUpload); +} + +/** + * + * @param request + * @param saveDir + * @throws IOException + */ +public void parse(HttpServletRequest request, String saveDir) throws IOException { +// Parse the request mostly copy/paste from JakartaMuliPartRequest +try { + +FileUpload upload ; +if (portletUpload) { +upload = new PortletFileUpload(fileItemFactory); +} +else { +upload = new ServletFileUpload(fileItemFactory); +} + +upload.setSizeMax(maxSize); +upload.setProgressListener(progressListener); + +List items = upload.parseRequest(createRequestContext(request)); + +for (Object item1 : items) { +FileItem item = (FileItem) item1; +if (LOG.isDebugEnabled()) LOG.debug("Found item " + item.getFieldName()); +if (item.isFormField()) { +LOG.debug("Item is a normal form field"); +
svn commit: r781571 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatus.java
Author: wesw Date: Wed Jun 3 21:25:05 2009 New Revision: 781571 URL: http://svn.apache.org/viewvc?rev=781571&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatus.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatus.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatus.java?rev=781571&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatus.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatus.java Wed Jun 3 21:25:05 2009 @@ -0,0 +1,110 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import java.util.Calendar; + +/** + * POJO for holding the status of a running upload. Instance access + * time is recorded to allow for simple cleanup. + * + * @author Wes W + */ +public class UploadStatus { + +private long lastAccess ; +private long bytesRead ; +private long contentLength ; +private long item ; + +/** + * + */ +public UploadStatus() { +updateLastAccess() ; +bytesRead = 0; +contentLength = 0; +item = 0; +} + +/** + * + */ +public long getLastAccess() { +return lastAccess; +} + +/** + * + */ +public long getBytesRead() { +updateLastAccess(); +return bytesRead; +} + +/** + * + */ +public void setBytesRead(long bytesRead) { +updateLastAccess(); +this.bytesRead = bytesRead; +} + +/** + * + */ +public long getContentLength() { +updateLastAccess(); +return contentLength; +} + +/** + * + */ +public void setContentLength(long contentLength) { +updateLastAccess(); +this.contentLength = contentLength; +} + +/** + * + */ +public long getItem() { +updateLastAccess(); +return item; +} + +/** + * + */ +public void setItem(long item) { +updateLastAccess(); +this.item = item; +} + +/** + * + */ +private void updateLastAccess() { +lastAccess = Calendar.getInstance().getTimeInMillis() / 1000 ; +} + +}
svn commit: r781570 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java
Author: wesw Date: Wed Jun 3 21:25:01 2009 New Revision: 781570 URL: http://svn.apache.org/viewvc?rev=781570&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java?rev=781570&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java Wed Jun 3 21:25:01 2009 @@ -0,0 +1,80 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.apache.commons.fileupload.ProgressListener; +import org.apache.struts2.ServletActionContext; +import com.opensymphony.xwork2.inject.Inject; + +/** + * Just a simple ProgressListener for Jakarta FileUpload. It will store + * file progress in a HashMap that gets cleaned out once in a while. + * The HashMap will key the upload status off of the HttpSession.getId(), + * which means that you can't have multiple uploads going to the same + * server from different browser windows or tabs. + * + * @author Wes W + */ +public class BasicProgressListener implements ProgressListener { + +private int updateFrequency = 2048; // magic number for a default +private UploadStatusHolder holder = new UploadStatusHolder(); +private long lastUpdate = -1L; // + +/** + * + * @param updateFrequency + */ +@Inject(FileUploadConstants.LISTENER_UPDATE_FREQUENCY) +public void setUpdateFrequency(String updateFrequency) { +try { +this.updateFrequency = Integer.parseInt(updateFrequency); +} +catch (NumberFormatException nfe) { +// come on people, how hard is it to specify an integer +// if you flubbed it up, you can get the default +} +} + +/** + * + * @param bytesRead + * @param contentLength + * @param item + */ +public void update(long bytesRead, long contentLength, int item) { +if ( bytesRead / updateFrequency > lastUpdate) { +lastUpdate = bytesRead / updateFrequency; +if (lastUpdate == 0 ) { +// we could get stuck here if we leave it +lastUpdate = 1L; +} +// I wonder if this will ever NPE +String sessionId = ServletActionContext.getRequest().getSession(true).getId(); +UploadStatus status = new UploadStatus(); +status.setBytesRead(bytesRead); +status.setContentLength(contentLength); +status.setItem(item); +holder.addUploadStatus(sessionId, status); +} +} +}
svn commit: r781572 - /struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java
Author: wesw Date: Wed Jun 3 21:25:09 2009 New Revision: 781572 URL: http://svn.apache.org/viewvc?rev=781572&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java Added: struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java?rev=781572&view=auto == --- struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java (added) +++ struts/sandbox/trunk/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java Wed Jun 3 21:25:09 2009 @@ -0,0 +1,91 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import com.opensymphony.xwork2.inject.Inject; + +import java.util.Map; +import java.util.HashMap; +import java.util.Calendar; +import java.util.ArrayList; +import java.util.List; + +/** + * The UploadStatusHolder simply holds UploadStatuses. It will + * clean them up if an UploadStatus has not been accessed within + * the configured amount of time (in seconds). + * + * @author Wes W + */ +public class UploadStatusHolder { + +private int secondsToKeep = 600 ; //default to ten minutes +public static Map statuses = new HashMap(); + +private long lastRun = 0; // keep track so we aren't cleaning up all the time + +/** + * + * @param secondsToKeep + */ +@Inject(FileUploadConstants.TIME_TO_KEEP_STATUS) +public void setSecondsToKeep(String secondsToKeep) { +try { +this.secondsToKeep = Integer.parseInt(secondsToKeep); +} +catch (NumberFormatException nfe) { +// come on people, how hard is it to specify an integer +// if you flubbed it up, you can get the default +} +} + +/** + * + * @param key + * @param status + */ +public void addUploadStatus(String key, UploadStatus status ) { +statuses.put(key,status); +} + +/** + * + * @param key + * @return + */ +public UploadStatus getUploadStatus(String key) { +long now = Calendar.getInstance().getTimeInMillis() / 1000 ; +if ( now - lastRun > secondsToKeep) { +// time to clean up +List keys2del = new ArrayList(); +for (String cleanUpKey : statuses.keySet()) { +if ( now - statuses.get(cleanUpKey).getLastAccess() > secondsToKeep ) { +keys2del.add(cleanUpKey); +} +} +for (String key2del : keys2del) { +statuses.remove(key2del); +} +} + +return statuses.get(key); +} +}
svn commit: r781574 - /struts/sandbox/trunk/src/test/
Author: wesw Date: Wed Jun 3 21:25:20 2009 New Revision: 781574 URL: http://svn.apache.org/viewvc?rev=781574&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/
svn commit: r781573 - /struts/sandbox/trunk/src/main/resources/
Author: wesw Date: Wed Jun 3 21:25:14 2009 New Revision: 781573 URL: http://svn.apache.org/viewvc?rev=781573&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/main/resources/
svn commit: r781576 - /struts/sandbox/trunk/src/test/java/org/
Author: wesw Date: Wed Jun 3 21:25:28 2009 New Revision: 781576 URL: http://svn.apache.org/viewvc?rev=781576&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/
svn commit: r781575 - /struts/sandbox/trunk/src/test/java/
Author: wesw Date: Wed Jun 3 21:25:24 2009 New Revision: 781575 URL: http://svn.apache.org/viewvc?rev=781575&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/
svn commit: r781577 - /struts/sandbox/trunk/src/test/java/org/apache/
Author: wesw Date: Wed Jun 3 21:25:32 2009 New Revision: 781577 URL: http://svn.apache.org/viewvc?rev=781577&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/apache/
svn commit: r781578 - /struts/sandbox/trunk/src/test/java/org/apache/struts2/
Author: wesw Date: Wed Jun 3 21:25:35 2009 New Revision: 781578 URL: http://svn.apache.org/viewvc?rev=781578&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/
svn commit: r781580 - /struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java
Author: wesw Date: Wed Jun 3 21:25:49 2009 New Revision: 781580 URL: http://svn.apache.org/viewvc?rev=781580&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java?rev=781580&view=auto == --- struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java (added) +++ struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java Wed Jun 3 21:25:49 2009 @@ -0,0 +1,50 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.junit.Test; +import static org.junit.Assert.assertTrue; + +/** + * Unit Test for UploadStatus + * + * @author Wes W + */ +public class UploadStatusTest { + +/** + * + * @throws Exception + */ +@Test +public void testLastAccessChange() throws Exception { +UploadStatus stat = new UploadStatus() ; +long firstAccess = stat.getLastAccess(); +stat.setBytesRead(1L); +stat.setContentLength(1L); +stat.setItem(1L); +Thread.sleep(5000L); +assertTrue(1 == stat.getBytesRead()); +assertTrue(1 == stat.getContentLength()); +assertTrue(1 == stat.getItem()); +assertTrue(firstAccess < stat.getLastAccess()); +} +}
svn commit: r781581 - /struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java
Author: wesw Date: Wed Jun 3 21:25:52 2009 New Revision: 781581 URL: http://svn.apache.org/viewvc?rev=781581&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java?rev=781581&view=auto == --- struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java (added) +++ struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java Wed Jun 3 21:25:52 2009 @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.junit.Test; +import static org.junit.Assert.assertTrue; + +/** + * Unit Test for UploadStatusHolder + * + * @author Wes W + */ +public class UploadStatusHolderTest { + +/** + * + */ +@Test +public void testStatusHolding() { +UploadStatusHolder holder1 = new UploadStatusHolder(); +UploadStatus status1 = new UploadStatus(); +status1.setBytesRead(1L); +status1.setContentLength(1L); +status1.setItem(1L); +holder1.addUploadStatus("status1",status1); + +UploadStatusHolder holder2 = new UploadStatusHolder(); +UploadStatus status2 = holder2.getUploadStatus("status1"); + +assertTrue(status1.getBytesRead() == status2.getBytesRead()); +assertTrue(status1.getContentLength() == status2.getContentLength()); +assertTrue(status1.getItem() == status2.getItem()); +} + +/** + * + * @throws Exception + */ +@Test +public void testStatusHoldingGetsRemoved() throws Exception { +UploadStatusHolder holder1 = new UploadStatusHolder(); +holder1.setSecondsToKeep("1"); +UploadStatus status1 = new UploadStatus(); +status1.setBytesRead(1L); +status1.setContentLength(1L); +status1.setItem(1L); +holder1.addUploadStatus("status1",status1); +Thread.sleep(5000L); +UploadStatus status2 = holder1.getUploadStatus("status1"); +assertTrue(status2 == null); +} +}
svn commit: r781579 - /struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/
Author: wesw Date: Wed Jun 3 21:25:39 2009 New Revision: 781579 URL: http://svn.apache.org/viewvc?rev=781579&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/
svn commit: r781582 - /struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java
Author: wesw Date: Wed Jun 3 21:25:56 2009 New Revision: 781582 URL: http://svn.apache.org/viewvc?rev=781582&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java Added: struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java?rev=781582&view=auto == --- struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java (added) +++ struts/sandbox/trunk/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java Wed Jun 3 21:25:56 2009 @@ -0,0 +1,117 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.struts2.fileupload; + +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.assertTrue; +import org.apache.struts2.ServletActionContext; +import org.apache.struts2.StrutsStatics; +import org.springframework.mock.web.MockServletContext; +import org.springframework.mock.web.MockHttpSession; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import com.opensymphony.xwork2.ActionContext; + +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.HashMap; + +/** + * Unit test for BasicProgressListener + * + * @author Wes W + */ +public class BasicProgressListenerTest implements StrutsStatics { + +ActionContext actionContext; +// ServletActionContext servletActionContext; +private MockServletContext servletContext; +private HttpServletRequest request; +private HttpServletResponse response; + +/** + * + */ +@Before +public void setUp() { +Map extraContext = new HashMap(); + +servletContext = new MockServletContext(); + +request = new MockHttpServletRequest(); +response = new MockHttpServletResponse(); + +extraContext.put(HTTP_REQUEST, request); +extraContext.put(HTTP_RESPONSE, response); +extraContext.put(SERVLET_CONTEXT, servletContext); + +actionContext = new ActionContext(extraContext); +ServletActionContext.setContext(actionContext); +} + +/** + * + */ +@Test +public void testUpdate() { +BasicProgressListener listener = new BasicProgressListener(); +listener.setUpdateFrequency("1"); +listener.update(10L,10L,1); + +UploadStatusHolder holder = new UploadStatusHolder(); + +String key = request.getSession().getId(); +System.err.println("key - " + key); + +UploadStatus status = holder.getUploadStatus(key ); + +assertTrue(status.getBytesRead() == 10L); +assertTrue(status.getContentLength() == 10L); +assertTrue(status.getItem() == 1); +} + +/** + * + */ +@Test +public void testDontUpdate() { +BasicProgressListener listener = new BasicProgressListener(); +// listener.setUpdateFrequency("1000"); // let default of 2048 take over +listener.update(10L,10L,1); +listener.update(100L,100L,1); + +UploadStatusHolder holder = new UploadStatusHolder(); + +String key = request.getSession().getId(); +System.err.println("key - " + key); + +UploadStatus status = holder.getUploadStatus(key ); + +assertTrue(status.getBytesRead() == 10L); +assertTrue(status.getContentLength() == 10L); +assertTrue(status.getItem() == 1); + +} +} \ No newline at end of file
svn commit: r781583 - /struts/sandbox/trunk/src/test/resources/
Author: wesw Date: Wed Jun 3 21:26:00 2009 New Revision: 781583 URL: http://svn.apache.org/viewvc?rev=781583&view=rev Log: first import, still need to create a struts-plugin.xml file that maps the beans. Added: struts/sandbox/trunk/src/test/resources/
svn commit: r781587 - in /struts/sandbox/trunk/struts2-fileupload-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/struts2/ src/main/java/
Author: wesw Date: Wed Jun 3 21:30:06 2009 New Revision: 781587 URL: http://svn.apache.org/viewvc?rev=781587&view=rev Log: first commit, wanted to get it in before leaving, still need to add a struts-plugin.xml file that wires the beans together and then build an action that demonstrates ajax usage with a progress bar Added: struts/sandbox/trunk/struts2-fileupload-plugin/ struts/sandbox/trunk/struts2-fileupload-plugin/pom.xml struts/sandbox/trunk/struts2-fileupload-plugin/src/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/ struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/DiskFileItemFactoryWrapper.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/EnhancedJakartaMultiPartRequest.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/FileItemFactoryWrapper.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/FileUploadConstants.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/UploadStatus.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/UploadStatusHolder.java struts/sandbox/trunk/struts2-fileupload-plugin/src/main/resources/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/apache/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/apache/struts2/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/apache/struts2/fileupload/ struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/apache/struts2/fileupload/BasicProgressListenerTest.java struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/apache/struts2/fileupload/UploadStatusHolderTest.java struts/sandbox/trunk/struts2-fileupload-plugin/src/test/java/org/apache/struts2/fileupload/UploadStatusTest.java struts/sandbox/trunk/struts2-fileupload-plugin/src/test/resources/ Added: struts/sandbox/trunk/struts2-fileupload-plugin/pom.xml URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-fileupload-plugin/pom.xml?rev=781587&view=auto == --- struts/sandbox/trunk/struts2-fileupload-plugin/pom.xml (added) +++ struts/sandbox/trunk/struts2-fileupload-plugin/pom.xml Wed Jun 3 21:30:06 2009 @@ -0,0 +1,90 @@ + +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/xsd/maven-4.0.0.xsd";> + +4.0.0 + +org.apache.struts +struts2-plugins +2.1.7-SNAPSHOT + +struts2-fileupload-plugin +struts2-fileupload-plugin +1.0-SNAPSHOT +Struts 2 Advanced File Upload Plugin +jar + + +commons-fileupload +commons-fileupload +1.2.1 +compile + + +org.apache.struts +struts2-core +2.1.7-SNAPSHOT +compile + + +junit +junit +4.4 +test + + +javax.servlet +servlet-api +2.4 +provided + + + +org.springframework +spring +2.5.6 +test + + + +install + + +org.apache.maven.plugins +maven-idea-plugin + +1.5 +target,test-output,.clover +false + + + +maven-compiler-plugin + +1.5 +1.5 + + + + + \ No newline at end of file Added: struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-fileupload-plugin/src/main/java/org/apache/struts2/fileupload/BasicProgressListener.java?rev