diff --git a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/package-info.java b/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/package-info.java deleted file mode 100644 index ae34d8c4e5..0000000000 --- a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/package-info.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - *

- * This package delivers a MultiPartManager that is backed by Apache Commons - * File Upload. - *

- * - *

- * For more information about Apache Commons File Upload, see the - * Apache Commons - * File Upload website. - *

- * - * @author Manfred Riem (mriem@manorrock.com) - */ -package cloud.piranha.extension.apache.fileupload; diff --git a/extension/apache-fileupload/pom.xml b/extension/fileupload/pom.xml similarity index 91% rename from extension/apache-fileupload/pom.xml rename to extension/fileupload/pom.xml index 835864ed56..2487ca194a 100644 --- a/extension/apache-fileupload/pom.xml +++ b/extension/fileupload/pom.xml @@ -9,10 +9,10 @@ 24.11.0-SNAPSHOT - piranha-extension-apache-fileupload + piranha-extension-fileupload jar - Piranha - Extension - Apache Commons FileUpload + Piranha - Extension - File Upload diff --git a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartExtension.java b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadExtension.java similarity index 87% rename from extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartExtension.java rename to extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadExtension.java index dfe55e4d03..fb114bf8cb 100644 --- a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartExtension.java +++ b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadExtension.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package cloud.piranha.extension.apache.fileupload; +package cloud.piranha.extension.fileupload; import cloud.piranha.core.api.WebApplication; import cloud.piranha.core.api.WebApplicationExtension; @@ -37,23 +37,22 @@ * * @author Manfred Riem (mriem@manorrock.com) */ -public class ApacheMultiPartExtension implements WebApplicationExtension { +public class FileUploadExtension implements WebApplicationExtension { /** * Stores the logger. */ - private static final System.Logger LOGGER = System.getLogger( - ApacheMultiPartExtension.class.getName()); + private static final System.Logger LOGGER = System.getLogger(FileUploadExtension.class.getName()); /** * Constructor. */ - public ApacheMultiPartExtension() { + public FileUploadExtension() { } @Override public void configure(WebApplication webApplication) { LOGGER.log(TRACE, "Configuring Apache Commons FileUpload extension"); - webApplication.addInitializer(ApacheMultiPartInitializer.class.getName()); + webApplication.addInitializer(FileUploadMultiPartInitializer.class.getName()); } } diff --git a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPart.java b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPart.java similarity index 96% rename from extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPart.java rename to extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPart.java index 2fce48e9f9..2f1c6d5ab9 100644 --- a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPart.java +++ b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPart.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package cloud.piranha.extension.apache.fileupload; +package cloud.piranha.extension.fileupload; import jakarta.servlet.http.Part; import java.io.File; @@ -45,7 +45,7 @@ * * @author Manfred Riem (mriem@manorrock.com) */ -public class ApacheMultiPart implements Part { +public class FileUploadMultiPart implements Part { /** * Stores the item. @@ -57,7 +57,7 @@ public class ApacheMultiPart implements Part { * * @param item the file item. */ - public ApacheMultiPart(FileItem item) { + public FileUploadMultiPart(FileItem item) { this.item = item; } diff --git a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartInitializer.java b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPartInitializer.java similarity index 86% rename from extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartInitializer.java rename to extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPartInitializer.java index e3ba3b2d58..4cfce77807 100644 --- a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartInitializer.java +++ b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPartInitializer.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package cloud.piranha.extension.apache.fileupload; +package cloud.piranha.extension.fileupload; import cloud.piranha.core.api.WebApplication; import jakarta.servlet.ServletContainerInitializer; @@ -43,24 +43,24 @@ *

* *
    - *
  1. Sets the MultiPartManager to an instance of ApacheMultiPartManager.
  2. + *
  3. Sets the MultiPartManager to an instance of FileUploadMultiPartManager.
  4. *
  5. Adds the JakartaFileCleaner listener that cleans up the temporary files.
  6. *
* * @author Manfred Riem (mriem@manorrock.com) */ -public class ApacheMultiPartInitializer implements ServletContainerInitializer { +public class FileUploadMultiPartInitializer implements ServletContainerInitializer { /** * Stores the logger. */ - private static final Logger LOGGER = System.getLogger(ApacheMultiPartInitializer.class.getName()); + private static final Logger LOGGER = System.getLogger(FileUploadMultiPartInitializer.class.getName()); @Override public void onStartup(Set> classes, ServletContext servletContext) throws ServletException { LOGGER.log(TRACE, "Setting ApacheMultiPartManager"); WebApplication webApplication = (WebApplication) servletContext; - webApplication.getManager().setMultiPartManager(new ApacheMultiPartManager()); + webApplication.getManager().setMultiPartManager(new FileUploadMultiPartManager()); webApplication.addListener("org.apache.commons.fileupload2.jakarta.servlet6.JakartaFileCleaner"); } } diff --git a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartManager.java b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPartManager.java similarity index 88% rename from extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartManager.java rename to extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPartManager.java index 630666345d..61dfe15d1f 100644 --- a/extension/apache-fileupload/src/main/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartManager.java +++ b/extension/fileupload/src/main/java/cloud/piranha/extension/fileupload/FileUploadMultiPartManager.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package cloud.piranha.extension.apache.fileupload; +package cloud.piranha.extension.fileupload; import cloud.piranha.core.api.MultiPartManager; import cloud.piranha.core.api.WebApplication; @@ -50,24 +50,24 @@ * The ApacheMultiPartManager. * *

- * The ApacheMultiPartManager implements the MultiPartManager API that delivers - * file upload functionality to a web application by delegating to Apache - * Commons File Upload. - *

+ The FileUploadMultiPartManager implements the MultiPartManager API that delivers + file upload functionality to a web application by delegating to Apache + Commons File Upload. +

* * @author Manfred Riem (mriem@manorrock.com) */ -public class ApacheMultiPartManager implements MultiPartManager { +public class FileUploadMultiPartManager implements MultiPartManager { /** * Stores the logger. */ - private static final Logger LOGGER = System.getLogger(ApacheMultiPartManager.class.getName()); + private static final Logger LOGGER = System.getLogger(FileUploadMultiPartManager.class.getName()); /** * Constructor. */ - public ApacheMultiPartManager() { + public FileUploadMultiPartManager() { } @SuppressWarnings("unchecked") @@ -85,7 +85,7 @@ public Collection getParts(WebApplication webApplication, WebApplicationRe try { setupFileUpload(webApplication, request.getMultipartConfig()) .parseRequest((HttpServletRequest) request) - .forEach(item -> newParts.add(new ApacheMultiPart((FileItem) item))); + .forEach(item -> newParts.add(new FileUploadMultiPart((FileItem) item))); } catch (FileUploadException fue) { LOGGER.log(WARNING, "Error getting part", fue); } @@ -118,7 +118,7 @@ public Part getPart(WebApplication webApplication, WebApplicationRequest request * @return the JakartServletFileUpload instance. */ private synchronized JakartaServletFileUpload setupFileUpload(WebApplication webApplication, MultipartConfigElement multipartConfig) { - JakartaServletFileUpload upload = (JakartaServletFileUpload) webApplication.getAttribute(ApacheMultiPartManager.class.getName()); + JakartaServletFileUpload upload = (JakartaServletFileUpload) webApplication.getAttribute(FileUploadMultiPartManager.class.getName()); if (upload == null) { File outputDirectory; if (multipartConfig.getLocation() == null || multipartConfig.getLocation().isEmpty()) { @@ -140,7 +140,7 @@ private synchronized JakartaServletFileUpload setupFileUpload(WebApplication web .setFile(outputDirectory) .get(); upload = new JakartaServletFileUpload(factory); - webApplication.setAttribute(ApacheMultiPartManager.class.getName(), upload); + webApplication.setAttribute(FileUploadMultiPartManager.class.getName(), upload); } return upload; } diff --git a/extension/apache-fileupload/src/main/java/module-info.java b/extension/fileupload/src/main/java/module-info.java similarity index 83% rename from extension/apache-fileupload/src/main/java/module-info.java rename to extension/fileupload/src/main/java/module-info.java index 06d9cfb2f2..0b96c21531 100644 --- a/extension/apache-fileupload/src/main/java/module-info.java +++ b/extension/fileupload/src/main/java/module-info.java @@ -27,19 +27,16 @@ */ /** - * This module delivers the file upload extension using Apache Commons FileUpload. - * - *

- * See https://github.com/apache/commons-fileupload for more information about - * its project. - *

+ * This module delivers the file upload functionality using Apache Commons + * FileUpload. See https://github.com/apache/commons-fileupload for more + * information. * * @author Manfred Riem (mriem@manorrock.com) */ -module cloud.piranha.extension.apache.fileupload { +module cloud.piranha.extension.fileupload { - exports cloud.piranha.extension.apache.fileupload; - opens cloud.piranha.extension.apache.fileupload; + exports cloud.piranha.extension.fileupload; + opens cloud.piranha.extension.fileupload; requires cloud.piranha.core.api; requires org.apache.commons.fileupload2.core; requires org.apache.commons.fileupload2.jakarta.servlet6; diff --git a/extension/apache-fileupload/src/test/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartManagerTest.java b/extension/fileupload/src/test/java/cloud/piranha/extension/fileupload/FileUploadMultiPartManagerTest.java similarity index 91% rename from extension/apache-fileupload/src/test/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartManagerTest.java rename to extension/fileupload/src/test/java/cloud/piranha/extension/fileupload/FileUploadMultiPartManagerTest.java index 08abd0b373..e3f2e35488 100644 --- a/extension/apache-fileupload/src/test/java/cloud/piranha/extension/apache/fileupload/ApacheMultiPartManagerTest.java +++ b/extension/fileupload/src/test/java/cloud/piranha/extension/fileupload/FileUploadMultiPartManagerTest.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package cloud.piranha.extension.apache.fileupload; +package cloud.piranha.extension.fileupload; import cloud.piranha.core.impl.DefaultWebApplication; import cloud.piranha.core.impl.DefaultWebApplicationRequest; @@ -35,11 +35,11 @@ import org.junit.jupiter.api.Test; /** - * The JUnit tests for the ApacheMultiPartManager class. + * The JUnit tests for the FileUploadMultiPartManager class. * * @author Manfred Riem (mriem@manorrock.com) */ -class ApacheMultiPartManagerTest { +class FileUploadMultiPartManagerTest { /** * Test getPart method. @@ -53,7 +53,7 @@ void testGetPart() throws Exception { request.setMultipartConfig(new MultipartConfigElement(new File("target").getAbsolutePath())); request.setContentType("multipart/form-data"); request.setMethod("POST"); - ApacheMultiPartManager manager = new ApacheMultiPartManager(); + FileUploadMultiPartManager manager = new FileUploadMultiPartManager(); assertNull(manager.getPart(application, request, "part_test")); } } diff --git a/extension/micro/pom.xml b/extension/micro/pom.xml index 46dacb2052..76a6ae8e4c 100644 --- a/extension/micro/pom.xml +++ b/extension/micro/pom.xml @@ -26,7 +26,7 @@
cloud.piranha.extension - piranha-extension-apache-fileupload + piranha-extension-fileupload ${project.version} compile diff --git a/extension/micro/src/main/java/cloud/piranha/extension/micro/MicroExtension.java b/extension/micro/src/main/java/cloud/piranha/extension/micro/MicroExtension.java index 85344ff650..14e5136624 100644 --- a/extension/micro/src/main/java/cloud/piranha/extension/micro/MicroExtension.java +++ b/extension/micro/src/main/java/cloud/piranha/extension/micro/MicroExtension.java @@ -32,10 +32,10 @@ import cloud.piranha.core.api.WebApplication; import cloud.piranha.core.api.WebApplicationExtension; import cloud.piranha.core.api.WebApplicationExtensionContext; -import cloud.piranha.extension.apache.fileupload.ApacheMultiPartExtension; import cloud.piranha.extension.datasource.DefaultDatasourceExtension; import cloud.piranha.extension.eclipselink.EclipseLinkExtension; import cloud.piranha.extension.exousia.AuthorizationPostInitializer; +import cloud.piranha.extension.fileupload.FileUploadExtension; import cloud.piranha.extension.naming.cdi.NamingExtension; import cloud.piranha.extension.policy.PolicyExtension; import cloud.piranha.extension.scinitializer.ServletContainerInitializerExtension; @@ -63,7 +63,7 @@ public void extend(WebApplicationExtensionContext context) { context.add(TempDirExtension.class); // TEMPDIR context.add(WelcomeFileExtension.class); // welcome-file context.add(ServletSecurityManagerExtension.class); // Servlet security - context.add(ApacheMultiPartExtension.class); // Upload + context.add(FileUploadExtension.class); // Upload context.add(WebXmlExtension.class); // web.xml context.add(ServletAnnotationsExtension.class); // Servlet annotations context.add(NamingExtension.class); // Naming (JNDI) diff --git a/extension/micro/src/main/java/module-info.java b/extension/micro/src/main/java/module-info.java index ed1648a75c..dcd2d13d3d 100644 --- a/extension/micro/src/main/java/module-info.java +++ b/extension/micro/src/main/java/module-info.java @@ -40,7 +40,7 @@ opens cloud.piranha.extension.micro; provides WebApplicationExtension with MicroExtension; requires cloud.piranha.core.api; - requires cloud.piranha.extension.apache.fileupload; + requires cloud.piranha.extension.fileupload; requires cloud.piranha.extension.datasource; requires cloud.piranha.extension.eclipselink; requires cloud.piranha.extension.exousia; diff --git a/extension/pom.xml b/extension/pom.xml index 1cf65927c3..2db8a86b1e 100644 --- a/extension/pom.xml +++ b/extension/pom.xml @@ -18,7 +18,6 @@ annotationscan annotationscan-classfile - apache-fileupload bytesstreamhandler compat-glassfish7x compat-tomcat10x @@ -30,6 +29,7 @@ eclipse-jstl eclipselink expressly + fileupload hazelcast herring hibernate-validator diff --git a/extension/servlet/pom.xml b/extension/servlet/pom.xml index bc81f17d45..9c19ba897b 100644 --- a/extension/servlet/pom.xml +++ b/extension/servlet/pom.xml @@ -40,7 +40,7 @@ cloud.piranha.extension - piranha-extension-apache-fileupload + piranha-extension-fileupload ${project.version} compile diff --git a/extension/servlet/src/main/java/cloud/piranha/extension/servlet/ServletExtension.java b/extension/servlet/src/main/java/cloud/piranha/extension/servlet/ServletExtension.java index da3a234d0e..b932486686 100644 --- a/extension/servlet/src/main/java/cloud/piranha/extension/servlet/ServletExtension.java +++ b/extension/servlet/src/main/java/cloud/piranha/extension/servlet/ServletExtension.java @@ -31,7 +31,7 @@ import cloud.piranha.core.api.WebApplicationExtensionContext; import cloud.piranha.extension.annotationscan.AnnotationScanExtension; import cloud.piranha.extension.annotationscan.classfile.ClassfileAnnotationScanExtension; -import cloud.piranha.extension.apache.fileupload.ApacheMultiPartExtension; +import cloud.piranha.extension.fileupload.FileUploadExtension; import cloud.piranha.extension.herring.HerringExtension; import cloud.piranha.extension.policy.PolicyExtension; import cloud.piranha.extension.scinitializer.ServletContainerInitializerExtension; @@ -58,7 +58,7 @@ public void extend(WebApplicationExtensionContext context) { context.add(TempDirExtension.class); // TEMPDIR context.add(WelcomeFileExtension.class); // welcome-file context.add(ServletSecurityManagerExtension.class); // SecurityManager - context.add(ApacheMultiPartExtension.class); // Servlet Part API support + context.add(FileUploadExtension.class); // Servlet Part API support context.add(WaspJspManagerExtension.class); // addJspFile context.add(HerringExtension.class); // Herring (JNDI) context.add(WebXmlExtension.class); // web.xml diff --git a/extension/servlet/src/main/java/module-info.java b/extension/servlet/src/main/java/module-info.java index 301d7c8728..150fbb498d 100644 --- a/extension/servlet/src/main/java/module-info.java +++ b/extension/servlet/src/main/java/module-info.java @@ -35,7 +35,7 @@ *

*