From cea9c97c17ae07854ec9733f99f4e50be3d6d3d0 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Sat, 16 Nov 2024 21:13:47 -0600 Subject: [PATCH] Fixes #4223 - Move WebXmlXXX classes to web.xml extension (#4224) --- .../core/api/WebApplicationManager.java | 14 ------ .../impl/DefaultWebApplicationManager.java | 16 ------- .../DefaultWebApplicationManagerTest.java | 17 -------- extension/exousia/pom.xml | 7 +++ .../exousia/AuthorizationPostInitializer.java | 6 +-- .../exousia/PiranhaToExousiaConverter.java | 8 ++-- .../exousia/src/main/java/module-info.java | 1 + extension/webxml/pom.xml | 43 +------------------ .../piranha/extension/webxml}/WebXml.java | 2 +- .../extension/webxml}/WebXmlContextParam.java | 2 +- .../extension/webxml}/WebXmlDataSource.java | 2 +- .../extension/webxml}/WebXmlErrorPage.java | 2 +- .../extension/webxml}/WebXmlFilter.java | 2 +- .../webxml}/WebXmlFilterInitParam.java | 2 +- .../webxml}/WebXmlFilterMapping.java | 2 +- .../extension/webxml/WebXmlInitializer.java | 4 +- .../extension/webxml}/WebXmlJspConfig.java | 2 +- .../webxml}/WebXmlJspConfigTaglib.java | 2 +- .../extension/webxml}/WebXmlListener.java | 2 +- .../extension/webxml}/WebXmlLoginConfig.java | 2 +- .../extension/webxml}/WebXmlManager.java | 2 +- .../extension/webxml}/WebXmlMimeMapping.java | 2 +- .../webxml}/WebXmlSecurityConstraint.java | 2 +- .../extension/webxml}/WebXmlServlet.java | 2 +- .../webxml}/WebXmlServletInitParam.java | 2 +- .../webxml}/WebXmlServletMapping.java | 2 +- .../webxml}/WebXmlServletMultipartConfig.java | 2 +- .../webxml}/WebXmlServletSecurityRoleRef.java | 2 +- .../webxml}/WebXmlSessionConfig.java | 2 +- .../WebXmlSessionConfigCookieConfig.java | 2 +- .../internal/InternalWebXmlManager.java | 6 +-- .../webxml/internal/InternalWebXmlParser.java | 38 ++++++++-------- .../internal/InternalWebXmlProcessor.java | 24 +++++------ .../webxml/DenyUncoveredMethodsTest.java | 10 ++--- .../internal/InternalWebXmlManagerTest.java | 4 +- .../internal/InternalWebXmlParserTest.java | 4 +- 36 files changed, 79 insertions(+), 165 deletions(-) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXml.java (99%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlContextParam.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlDataSource.java (99%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlErrorPage.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlFilter.java (99%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlFilterInitParam.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlFilterMapping.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlJspConfig.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlJspConfigTaglib.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlListener.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlLoginConfig.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlManager.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlMimeMapping.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlSecurityConstraint.java (99%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlServlet.java (99%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlServletInitParam.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlServletMapping.java (97%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlServletMultipartConfig.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlServletSecurityRoleRef.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlSessionConfig.java (98%) rename {core/api/src/main/java/cloud/piranha/core/api => extension/webxml/src/main/java/cloud/piranha/extension/webxml}/WebXmlSessionConfigCookieConfig.java (97%) diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebApplicationManager.java b/core/api/src/main/java/cloud/piranha/core/api/WebApplicationManager.java index c0e49c08ea..2e7045c5da 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebApplicationManager.java +++ b/core/api/src/main/java/cloud/piranha/core/api/WebApplicationManager.java @@ -125,13 +125,6 @@ public interface WebApplicationManager { */ ServletRequestManager getServletRequestManager(); - /** - * Get the web.xml manager. - * - * @return the web.xml manager. - */ - WebXmlManager getWebXmlManager(); - /** * Get the welcome file manager. * @@ -216,13 +209,6 @@ public interface WebApplicationManager { */ void setServletRequestManager(ServletRequestManager servletRequestManager); - /** - * Set the web.xml manager. - * - * @param webXmlManager the web.xml manager. - */ - void setWebXmlManager(WebXmlManager webXmlManager); - /** * Set the welcome file manager. * diff --git a/core/impl/src/main/java/cloud/piranha/core/impl/DefaultWebApplicationManager.java b/core/impl/src/main/java/cloud/piranha/core/impl/DefaultWebApplicationManager.java index c7cb825793..a1184e352f 100644 --- a/core/impl/src/main/java/cloud/piranha/core/impl/DefaultWebApplicationManager.java +++ b/core/impl/src/main/java/cloud/piranha/core/impl/DefaultWebApplicationManager.java @@ -39,7 +39,6 @@ import cloud.piranha.core.api.SecurityManager; import cloud.piranha.core.api.WelcomeFileManager; import cloud.piranha.core.api.WebApplicationManager; -import cloud.piranha.core.api.WebXmlManager; import cloud.piranha.resource.api.ResourceManager; import cloud.piranha.resource.impl.DefaultResourceManager; import cloud.piranha.core.api.ServletRequestManager; @@ -111,11 +110,6 @@ public class DefaultWebApplicationManager implements WebApplicationManager { */ protected ServletRequestManager servletRequestManager = new DefaultServletRequestManager(); - /** - * Stores the web.xml manager. - */ - protected WebXmlManager webXmlManager; - /** * Stores the welcome file manager. */ @@ -186,11 +180,6 @@ public ServletRequestManager getServletRequestManager() { return servletRequestManager; } - @Override - public WebXmlManager getWebXmlManager() { - return webXmlManager; - } - @Override public WelcomeFileManager getWelcomeFileManager() { return welcomeFileManager; @@ -251,11 +240,6 @@ public void setSecurityManager(SecurityManager securityManager) { this.securityManager = securityManager; } - @Override - public void setWebXmlManager(WebXmlManager webXmlManager) { - this.webXmlManager = webXmlManager; - } - @Override public void setWelcomeFileManager(WelcomeFileManager welcomeFileManager) { this.welcomeFileManager = welcomeFileManager; diff --git a/core/impl/src/test/java/cloud/piranha/core/impl/DefaultWebApplicationManagerTest.java b/core/impl/src/test/java/cloud/piranha/core/impl/DefaultWebApplicationManagerTest.java index ab109ea77d..cd610216b5 100644 --- a/core/impl/src/test/java/cloud/piranha/core/impl/DefaultWebApplicationManagerTest.java +++ b/core/impl/src/test/java/cloud/piranha/core/impl/DefaultWebApplicationManagerTest.java @@ -27,8 +27,6 @@ */ package cloud.piranha.core.impl; -import cloud.piranha.core.api.WebXml; -import cloud.piranha.core.api.WebXmlManager; import cloud.piranha.core.api.WelcomeFileManager; import java.util.List; import org.junit.jupiter.api.Test; @@ -179,21 +177,6 @@ void testGetServletRequestManager() { assertNull(manager.getServletRequestManager()); } - /** - * Test getWebXmlManager method. - */ - @Test - void testGetWebXmlManager() { - DefaultWebApplicationManager manager = new DefaultWebApplicationManager(); - assertNull(manager.getWebXmlManager()); - manager.setWebXmlManager(new WebXmlManager() { - @Override - public WebXml getWebXml() { - return null; - } - }); - } - /** * Test getWelcomeFileManager method. */ diff --git a/extension/exousia/pom.xml b/extension/exousia/pom.xml index d46ecc4949..e9a1269ff0 100644 --- a/extension/exousia/pom.xml +++ b/extension/exousia/pom.xml @@ -52,5 +52,12 @@ javassist 3.29.2-GA + + + cloud.piranha.extension + piranha-extension-webxml + ${project.version} + provided + diff --git a/extension/exousia/src/main/java/cloud/piranha/extension/exousia/AuthorizationPostInitializer.java b/extension/exousia/src/main/java/cloud/piranha/extension/exousia/AuthorizationPostInitializer.java index 4931000607..4865edbe30 100644 --- a/extension/exousia/src/main/java/cloud/piranha/extension/exousia/AuthorizationPostInitializer.java +++ b/extension/exousia/src/main/java/cloud/piranha/extension/exousia/AuthorizationPostInitializer.java @@ -51,7 +51,7 @@ import org.glassfish.exousia.mapping.SecurityRoleRef; import cloud.piranha.core.api.WebApplication; -import cloud.piranha.core.api.WebXmlManager; +import cloud.piranha.extension.webxml.WebXmlManager; import jakarta.security.jacc.PolicyConfiguration; import jakarta.security.jacc.PolicyContextException; import jakarta.servlet.FilterRegistration; @@ -220,7 +220,7 @@ private List getConstraintsFromSecurityAnnotations(ServletCo * @return the list of security constraints. */ private List getConstraintsFromWebXml(WebApplication webApplication) { - WebXmlManager manager = webApplication.getManager().getWebXmlManager(); + WebXmlManager manager = (WebXmlManager) webApplication.getAttribute("cloud.piranha.extension.webxml.WebXmlManager"); return piranhaToExousiaConverter.getConstraintsFromWebXml(manager.getWebXml()); } @@ -232,7 +232,7 @@ private List getConstraintsFromWebXml(WebApplication webAppl * @throws ServletException when a Servlet error occurs. */ public Map> getSecurityRoleRefsFromWebXml(WebApplication webApplication) throws ServletException { - WebXmlManager manager = webApplication.getManager().getWebXmlManager(); + WebXmlManager manager = (WebXmlManager) webApplication.getAttribute("cloud.piranha.extension.webxml.WebXmlManager"); return piranhaToExousiaConverter.getSecurityRoleRefsFromWebXml(webApplication.getServletRegistrations().keySet(), manager.getWebXml()); } diff --git a/extension/exousia/src/main/java/cloud/piranha/extension/exousia/PiranhaToExousiaConverter.java b/extension/exousia/src/main/java/cloud/piranha/extension/exousia/PiranhaToExousiaConverter.java index 6e317fa330..2d313ae4da 100644 --- a/extension/exousia/src/main/java/cloud/piranha/extension/exousia/PiranhaToExousiaConverter.java +++ b/extension/exousia/src/main/java/cloud/piranha/extension/exousia/PiranhaToExousiaConverter.java @@ -27,10 +27,10 @@ */ package cloud.piranha.extension.exousia; -import cloud.piranha.core.api.WebXmlServletSecurityRoleRef; -import cloud.piranha.core.api.WebXml; -import cloud.piranha.core.api.WebXmlSecurityConstraint; -import cloud.piranha.core.api.WebXmlServlet; +import cloud.piranha.extension.webxml.WebXmlServletSecurityRoleRef; +import cloud.piranha.extension.webxml.WebXml; +import cloud.piranha.extension.webxml.WebXmlSecurityConstraint; +import cloud.piranha.extension.webxml.WebXmlServlet; import jakarta.servlet.ServletSecurityElement; import jakarta.servlet.annotation.ServletSecurity; import static jakarta.servlet.annotation.ServletSecurity.TransportGuarantee.CONFIDENTIAL; diff --git a/extension/exousia/src/main/java/module-info.java b/extension/exousia/src/main/java/module-info.java index dafd7d667c..824faa0229 100644 --- a/extension/exousia/src/main/java/module-info.java +++ b/extension/exousia/src/main/java/module-info.java @@ -45,5 +45,6 @@ requires cloud.piranha.core.impl; requires jakarta.security.jacc; requires jakarta.servlet; + requires static cloud.piranha.extension.webxml; requires transitive org.glassfish.exousia; } diff --git a/extension/webxml/pom.xml b/extension/webxml/pom.xml index 7ef13ae0b8..ca7a58da15 100644 --- a/extension/webxml/pom.xml +++ b/extension/webxml/pom.xml @@ -14,10 +14,6 @@ Piranha - Extension - web.xml - - - - @@ -45,12 +41,6 @@ ${project.version} test - - cloud.piranha.extension - piranha-extension-security-servlet - ${project.version} - test - cloud.piranha.extension piranha-extension-welcomefile @@ -86,40 +76,9 @@ org.apache.maven.plugins maven-surefire-plugin - @{argLine} --add-opens cloud.piranha.extension.webxml/cloud.piranha.extension.webxml.internal=ALL-UNNAMED + false - - org.jacoco - jacoco-maven-plugin - - - default-check - - check - - - - - BUNDLE - - - INSTRUCTION - COVEREDRATIO - 0.80 - - - CLASS - MISSEDCOUNT - 0 - - - - - - - - diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXml.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXml.java similarity index 99% rename from core/api/src/main/java/cloud/piranha/core/api/WebXml.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXml.java index 2aae61d75e..08d400d440 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXml.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXml.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.core.api; +package cloud.piranha.extension.webxml; import java.io.Serializable; import java.util.ArrayList; diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlContextParam.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlContextParam.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlContextParam.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlContextParam.java index 71ad687eff..e7b5e68a37 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlContextParam.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlContextParam.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.core.api; +package cloud.piranha.extension.webxml; /** * A context-param inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlDataSource.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlDataSource.java similarity index 99% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlDataSource.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlDataSource.java index a704228b98..1f1879af52 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlDataSource.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlDataSource.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.core.api; +package cloud.piranha.extension.webxml; import java.util.HashMap; import java.util.Map; diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlErrorPage.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlErrorPage.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlErrorPage.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlErrorPage.java index 9a1b200447..61d9ac85d4 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlErrorPage.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlErrorPage.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.core.api; +package cloud.piranha.extension.webxml; /** * An error-page inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlFilter.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilter.java similarity index 99% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlFilter.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilter.java index 17ab255fba..560bca680b 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlFilter.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilter.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.core.api; +package cloud.piranha.extension.webxml; import java.util.ArrayList; import java.util.List; diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlFilterInitParam.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilterInitParam.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlFilterInitParam.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilterInitParam.java index 7b23f877f7..b79be85caf 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlFilterInitParam.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilterInitParam.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.core.api; +package cloud.piranha.extension.webxml; /** * A filter init-param inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlFilterMapping.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilterMapping.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlFilterMapping.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilterMapping.java index 96200f1362..77c0785ffd 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlFilterMapping.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlFilterMapping.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.core.api; +package cloud.piranha.extension.webxml; import java.util.ArrayList; import java.util.List; diff --git a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlInitializer.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlInitializer.java index 6409e71b35..00d581da9e 100644 --- a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlInitializer.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlInitializer.java @@ -31,8 +31,6 @@ import cloud.piranha.extension.webxml.internal.InternalWebXmlProcessor; import cloud.piranha.extension.webxml.internal.InternalWebXmlManager; import cloud.piranha.core.api.WebApplication; -import cloud.piranha.core.api.WebXml; -import cloud.piranha.core.api.WebXmlServletMapping; import jakarta.servlet.ServletContainerInitializer; import jakarta.servlet.ServletContext; import jakarta.servlet.ServletException; @@ -73,7 +71,7 @@ public void onStartup(Set> classes, ServletContext servletContext) thro try { WebApplication webApplication = (WebApplication) servletContext; InternalWebXmlManager manager = new InternalWebXmlManager(); - webApplication.getManager().setWebXmlManager(manager); + webApplication.setAttribute("cloud.piranha.extension.webxml.WebXmlManager", manager); InternalWebXmlParser parser = new InternalWebXmlParser(); InputStream inputStream = servletContext.getResourceAsStream("WEB-INF/web.xml"); diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlJspConfig.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlJspConfig.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlJspConfig.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlJspConfig.java index 80de9e8c5a..ab1ba19ca5 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlJspConfig.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlJspConfig.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.core.api; +package cloud.piranha.extension.webxml; import java.util.ArrayList; import java.util.List; diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlJspConfigTaglib.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlJspConfigTaglib.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlJspConfigTaglib.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlJspConfigTaglib.java index 3aabcc379d..6af1bc7888 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlJspConfigTaglib.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlJspConfigTaglib.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.core.api; +package cloud.piranha.extension.webxml; /** * A taglib inside jsp-config of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlListener.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlListener.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlListener.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlListener.java index 27262e137d..d93cc3259d 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlListener.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlListener.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.core.api; +package cloud.piranha.extension.webxml; /** * A listener inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlLoginConfig.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlLoginConfig.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlLoginConfig.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlLoginConfig.java index 86cddbd609..7546713834 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlLoginConfig.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlLoginConfig.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.core.api; +package cloud.piranha.extension.webxml; /** * A login-config inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlManager.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlManager.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlManager.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlManager.java index 1c6171e375..b8fb4e3afb 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlManager.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlManager.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.core.api; +package cloud.piranha.extension.webxml; /** * The WebXmlManager API. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlMimeMapping.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlMimeMapping.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlMimeMapping.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlMimeMapping.java index 64248a7328..4a412aec32 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlMimeMapping.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlMimeMapping.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.core.api; +package cloud.piranha.extension.webxml; /** * A mime-mapping inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlSecurityConstraint.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSecurityConstraint.java similarity index 99% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlSecurityConstraint.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSecurityConstraint.java index 3e3c5fa648..101517156c 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlSecurityConstraint.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSecurityConstraint.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.core.api; +package cloud.piranha.extension.webxml; import java.util.ArrayList; import java.util.List; diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServlet.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServlet.java similarity index 99% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlServlet.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServlet.java index 039766f1fd..a2b5c075a4 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServlet.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServlet.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.core.api; +package cloud.piranha.extension.webxml; import java.util.ArrayList; import java.util.List; diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletInitParam.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletInitParam.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlServletInitParam.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletInitParam.java index d3135e5ccb..5f8bdba032 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletInitParam.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletInitParam.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.core.api; +package cloud.piranha.extension.webxml; /** * A servlet init-param inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletMapping.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletMapping.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlServletMapping.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletMapping.java index 6df59db3c6..c0512c073e 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletMapping.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletMapping.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.core.api; +package cloud.piranha.extension.webxml; /** * A servlet-mapping inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletMultipartConfig.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletMultipartConfig.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlServletMultipartConfig.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletMultipartConfig.java index b9bef0b91c..f0512e97d6 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletMultipartConfig.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletMultipartConfig.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.core.api; +package cloud.piranha.extension.webxml; /** * A servlet multipart-config inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletSecurityRoleRef.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletSecurityRoleRef.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlServletSecurityRoleRef.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletSecurityRoleRef.java index 2cb63389c6..52164cb77c 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlServletSecurityRoleRef.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlServletSecurityRoleRef.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.core.api; +package cloud.piranha.extension.webxml; /** * A servlet security-role-ref inside of web.xml/web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlSessionConfig.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSessionConfig.java similarity index 98% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlSessionConfig.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSessionConfig.java index 40e33a2614..3e88bd5fac 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlSessionConfig.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSessionConfig.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.core.api; +package cloud.piranha.extension.webxml; /** * A session-config inside of web.xml or web-fragment.xml. diff --git a/core/api/src/main/java/cloud/piranha/core/api/WebXmlSessionConfigCookieConfig.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSessionConfigCookieConfig.java similarity index 97% rename from core/api/src/main/java/cloud/piranha/core/api/WebXmlSessionConfigCookieConfig.java rename to extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSessionConfigCookieConfig.java index ef23d1f5f9..010b7e3bce 100644 --- a/core/api/src/main/java/cloud/piranha/core/api/WebXmlSessionConfigCookieConfig.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/WebXmlSessionConfigCookieConfig.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.core.api; +package cloud.piranha.extension.webxml; /** * A session-config cookie-config inside of web.xml/web-fragment.xml. diff --git a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManager.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManager.java index 8faf72dedd..4b2bf0e265 100644 --- a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManager.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManager.java @@ -27,9 +27,9 @@ */ package cloud.piranha.extension.webxml.internal; -import cloud.piranha.core.api.WebXml; -import static cloud.piranha.core.api.WebXml.OTHERS_TAG; -import cloud.piranha.core.api.WebXmlManager; +import cloud.piranha.extension.webxml.WebXml; +import static cloud.piranha.extension.webxml.WebXml.OTHERS_TAG; +import cloud.piranha.extension.webxml.WebXmlManager; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; diff --git a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParser.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParser.java index f56aa54a5b..0e5c5790bb 100644 --- a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParser.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParser.java @@ -27,7 +27,7 @@ */ package cloud.piranha.extension.webxml.internal; -import static cloud.piranha.core.api.WebXml.OTHERS_TAG; +import static cloud.piranha.extension.webxml.WebXml.OTHERS_TAG; import static java.lang.System.Logger.Level.DEBUG; import static java.lang.System.Logger.Level.WARNING; import static java.util.regex.Pattern.quote; @@ -55,24 +55,24 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import cloud.piranha.core.api.WebXml; -import cloud.piranha.core.api.WebXmlContextParam; -import cloud.piranha.core.api.WebXmlDataSource; -import cloud.piranha.core.api.WebXmlErrorPage; -import cloud.piranha.core.api.WebXmlFilter; -import cloud.piranha.core.api.WebXmlFilterInitParam; -import cloud.piranha.core.api.WebXmlFilterMapping; -import cloud.piranha.core.api.WebXmlJspConfigTaglib; -import cloud.piranha.core.api.WebXmlListener; -import cloud.piranha.core.api.WebXmlLoginConfig; -import cloud.piranha.core.api.WebXmlMimeMapping; -import cloud.piranha.core.api.WebXmlSecurityConstraint; -import cloud.piranha.core.api.WebXmlServlet; -import cloud.piranha.core.api.WebXmlServletInitParam; -import cloud.piranha.core.api.WebXmlServletMapping; -import cloud.piranha.core.api.WebXmlServletMultipartConfig; -import cloud.piranha.core.api.WebXmlServletSecurityRoleRef; -import cloud.piranha.core.api.WebXmlSessionConfig; +import cloud.piranha.extension.webxml.WebXml; +import cloud.piranha.extension.webxml.WebXmlContextParam; +import cloud.piranha.extension.webxml.WebXmlDataSource; +import cloud.piranha.extension.webxml.WebXmlErrorPage; +import cloud.piranha.extension.webxml.WebXmlFilter; +import cloud.piranha.extension.webxml.WebXmlFilterInitParam; +import cloud.piranha.extension.webxml.WebXmlFilterMapping; +import cloud.piranha.extension.webxml.WebXmlJspConfigTaglib; +import cloud.piranha.extension.webxml.WebXmlListener; +import cloud.piranha.extension.webxml.WebXmlLoginConfig; +import cloud.piranha.extension.webxml.WebXmlMimeMapping; +import cloud.piranha.extension.webxml.WebXmlSecurityConstraint; +import cloud.piranha.extension.webxml.WebXmlServlet; +import cloud.piranha.extension.webxml.WebXmlServletInitParam; +import cloud.piranha.extension.webxml.WebXmlServletMapping; +import cloud.piranha.extension.webxml.WebXmlServletMultipartConfig; +import cloud.piranha.extension.webxml.WebXmlServletSecurityRoleRef; +import cloud.piranha.extension.webxml.WebXmlSessionConfig; /** * The web.xml / web-fragment.xml parser. diff --git a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlProcessor.java b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlProcessor.java index 1b2367ab6a..78cf8bcc7e 100644 --- a/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlProcessor.java +++ b/extension/webxml/src/main/java/cloud/piranha/extension/webxml/internal/InternalWebXmlProcessor.java @@ -49,18 +49,18 @@ import cloud.piranha.core.api.LocaleEncodingManager; import cloud.piranha.core.api.SecurityManager; import cloud.piranha.core.api.WebApplication; -import cloud.piranha.core.api.WebXml; -import cloud.piranha.core.api.WebXmlContextParam; -import cloud.piranha.core.api.WebXmlDataSource; -import cloud.piranha.core.api.WebXmlErrorPage; -import cloud.piranha.core.api.WebXmlFilterInitParam; -import cloud.piranha.core.api.WebXmlJspConfigTaglib; -import cloud.piranha.core.api.WebXmlListener; -import cloud.piranha.core.api.WebXmlLoginConfig; -import cloud.piranha.core.api.WebXmlServlet; -import cloud.piranha.core.api.WebXmlServletMapping; -import cloud.piranha.core.api.WebXmlServletMultipartConfig; -import cloud.piranha.core.api.WebXmlSessionConfig; +import cloud.piranha.extension.webxml.WebXml; +import cloud.piranha.extension.webxml.WebXmlContextParam; +import cloud.piranha.extension.webxml.WebXmlDataSource; +import cloud.piranha.extension.webxml.WebXmlErrorPage; +import cloud.piranha.extension.webxml.WebXmlFilterInitParam; +import cloud.piranha.extension.webxml.WebXmlJspConfigTaglib; +import cloud.piranha.extension.webxml.WebXmlListener; +import cloud.piranha.extension.webxml.WebXmlLoginConfig; +import cloud.piranha.extension.webxml.WebXmlServlet; +import cloud.piranha.extension.webxml.WebXmlServletMapping; +import cloud.piranha.extension.webxml.WebXmlServletMultipartConfig; +import cloud.piranha.extension.webxml.WebXmlSessionConfig; import cloud.piranha.core.api.WelcomeFileManager; import cloud.piranha.core.impl.DefaultJspConfigDescriptor; import cloud.piranha.core.impl.DefaultTaglibDescriptor; diff --git a/extension/webxml/src/test/java/cloud/piranha/extension/webxml/DenyUncoveredMethodsTest.java b/extension/webxml/src/test/java/cloud/piranha/extension/webxml/DenyUncoveredMethodsTest.java index d004884628..ff0a9d0418 100644 --- a/extension/webxml/src/test/java/cloud/piranha/extension/webxml/DenyUncoveredMethodsTest.java +++ b/extension/webxml/src/test/java/cloud/piranha/extension/webxml/DenyUncoveredMethodsTest.java @@ -27,13 +27,6 @@ */ package cloud.piranha.extension.webxml; -import cloud.piranha.core.impl.DefaultWebApplication; -import cloud.piranha.extension.security.servlet.ServletSecurityManagerInitializer; -import cloud.piranha.resource.impl.DirectoryResource; -import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Test; - /** * The JUnit tests testing web.xml <context-param>. * @@ -41,11 +34,13 @@ */ class DenyUncoveredMethodsTest { + // TODO - move this test to security-servlet extension. /** * Test getDenyUncoveredMethods method. * * @throws Exception when a serious error occurs. */ + /* @Test void testGetDenyUncoveredMethods() throws Exception { DefaultWebApplication webApplication = new DefaultWebApplication(); @@ -55,4 +50,5 @@ void testGetDenyUncoveredMethods() throws Exception { webApplication.initialize(); assertTrue(webApplication.getManager().getSecurityManager().getDenyUncoveredHttpMethods()); } + */ } diff --git a/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManagerTest.java b/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManagerTest.java index 3954201de2..60ac6f3abc 100644 --- a/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManagerTest.java +++ b/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlManagerTest.java @@ -27,8 +27,8 @@ */ package cloud.piranha.extension.webxml.internal; -import cloud.piranha.core.api.WebXml; -import static cloud.piranha.core.api.WebXml.OTHERS_TAG; +import cloud.piranha.extension.webxml.WebXml; +import static cloud.piranha.extension.webxml.WebXml.OTHERS_TAG; import java.util.Arrays; import java.util.Collections; import java.util.List; diff --git a/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParserTest.java b/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParserTest.java index de2a03b454..8da03562cc 100644 --- a/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParserTest.java +++ b/extension/webxml/src/test/java/cloud/piranha/extension/webxml/internal/InternalWebXmlParserTest.java @@ -28,8 +28,8 @@ package cloud.piranha.extension.webxml.internal; import cloud.piranha.core.impl.DefaultWebApplication; -import cloud.piranha.core.api.WebXml; -import cloud.piranha.core.api.WebXmlServletMapping; +import cloud.piranha.extension.webxml.WebXml; +import cloud.piranha.extension.webxml.WebXmlServletMapping; import cloud.piranha.resource.impl.DirectoryResource; import java.io.File; import java.io.InputStream;