diff --git a/pom.xml b/pom.xml
index b3199ee076..44a6384d67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -258,10 +258,6 @@
1.1
2.1.1
-
-
- 9.0.90
-
5.9.2
@@ -1304,24 +1300,25 @@
cssparser
0.9.30
+
jakarta.validation
jakarta.validation-api
- 2.0.2
+ 3.0.2
org.hibernate.validator
hibernate-validator
- 6.2.5.Final
+ 8.0.1.Final
runtime
- org.mortbay.jasper
- apache-el
- ${apachache-el.version}
-
- test
+ org.glassfish.expressly
+ expressly
+ 5.0.0
+
+ provided
diff --git a/xwiki-commons-core/pom.xml b/xwiki-commons-core/pom.xml
index 164db130c4..c1ac553f81 100644
--- a/xwiki-commons-core/pom.xml
+++ b/xwiki-commons-core/pom.xml
@@ -224,6 +224,64 @@
-->
+
+ Not breakage from binary compatibility point of view
+ allowed
+
+ -
+ true
+
java.method.numberOfParametersChanged
+ method void org.xwiki.extension.wrap.WrappingIndexedExtension<T extends org.xwiki.extension.index.IndexedExtension>::<init>(T)
+ method void org.xwiki.extension.wrap.WrappingIndexedExtension<T extends org.xwiki.extension.Extension>::<init>()
+
+ -
+ true
+
java.class.superTypeTypeParametersChanged
+ class org.xwiki.extension.wrap.WrappingIndexedExtension<T extends org.xwiki.extension.index.IndexedExtension>
+ class org.xwiki.extension.wrap.WrappingIndexedExtension<T extends org.xwiki.extension.Extension>
+ org.xwiki.extension.wrap.WrappingRatingExtension<T extends org.xwiki.extension.index.IndexedExtension>
+ org.xwiki.extension.wrap.WrappingRatingExtension<T extends org.xwiki.extension.Extension>
+
+ -
+ true
+
java.method.numberOfParametersChanged
+ method void org.xwiki.extension.wrap.WrappingRatingExtension<T extends org.xwiki.extension.rating.RatingExtension>::<init>(T)
+ method void org.xwiki.extension.wrap.WrappingRatingExtension<T extends org.xwiki.extension.Extension>::<init>()
+
+ -
+ true
+
java.class.superTypeTypeParametersChanged
+ class org.xwiki.extension.wrap.WrappingRatingExtension<T extends org.xwiki.extension.rating.RatingExtension>
+ class org.xwiki.extension.wrap.WrappingRatingExtension<T extends org.xwiki.extension.Extension>
+ org.xwiki.extension.wrap.WrappingRemoteExtension<T extends org.xwiki.extension.rating.RatingExtension>
+ org.xwiki.extension.wrap.WrappingRemoteExtension<T extends org.xwiki.extension.Extension>
+
+ -
+ true
+
java.method.numberOfParametersChanged
+ method void org.xwiki.extension.wrap.WrappingRemoteExtension<T extends org.xwiki.extension.RemoteExtension>::<init>(T)
+ method void org.xwiki.extension.wrap.WrappingRemoteExtension<T extends org.xwiki.extension.Extension>::<init>()
+
+ -
+ true
+
java.class.superTypeTypeParametersChanged
+ class org.xwiki.extension.wrap.WrappingRemoteExtension<T extends org.xwiki.extension.RemoteExtension>
+ class org.xwiki.extension.wrap.WrappingRemoteExtension<T extends org.xwiki.extension.Extension>
+ org.xwiki.extension.wrap.WrappingExtension<T extends org.xwiki.extension.RemoteExtension>
+ org.xwiki.extension.wrap.WrappingExtension<T extends org.xwiki.extension.Extension>
+
+ -
+ true
+
java.annotation.attributeValueChanged
+ class org.xwiki.extension.repository.xwiki.model.jaxb.AbstractExtension
+ class org.xwiki.extension.repository.xwiki.model.jaxb.AbstractExtension
+ javax.xml.bind.annotation.XmlType
+ propOrder
+ {"rating", "summary", "description", "licenses", "website", "authors", "features", "extensionFeatures", "scm", "issueManagement", "category", "allowedNamespaces", "recommended", "properties"}
+ {"rating", "summary", "description", "licenses", "website", "authors", "supportPlans", "features", "extensionFeatures", "scm", "issueManagement", "category", "allowedNamespaces", "recommended", "properties"}
+
+
+
diff --git a/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/test/java/org/xwiki/component/annotation/JavaxComponentAnnotationLoaderTest.java b/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/test/java/org/xwiki/component/annotation/JavaxComponentAnnotationLoaderTest.java
index 7e330b7434..73c90d49a1 100644
--- a/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/test/java/org/xwiki/component/annotation/JavaxComponentAnnotationLoaderTest.java
+++ b/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/test/java/org/xwiki/component/annotation/JavaxComponentAnnotationLoaderTest.java
@@ -22,8 +22,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import java.lang.reflect.Type;
import java.util.Set;
@@ -35,15 +33,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
-import org.xwiki.component.JavaxProviderIntegrationTest;
-import org.xwiki.component.descriptor.ComponentDescriptor;
-import org.xwiki.component.descriptor.DefaultComponentDescriptor;
-import org.xwiki.component.internal.ContextComponentManagerProvider;
-import org.xwiki.component.internal.RootComponentManager;
-import org.xwiki.component.internal.embed.EmbeddableComponentManagerFactory;
-import org.xwiki.component.internal.multi.DefaultComponentManagerManager;
-import org.xwiki.component.internal.namespace.DefaultNamespaceValidator;
-import org.xwiki.component.manager.ComponentManager;
import org.xwiki.component.util.DefaultParameterizedType;
/**
diff --git a/xwiki-commons-core/xwiki-commons-environment/xwiki-commons-environment-servlet/src/main/java/org/xwiki/environment/internal/ServletEnvironment.java b/xwiki-commons-core/xwiki-commons-environment/xwiki-commons-environment-servlet/src/main/java/org/xwiki/environment/internal/ServletEnvironment.java
index 64be97d2b9..76f93bae91 100644
--- a/xwiki-commons-core/xwiki-commons-environment/xwiki-commons-environment-servlet/src/main/java/org/xwiki/environment/internal/ServletEnvironment.java
+++ b/xwiki-commons-core/xwiki-commons-environment/xwiki-commons-environment-servlet/src/main/java/org/xwiki/environment/internal/ServletEnvironment.java
@@ -30,7 +30,7 @@
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.xwiki.component.annotation.Component;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ServletContext;
@@ -60,7 +60,7 @@ public class ServletEnvironment extends AbstractEnvironment
public void setServletContext(javax.servlet.ServletContext servletContext)
{
this.javaxServletContext = servletContext;
- this.jakartaServletContext = ServletBridge.toJakarta(servletContext);
+ this.jakartaServletContext = JakartaServletBridge.toJakarta(servletContext);
}
/**
@@ -79,7 +79,7 @@ public void setServletContext(ServletContext servletContext)
public javax.servlet.ServletContext getServletContext()
{
if (this.javaxServletContext == null) {
- this.javaxServletContext = ServletBridge.toJavax(getJakartaServletContext());
+ this.javaxServletContext = JakartaServletBridge.toJavax(getJakartaServletContext());
}
return this.javaxServletContext;
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/pom.xml b/xwiki-commons-core/xwiki-commons-jakartabridge/pom.xml
index b3438ff704..debd10bce7 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/pom.xml
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/pom.xml
@@ -24,7 +24,7 @@
xwiki-commons-core
org.xwiki.commons
- 16.6.0-SNAPSHOT
+ 16.9.0-SNAPSHOT
xwiki-commons-jakartabridge
XWiki Commons - Jakarta Bridge
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/pom.xml b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/pom.xml
index a9b7808eff..53fd89f59e 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/pom.xml
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/pom.xml
@@ -24,7 +24,7 @@
xwiki-commons-jakartabridge
org.xwiki.commons
- 16.6.0-SNAPSHOT
+ 16.9.0-SNAPSHOT
xwiki-commons-jakartabridge-servlet
XWiki Commons - Jakarta Bridge - Servlet
@@ -56,7 +56,10 @@
default
- org/xwiki/jakartabridge/servlet/ServletBridge.java
+ org/xwiki/jakartabridge/servlet/JakartaServletBridge.java,
+ org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequestWrapper.java,
+ org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequestWrapper.java,
+ org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletContext.java
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/ServletBridge.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JakartaServletBridge.java
similarity index 65%
rename from xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/ServletBridge.java
rename to xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JakartaServletBridge.java
index f66397f760..8cf1a277b4 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/ServletBridge.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JakartaServletBridge.java
@@ -23,6 +23,7 @@
import java.util.EnumSet;
import java.util.Enumeration;
import java.util.Set;
+import java.util.function.Function;
import java.util.stream.Collectors;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxAsyncContext;
@@ -32,11 +33,13 @@
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxFilterConfig;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxFilterRegistration;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxHttpServletRequest;
+import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxHttpServletRequestWrapper;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxHttpServletResponse;
+import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxHttpServletResponseWrapper;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxHttpSession;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxHttpSessionContext;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxPart;
-import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxReaderListener;
+import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxReadListener;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxRequestDispatcher;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServlet;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletConfig;
@@ -45,7 +48,9 @@
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletOutputStream;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletRegistration;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletRequest;
+import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletRequestWrapper;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletResponse;
+import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxServletResponseWrapper;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxSessionCookieConfig;
import org.xwiki.jakartabridge.servlet.internal.JakartaToJavaxWriteListener;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaAsyncContext;
@@ -55,11 +60,13 @@
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaFilterConfig;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaFilterRegistration;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaHttpServletRequest;
+import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaHttpServletRequestWrapper;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaHttpServletResponse;
+import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaHttpServletResponseWrapper;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaHttpSession;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaHttpSessionContext;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaPart;
-import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaReaderListener;
+import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaReadListener;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaRequestDispatcher;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServlet;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletConfig;
@@ -68,7 +75,9 @@
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletOutputStream;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletRegistration;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletRequest;
+import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletRequestWrapper;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletResponse;
+import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaServletResponseWrapper;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaSessionCookieConfig;
import org.xwiki.jakartabridge.servlet.internal.JavaxToJakartaWriteListener;
@@ -90,7 +99,9 @@
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.ServletRegistration;
import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletRequestWrapper;
import jakarta.servlet.ServletResponse;
+import jakarta.servlet.ServletResponseWrapper;
import jakarta.servlet.ServletSecurityElement;
import jakarta.servlet.SessionCookieConfig;
import jakarta.servlet.SessionTrackingMode;
@@ -98,7 +109,9 @@
import jakarta.servlet.descriptor.JspConfigDescriptor;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponseWrapper;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionContext;
import jakarta.servlet.http.Part;
@@ -107,24 +120,80 @@
* @version $Id$
* @since 42.0.0
*/
-public final class ServletBridge
+public final class JakartaServletBridge
{
- private ServletBridge()
+ private JakartaServletBridge()
{
}
+ //////////////////////////////////////////////////
+ // Wrapped
+
+ /**
+ * @param the jakarta type
+ * @param the javax type
+ * @param jakarta the jakarta version
+ * @param constructor the reference to the {@link JakartaToJavaxWrapper} implementation's constructor
+ * @return the javax version
+ */
+ private static X toJavax(K jakarta, Function constructor)
+ {
+ X javax;
+
+ if (jakarta == null) {
+ javax = null;
+ } else if (jakarta instanceof JakartaToJavaxWrapper wrapper) {
+ javax = (X) wrapper.getJavax();
+ } else {
+ javax = constructor.apply(jakarta);
+ }
+
+ return javax;
+ }
+
+ /**
+ * @param the javax type
+ * @param the jakarta type
+ * @param javax the javax version
+ * @param constructor the reference to the {@link JavaxToJakartaWrapper} implementation's constructor
+ * @return the jakarta version
+ */
+ private static K toJakarta(X javax, Function constructor)
+ {
+ K jakarta;
+
+ if (javax == null) {
+ jakarta = null;
+ } else if (javax instanceof JavaxToJakartaWrapper wrapper) {
+ jakarta = (K) wrapper.getJakarta();
+ } else {
+ jakarta = constructor.apply(javax);
+ }
+
+ return jakarta;
+ }
+
/**
* @param jakarta the jakarta version
* @return the javax version
*/
public static javax.servlet.ServletRequest toJavax(ServletRequest jakarta)
{
+ javax.servlet.ServletRequest javax;
+
if (jakarta == null) {
- return null;
+ javax = null;
+ } else if (jakarta instanceof JakartaToJavaxServletRequest> bridge) {
+ javax = bridge.getJavax();
+ } else if (jakarta instanceof HttpServletRequest httpjakarta) {
+ javax = toJavax(httpjakarta);
+ } else if (jakarta instanceof ServletRequestWrapper wrapper) {
+ javax = new JavaxToJakartaServletRequestWrapper(wrapper);
+ } else {
+ javax = new JavaxToJakartaServletRequest(jakarta);
}
- return jakarta instanceof HttpServletRequest httpjakarta ? toJavax(httpjakarta)
- : new JavaxToJakartaServletRequest(jakarta);
+ return javax;
}
/**
@@ -133,11 +202,20 @@ public static javax.servlet.ServletRequest toJavax(ServletRequest jakarta)
*/
public static javax.servlet.http.HttpServletRequest toJavax(HttpServletRequest jakarta)
{
+ javax.servlet.http.HttpServletRequest javax;
+
if (jakarta == null) {
- return null;
+ javax = null;
+ } else if (jakarta instanceof JakartaToJavaxHttpServletRequest> bridge) {
+ javax = bridge.getJavax();
+ } else if (jakarta instanceof HttpServletRequestWrapper wrapper) {
+ javax =
+ new JavaxToJakartaHttpServletRequestWrapper(wrapper);
+ } else {
+ javax = new JavaxToJakartaHttpServletRequest(jakarta);
}
- return new JavaxToJakartaHttpServletRequest(jakarta);
+ return javax;
}
/**
@@ -146,12 +224,21 @@ public static javax.servlet.http.HttpServletRequest toJavax(HttpServletRequest j
*/
public static ServletRequest toJakarta(javax.servlet.ServletRequest javax)
{
+ ServletRequest jakarta;
+
if (javax == null) {
- return null;
+ jakarta = null;
+ } else if (javax instanceof JavaxToJakartaServletRequest> bridge) {
+ jakarta = bridge.getJakarta();
+ } else if (javax instanceof javax.servlet.http.HttpServletRequest httpjakarta) {
+ jakarta = toJakarta(httpjakarta);
+ } else if (javax instanceof javax.servlet.ServletRequestWrapper wrapper) {
+ jakarta = new JakartaToJavaxServletRequestWrapper(wrapper);
+ } else {
+ jakarta = new JakartaToJavaxServletRequest(javax);
}
- return javax instanceof javax.servlet.http.HttpServletRequest httpjakarta ? toJakarta(httpjakarta)
- : new JakartaToJavaxServletRequest(javax);
+ return jakarta;
}
/**
@@ -160,11 +247,20 @@ public static ServletRequest toJakarta(javax.servlet.ServletRequest javax)
*/
public static HttpServletRequest toJakarta(javax.servlet.http.HttpServletRequest javax)
{
+ HttpServletRequest jakarta;
+
if (javax == null) {
- return null;
+ jakarta = null;
+ } else if (javax instanceof JavaxToJakartaHttpServletRequest> bridge) {
+ jakarta = bridge.getJakarta();
+ } else if (javax instanceof javax.servlet.http.HttpServletRequestWrapper wrapper) {
+ jakarta =
+ new JakartaToJavaxHttpServletRequestWrapper(wrapper);
+ } else {
+ jakarta = new JakartaToJavaxHttpServletRequest(javax);
}
- return new JakartaToJavaxHttpServletRequest(javax);
+ return jakarta;
}
/**
@@ -173,12 +269,21 @@ public static HttpServletRequest toJakarta(javax.servlet.http.HttpServletRequest
*/
public static javax.servlet.ServletResponse toJavax(ServletResponse jakarta)
{
+ javax.servlet.ServletResponse javax;
+
if (jakarta == null) {
- return null;
+ javax = null;
+ } else if (jakarta instanceof JakartaToJavaxServletResponse> bridge) {
+ javax = bridge.getJavax();
+ } else if (jakarta instanceof HttpServletResponse httpjakarta) {
+ javax = toJavax(httpjakarta);
+ } else if (jakarta instanceof ServletResponseWrapper wrapper) {
+ javax = new JavaxToJakartaServletResponseWrapper(wrapper);
+ } else {
+ javax = new JavaxToJakartaServletResponse(jakarta);
}
- return jakarta instanceof HttpServletResponse httpjakarta ? toJavax(httpjakarta)
- : new JavaxToJakartaServletResponse(jakarta);
+ return javax;
}
/**
@@ -187,11 +292,20 @@ public static javax.servlet.ServletResponse toJavax(ServletResponse jakarta)
*/
public static javax.servlet.http.HttpServletResponse toJavax(HttpServletResponse jakarta)
{
+ javax.servlet.http.HttpServletResponse javax;
+
if (jakarta == null) {
- return null;
+ javax = null;
+ } else if (jakarta instanceof JakartaToJavaxHttpServletResponse> bridge) {
+ javax = bridge.getJavax();
+ } else if (jakarta instanceof HttpServletResponseWrapper wrapper) {
+ javax =
+ new JavaxToJakartaHttpServletResponseWrapper(wrapper);
+ } else {
+ javax = new JavaxToJakartaHttpServletResponse(jakarta);
}
- return new JavaxToJakartaHttpServletResponse(jakarta);
+ return javax;
}
/**
@@ -200,12 +314,21 @@ public static javax.servlet.http.HttpServletResponse toJavax(HttpServletResponse
*/
public static ServletResponse toJakarta(javax.servlet.ServletResponse javax)
{
+ ServletResponse jakarta;
+
if (javax == null) {
- return null;
+ jakarta = null;
+ } else if (javax instanceof JavaxToJakartaServletResponse> bridge) {
+ jakarta = bridge.getJakarta();
+ } else if (javax instanceof javax.servlet.http.HttpServletResponse httpjakarta) {
+ jakarta = toJakarta(httpjakarta);
+ } else if (javax instanceof javax.servlet.ServletResponseWrapper wrapper) {
+ jakarta = new JakartaToJavaxServletResponseWrapper(wrapper);
+ } else {
+ jakarta = new JakartaToJavaxServletResponse(javax);
}
- return javax instanceof javax.servlet.http.HttpServletResponse httpjakarta ? toJakarta(httpjakarta)
- : new JakartaToJavaxServletResponse(javax);
+ return jakarta;
}
/**
@@ -214,11 +337,20 @@ public static ServletResponse toJakarta(javax.servlet.ServletResponse javax)
*/
public static HttpServletResponse toJakarta(javax.servlet.http.HttpServletResponse javax)
{
+ HttpServletResponse jakarta;
+
if (javax == null) {
- return null;
+ jakarta = null;
+ } else if (javax instanceof JavaxToJakartaHttpServletResponse> bridge) {
+ jakarta = bridge.getJakarta();
+ } else if (javax instanceof javax.servlet.http.HttpServletResponseWrapper wrapper) {
+ jakarta =
+ new JakartaToJavaxHttpServletResponseWrapper(wrapper);
+ } else {
+ jakarta = new JakartaToJavaxHttpServletResponse(javax);
}
- return new JakartaToJavaxHttpServletResponse(javax);
+ return jakarta;
}
/**
@@ -227,11 +359,7 @@ public static HttpServletResponse toJakarta(javax.servlet.http.HttpServletRespon
*/
public static javax.servlet.RequestDispatcher toJavax(RequestDispatcher jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaRequestDispatcher(jakarta);
+ return toJavax(jakarta, JavaxToJakartaRequestDispatcher::new);
}
/**
@@ -240,11 +368,7 @@ public static javax.servlet.RequestDispatcher toJavax(RequestDispatcher jakarta)
*/
public static RequestDispatcher toJakarta(javax.servlet.RequestDispatcher javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxRequestDispatcher(javax);
+ return toJakarta(javax, JakartaToJavaxRequestDispatcher::new);
}
/**
@@ -253,11 +377,7 @@ public static RequestDispatcher toJakarta(javax.servlet.RequestDispatcher javax)
*/
public static javax.servlet.ServletContext toJavax(ServletContext jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaServletContext(jakarta);
+ return toJavax(jakarta, JavaxToJakartaServletContext::new);
}
/**
@@ -266,11 +386,7 @@ public static javax.servlet.ServletContext toJavax(ServletContext jakarta)
*/
public static ServletContext toJakarta(javax.servlet.ServletContext javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxServletContext(javax);
+ return toJakarta(javax, JakartaToJavaxServletContext::new);
}
/**
@@ -279,11 +395,7 @@ public static ServletContext toJakarta(javax.servlet.ServletContext javax)
*/
public static javax.servlet.Servlet toJavax(Servlet jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaServlet(jakarta);
+ return toJavax(jakarta, JavaxToJakartaServlet::new);
}
/**
@@ -292,11 +404,7 @@ public static javax.servlet.Servlet toJavax(Servlet jakarta)
*/
public static Servlet toJakarta(javax.servlet.Servlet javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxServlet(javax);
+ return toJakarta(javax, JakartaToJavaxServlet::new);
}
/**
@@ -305,11 +413,7 @@ public static Servlet toJakarta(javax.servlet.Servlet javax)
*/
public static javax.servlet.http.HttpSession toJavax(HttpSession jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaHttpSession(jakarta);
+ return toJavax(jakarta, JavaxToJakartaHttpSession::new);
}
/**
@@ -318,11 +422,7 @@ public static javax.servlet.http.HttpSession toJavax(HttpSession jakarta)
*/
public static HttpSession toJakarta(javax.servlet.http.HttpSession javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxHttpSession(javax);
+ return toJakarta(javax, JakartaToJavaxHttpSession::new);
}
/**
@@ -331,11 +431,7 @@ public static HttpSession toJakarta(javax.servlet.http.HttpSession javax)
*/
public static javax.servlet.http.Part toJavax(Part jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaPart(jakarta);
+ return toJavax(jakarta, JavaxToJakartaPart::new);
}
/**
@@ -344,37 +440,7 @@ public static javax.servlet.http.Part toJavax(Part jakarta)
*/
public static Part toJakarta(javax.servlet.http.Part javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxPart(javax);
- }
-
- /**
- * @param jakarta the jakarta version
- * @return the javax version
- */
- public static javax.servlet.http.Cookie toJavax(Cookie jakarta)
- {
- if (jakarta == null) {
- return null;
- }
-
- return new javax.servlet.http.Cookie(jakarta.getName(), jakarta.getValue());
- }
-
- /**
- * @param javax the javax version
- * @return the jakarta version
- */
- public static Cookie toJakarta(javax.servlet.http.Cookie javax)
- {
- if (javax == null) {
- return null;
- }
-
- return new Cookie(javax.getName(), javax.getValue());
+ return toJakarta(javax, JakartaToJavaxPart::new);
}
/**
@@ -383,11 +449,7 @@ public static Cookie toJakarta(javax.servlet.http.Cookie javax)
*/
public static javax.servlet.ReadListener toJavax(ReadListener jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaReaderListener(jakarta);
+ return toJavax(jakarta, JavaxToJakartaReadListener::new);
}
/**
@@ -396,11 +458,7 @@ public static javax.servlet.ReadListener toJavax(ReadListener jakarta)
*/
public static ReadListener toJakarta(javax.servlet.ReadListener javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxReaderListener(javax);
+ return toJakarta(javax, JakartaToJavaxReadListener::new);
}
/**
@@ -409,11 +467,7 @@ public static ReadListener toJakarta(javax.servlet.ReadListener javax)
*/
public static javax.servlet.WriteListener toJavax(WriteListener jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaWriteListener(jakarta);
+ return toJavax(jakarta, JavaxToJakartaWriteListener::new);
}
/**
@@ -422,421 +476,337 @@ public static javax.servlet.WriteListener toJavax(WriteListener jakarta)
*/
public static WriteListener toJakarta(javax.servlet.WriteListener javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxWriteListener(javax);
+ return toJakarta(javax, JakartaToJavaxWriteListener::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.DispatcherType toJavax(DispatcherType jakarta)
+ public static javax.servlet.ServletOutputStream toJavax(ServletOutputStream jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return javax.servlet.DispatcherType.valueOf(jakarta.name());
+ return toJavax(jakarta, JavaxToJakartaServletOutputStream::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static DispatcherType toJakarta(javax.servlet.DispatcherType javax)
+ public static ServletOutputStream toJakarta(javax.servlet.ServletOutputStream javax)
{
- if (javax == null) {
- return null;
- }
+ return toJakarta(javax, JakartaToJavaxServletOutputStream::new);
- return DispatcherType.valueOf(javax.name());
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.ServletOutputStream toJavax(ServletOutputStream jakarta)
+ public static javax.servlet.http.HttpSessionContext toJavax(HttpSessionContext jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaServletOutputStream(jakarta);
+ return toJavax(jakarta, JavaxToJakartaHttpSessionContext::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static ServletOutputStream toJakarta(javax.servlet.ServletOutputStream javax)
+ public static HttpSessionContext toJakarta(javax.servlet.http.HttpSessionContext javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxServletOutputStream(javax);
+ return toJakarta(javax, JakartaToJavaxHttpSessionContext::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.http.HttpSessionContext toJavax(HttpSessionContext jakarta)
+ public static javax.servlet.ServletConfig toJavax(ServletConfig jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaHttpSessionContext(jakarta);
+ return toJavax(jakarta, JavaxToJakartaServletConfig::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static HttpSessionContext toJakarta(javax.servlet.http.HttpSessionContext javax)
+ public static ServletConfig toJakarta(javax.servlet.ServletConfig javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxHttpSessionContext(javax);
+ return toJakarta(javax, JakartaToJavaxServletConfig::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.ServletConfig toJavax(ServletConfig jakarta)
+ public static javax.servlet.AsyncContext toJavax(AsyncContext jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaServletConfig(jakarta);
+ return toJavax(jakarta, JavaxToJakartaAsyncContext::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static ServletConfig toJakarta(javax.servlet.ServletConfig javax)
+ public static AsyncContext toJakarta(javax.servlet.AsyncContext javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxServletConfig(javax);
+ return toJakarta(javax, JakartaToJavaxAsyncContext::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.AsyncContext toJavax(AsyncContext jakarta)
+ public static javax.servlet.SessionCookieConfig toJavax(SessionCookieConfig jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaAsyncContext(jakarta);
+ return toJavax(jakarta, JavaxToJakartaSessionCookieConfig::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static AsyncContext toJakarta(javax.servlet.AsyncContext javax)
+ public static SessionCookieConfig toJakarta(javax.servlet.SessionCookieConfig javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxAsyncContext(javax);
+ return toJakarta(javax, JakartaToJavaxSessionCookieConfig::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.descriptor.JspConfigDescriptor toJavax(JspConfigDescriptor jakarta)
+ public static javax.servlet.FilterRegistration toJavax(FilterRegistration jakarta)
{
- // TODO
- throw new UnsupportedOperationException();
+ return toJavax(jakarta, JavaxToJakartaFilterRegistration::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static JspConfigDescriptor toJakarta(javax.servlet.descriptor.JspConfigDescriptor javax)
+ public static FilterRegistration toJakarta(javax.servlet.FilterRegistration javax)
{
- // TODO
- throw new UnsupportedOperationException();
+ return toJakarta(javax, JakartaToJavaxFilterRegistration::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.SessionTrackingMode toJavax(SessionTrackingMode jakarta)
+ public static javax.servlet.FilterRegistration.Dynamic toJavax(FilterRegistration.Dynamic jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return javax.servlet.SessionTrackingMode.valueOf(jakarta.name());
+ return toJavax(jakarta, JavaxToJakartaFilterRegistration.Dynamic::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static SessionTrackingMode toJakarta(javax.servlet.SessionTrackingMode javax)
+ public static jakarta.servlet.FilterRegistration.Dynamic toJakarta(javax.servlet.FilterRegistration.Dynamic javax)
{
- if (javax == null) {
- return null;
- }
-
- return SessionTrackingMode.valueOf(javax.name());
+ return toJakarta(javax, JakartaToJavaxFilterRegistration.Dynamic::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static Set toJavax(Set jakarta)
+ public static javax.servlet.ServletRegistration toJavax(ServletRegistration jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return jakarta.stream().map(ServletBridge::toJavax).collect(Collectors.toSet());
+ return toJavax(jakarta, JavaxToJakartaServletRegistration::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static Set toJakarta(Set javax)
+ public static ServletRegistration toJakarta(javax.servlet.ServletRegistration javax)
{
- if (javax == null) {
- return null;
- }
-
- return javax.stream().map(ServletBridge::toJakarta).collect(Collectors.toSet());
+ return toJakarta(javax, JakartaToJavaxServletRegistration::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.SessionCookieConfig toJavax(SessionCookieConfig jakarta)
+ public static javax.servlet.ServletRegistration.Dynamic toJavax(ServletRegistration.Dynamic jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaSessionCookieConfig(jakarta);
+ return toJavax(jakarta, JavaxToJakartaServletRegistration.Dynamic::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static SessionCookieConfig toJakarta(javax.servlet.SessionCookieConfig javax)
+ public static ServletRegistration.Dynamic toJakarta(javax.servlet.ServletRegistration.Dynamic javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxSessionCookieConfig(javax);
+ return toJakarta(javax, JakartaToJavaxServletRegistration.Dynamic::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.FilterRegistration toJavax(FilterRegistration jakarta)
+ public static javax.servlet.Filter toJavax(Filter jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaFilterRegistration(jakarta);
+ return toJavax(jakarta, JavaxToJakartaFilter::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static FilterRegistration toJakarta(javax.servlet.FilterRegistration javax)
+ public static Filter toJakarta(javax.servlet.Filter javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxFilterRegistration(javax);
+ return toJakarta(javax, JakartaToJavaxFilter::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.FilterRegistration.Dynamic toJavax(FilterRegistration.Dynamic jakarta)
+ public static javax.servlet.AsyncListener toJavax(AsyncListener jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaFilterRegistration.Dynamic(jakarta);
+ return toJavax(jakarta, JavaxToJakartaAsyncListener::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static jakarta.servlet.FilterRegistration.Dynamic toJakarta(javax.servlet.FilterRegistration.Dynamic javax)
+ public static AsyncListener toJakarta(javax.servlet.AsyncListener javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxFilterRegistration.Dynamic(javax);
+ return toJakarta(javax, JakartaToJavaxAsyncListener::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.ServletRegistration toJavax(ServletRegistration jakarta)
+ public static javax.servlet.ServletInputStream toJavax(ServletInputStream jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaServletRegistration(jakarta);
+ return toJavax(jakarta, JavaxToJakartaServletInputStream::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static ServletRegistration toJakarta(javax.servlet.ServletRegistration javax)
+ public static ServletInputStream toJakarta(javax.servlet.ServletInputStream javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxServletRegistration(javax);
+ return toJakarta(javax, JakartaToJavaxServletInputStream::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.ServletRegistration.Dynamic toJavax(ServletRegistration.Dynamic jakarta)
+ public static javax.servlet.FilterChain toJavax(FilterChain jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaServletRegistration.Dynamic(jakarta);
+ return toJavax(jakarta, JavaxToJakartaFilterChain::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static ServletRegistration.Dynamic toJakarta(javax.servlet.ServletRegistration.Dynamic javax)
+ public static FilterChain toJakarta(javax.servlet.FilterChain javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxServletRegistration.Dynamic(javax);
+ return toJakarta(javax, JakartaToJavaxFilterChain::new);
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.Filter toJavax(Filter jakarta)
+ public static javax.servlet.FilterConfig toJavax(FilterConfig jakarta)
{
- if (jakarta == null) {
- return null;
- }
-
- return new JavaxToJakartaFilter(jakarta);
+ return toJavax(jakarta, JavaxToJakartaFilterConfig::new);
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static Filter toJakarta(javax.servlet.Filter javax)
+ public static FilterConfig toJakarta(javax.servlet.FilterConfig javax)
{
- if (javax == null) {
- return null;
- }
-
- return new JakartaToJavaxFilter(javax);
+ return toJakarta(javax, JakartaToJavaxFilterConfig::new);
}
+ //////////////////////////////////////////////////
+ // Converted
+
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.AsyncListener toJavax(AsyncListener jakarta)
+ public static javax.servlet.http.Cookie toJavax(Cookie jakarta)
{
if (jakarta == null) {
return null;
}
- return new JavaxToJakartaAsyncListener(jakarta);
+ javax.servlet.http.Cookie javax = new javax.servlet.http.Cookie(jakarta.getName(), jakarta.getValue());
+
+ javax.setComment(jakarta.getComment());
+ javax.setDomain(jakarta.getDomain());
+ javax.setHttpOnly(jakarta.isHttpOnly());
+ javax.setMaxAge(jakarta.getMaxAge());
+ javax.setPath(jakarta.getPath());
+ javax.setSecure(jakarta.getSecure());
+ javax.setValue(jakarta.getValue());
+ javax.setVersion(jakarta.getVersion());
+
+ return javax;
}
/**
* @param javax the javax version
- * @return the javax version
+ * @return the jakarta version
*/
- public static AsyncListener toJakarta(javax.servlet.AsyncListener javax)
+ public static Cookie toJakarta(javax.servlet.http.Cookie javax)
{
if (javax == null) {
return null;
}
- return new JakartaToJavaxAsyncListener(javax);
+ Cookie jakarta = new Cookie(javax.getName(), javax.getValue());
+
+ jakarta.setComment(javax.getComment());
+ jakarta.setDomain(javax.getDomain());
+ jakarta.setHttpOnly(javax.isHttpOnly());
+ jakarta.setMaxAge(javax.getMaxAge());
+ jakarta.setPath(javax.getPath());
+ jakarta.setSecure(javax.getSecure());
+ jakarta.setValue(javax.getValue());
+ jakarta.setVersion(javax.getVersion());
+
+ return jakarta;
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.ServletInputStream toJavax(ServletInputStream jakarta)
+ public static javax.servlet.DispatcherType toJavax(DispatcherType jakarta)
{
if (jakarta == null) {
return null;
}
- return new JavaxToJakartaServletInputStream(jakarta);
+ return javax.servlet.DispatcherType.valueOf(jakarta.name());
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static ServletInputStream toJakarta(javax.servlet.ServletInputStream javax)
+ public static DispatcherType toJakarta(javax.servlet.DispatcherType javax)
{
if (javax == null) {
return null;
}
- return new JakartaToJavaxServletInputStream(javax);
+ return DispatcherType.valueOf(javax.name());
}
/**
@@ -871,52 +841,52 @@ public static AsyncEvent toJakarta(javax.servlet.AsyncEvent javax)
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.FilterChain toJavax(FilterChain jakarta)
+ public static javax.servlet.SessionTrackingMode toJavax(SessionTrackingMode jakarta)
{
if (jakarta == null) {
return null;
}
- return new JavaxToJakartaFilterChain(jakarta);
+ return javax.servlet.SessionTrackingMode.valueOf(jakarta.name());
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static FilterChain toJakarta(javax.servlet.FilterChain javax)
+ public static SessionTrackingMode toJakarta(javax.servlet.SessionTrackingMode javax)
{
if (javax == null) {
return null;
}
- return new JakartaToJavaxFilterChain(javax);
+ return SessionTrackingMode.valueOf(javax.name());
}
/**
* @param jakarta the jakarta version
* @return the javax version
*/
- public static javax.servlet.FilterConfig toJavax(FilterConfig jakarta)
+ public static Set toJavax(Set jakarta)
{
if (jakarta == null) {
return null;
}
- return new JavaxToJakartaFilterConfig(jakarta);
+ return jakarta.stream().map(JakartaServletBridge::toJavax).collect(Collectors.toSet());
}
/**
* @param javax the javax version
* @return the javax version
*/
- public static FilterConfig toJakarta(javax.servlet.FilterConfig javax)
+ public static Set toJakarta(Set javax)
{
if (javax == null) {
return null;
}
- return new JakartaToJavaxFilterConfig(javax);
+ return javax.stream().map(JakartaServletBridge::toJakarta).collect(Collectors.toSet());
}
/**
@@ -947,6 +917,29 @@ public static MultipartConfigElement toJakarta(javax.servlet.MultipartConfigElem
javax.getFileSizeThreshold());
}
+ //////////////////////////////////////////////////
+ // Unsupported
+
+ /**
+ * @param jakarta the jakarta version
+ * @return the javax version
+ */
+ public static javax.servlet.descriptor.JspConfigDescriptor toJavax(JspConfigDescriptor jakarta)
+ {
+ // TODO
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @param javax the javax version
+ * @return the javax version
+ */
+ public static JspConfigDescriptor toJakarta(javax.servlet.descriptor.JspConfigDescriptor javax)
+ {
+ // TODO
+ throw new UnsupportedOperationException();
+ }
+
/**
* @param jakarta the jakarta version
* @return the javax version
@@ -967,6 +960,9 @@ public static ServletSecurityElement toJakarta(javax.servlet.ServletSecurityElem
throw new UnsupportedOperationException();
}
+ //////////////////////////////////////////////////
+ // Multi
+
/**
* @param jakarta the jakarta version
* @return the javax version
@@ -977,7 +973,7 @@ public static Enumeration toJavax(Enumeration ja
return null;
}
- return Collections.enumeration(Collections.list(jakarta).stream().map(ServletBridge::toJavax).toList());
+ return Collections.enumeration(Collections.list(jakarta).stream().map(JakartaServletBridge::toJavax).toList());
}
/**
@@ -990,7 +986,7 @@ public static Enumeration toJakarta(Enumeration
return null;
}
- return Collections.enumeration(Collections.list(javax).stream().map(ServletBridge::toJakarta).toList());
+ return Collections.enumeration(Collections.list(javax).stream().map(JakartaServletBridge::toJakarta).toList());
}
/**
@@ -1041,7 +1037,7 @@ public static EnumSet toJavax(EnumSet toJakarta(EnumSet the type of the wrapped object
+ * @version $Id$
+ * @since 42.0.0
+ */
+public interface JakartaToJavaxWrapper
+{
+ /**
+ * @return the wrapped version
+ */
+ T getJavax();
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JavaxToJakartaWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JavaxToJakartaWrapper.java
new file mode 100644
index 0000000000..7463db4b38
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/JavaxToJakartaWrapper.java
@@ -0,0 +1,33 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet;
+
+/**
+ * @param the type of the wrapped object
+ * @version $Id$
+ * @since 42.0.0
+ */
+public interface JavaxToJakartaWrapper
+{
+ /**
+ * @return the wrapped version
+ */
+ T getJakarta();
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/AbstractJakartaToJavaxWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/AbstractJakartaToJavaxWrapper.java
new file mode 100644
index 0000000000..3c9bd07fcb
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/AbstractJakartaToJavaxWrapper.java
@@ -0,0 +1,46 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+
+/**
+ * @param the type of the wrapped object
+ * @version $Id$
+ * @since 42.0.0
+ */
+public abstract class AbstractJakartaToJavaxWrapper implements JakartaToJavaxWrapper
+{
+ protected final T wrapped;
+
+ /**
+ * @param wrapped the wrapped object
+ */
+ protected AbstractJakartaToJavaxWrapper(T wrapped)
+ {
+ this.wrapped = wrapped;
+ }
+
+ @Override
+ public T getJavax()
+ {
+ return this.wrapped;
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/AbstractJavaxToJakartaWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/AbstractJavaxToJakartaWrapper.java
new file mode 100644
index 0000000000..7f9432c71a
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/AbstractJavaxToJakartaWrapper.java
@@ -0,0 +1,46 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+
+/**
+ * @param the type of the wrapped object
+ * @version $Id$
+ * @since 42.0.0
+ */
+public abstract class AbstractJavaxToJakartaWrapper implements JavaxToJakartaWrapper
+{
+ protected final T wrapped;
+
+ /**
+ * @param wrapped the wrapped object
+ */
+ protected AbstractJavaxToJakartaWrapper(T wrapped)
+ {
+ this.wrapped = wrapped;
+ }
+
+ @Override
+ public T getJakarta()
+ {
+ return this.wrapped;
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaJavaxToFilter.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaJavaxToFilter.java
deleted file mode 100644
index 28f1bf03df..0000000000
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaJavaxToFilter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.xwiki.jakartabridge.servlet.internal;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.xwiki.jakartabridge.servlet.ServletBridge;
-
-/**
- * @version $Id$
- * @since 42.0.0
- */
-public class JakartaJavaxToFilter implements Filter
-{
- private final jakarta.servlet.Filter wrapped;
-
- /**
- * @param wrapped the wrapped version
- */
- public JakartaJavaxToFilter(jakarta.servlet.Filter wrapped)
- {
- this.wrapped = wrapped;
- }
-
- @Override
- public void init(FilterConfig filterConfig) throws ServletException
- {
- try {
- this.wrapped.init(ServletBridge.toJakarta(filterConfig));
- } catch (jakarta.servlet.ServletException e) {
- throw new ServletException(e.getMessage(), e);
- }
- }
-
- @Override
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
- throws IOException, ServletException
- {
- try {
- this.wrapped.doFilter(ServletBridge.toJakarta(request), ServletBridge.toJakarta(response),
- ServletBridge.toJakarta(chain));
- } catch (jakarta.servlet.ServletException e) {
- throw new ServletException(e.getMessage(), e);
- }
- }
-
- @Override
- public void destroy()
- {
- this.wrapped.destroy();
- }
-}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncContext.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncContext.java
index 46dd31fcfc..5284013ea2 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncContext.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncContext.java
@@ -19,7 +19,7 @@
*/
package org.xwiki.jakartabridge.servlet.internal;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.AsyncContext;
import jakarta.servlet.AsyncListener;
@@ -32,28 +32,27 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxAsyncContext implements AsyncContext
+public class JakartaToJavaxAsyncContext extends AbstractJakartaToJavaxWrapper
+ implements AsyncContext
{
- private final javax.servlet.AsyncContext wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxAsyncContext(javax.servlet.AsyncContext wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public ServletRequest getRequest()
{
- return ServletBridge.toJakarta(this.wrapped.getRequest());
+ return JakartaServletBridge.toJakarta(this.wrapped.getRequest());
}
@Override
public ServletResponse getResponse()
{
- return ServletBridge.toJakarta(this.wrapped.getResponse());
+ return JakartaServletBridge.toJakarta(this.wrapped.getResponse());
}
@Override
@@ -77,7 +76,7 @@ public void dispatch(String path)
@Override
public void dispatch(ServletContext context, String path)
{
- this.wrapped.dispatch(ServletBridge.toJavax(context), path);
+ this.wrapped.dispatch(JakartaServletBridge.toJavax(context), path);
}
@Override
@@ -95,14 +94,14 @@ public void start(Runnable run)
@Override
public void addListener(AsyncListener listener)
{
- this.wrapped.addListener(ServletBridge.toJavax(listener));
+ this.wrapped.addListener(JakartaServletBridge.toJavax(listener));
}
@Override
public void addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse)
{
- this.wrapped.addListener(ServletBridge.toJavax(listener), ServletBridge.toJavax(servletRequest),
- ServletBridge.toJavax(servletResponse));
+ this.wrapped.addListener(JakartaServletBridge.toJavax(listener), JakartaServletBridge.toJavax(servletRequest),
+ JakartaServletBridge.toJavax(servletResponse));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncListener.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncListener.java
index b34a216d75..503511f99b 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncListener.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxAsyncListener.java
@@ -21,7 +21,7 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.AsyncEvent;
import jakarta.servlet.AsyncListener;
@@ -30,39 +30,38 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxAsyncListener implements AsyncListener
+public class JakartaToJavaxAsyncListener extends AbstractJakartaToJavaxWrapper
+ implements AsyncListener
{
- private final javax.servlet.AsyncListener wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxAsyncListener(javax.servlet.AsyncListener wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void onComplete(AsyncEvent event) throws IOException
{
- this.wrapped.onComplete(ServletBridge.toJavax(event));
+ this.wrapped.onComplete(JakartaServletBridge.toJavax(event));
}
@Override
public void onTimeout(AsyncEvent event) throws IOException
{
- this.wrapped.onTimeout(ServletBridge.toJavax(event));
+ this.wrapped.onTimeout(JakartaServletBridge.toJavax(event));
}
@Override
public void onError(AsyncEvent event) throws IOException
{
- this.wrapped.onError(ServletBridge.toJavax(event));
+ this.wrapped.onError(JakartaServletBridge.toJavax(event));
}
@Override
public void onStartAsync(AsyncEvent event) throws IOException
{
- this.wrapped.onStartAsync(ServletBridge.toJavax(event));
+ this.wrapped.onStartAsync(JakartaServletBridge.toJavax(event));
}
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilter.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilter.java
index d63cac2441..1974e624ee 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilter.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilter.java
@@ -21,7 +21,7 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
@@ -34,23 +34,21 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxFilter implements Filter
+public class JakartaToJavaxFilter extends AbstractJakartaToJavaxWrapper implements Filter
{
- private final javax.servlet.Filter wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxFilter(javax.servlet.Filter wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException
{
try {
- this.wrapped.init(ServletBridge.toJavax(filterConfig));
+ this.wrapped.init(JakartaServletBridge.toJavax(filterConfig));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -61,8 +59,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
throws IOException, ServletException
{
try {
- this.wrapped.doFilter(ServletBridge.toJavax(request), ServletBridge.toJavax(response),
- ServletBridge.toJavax(chain));
+ this.wrapped.doFilter(JakartaServletBridge.toJavax(request), JakartaServletBridge.toJavax(response),
+ JakartaServletBridge.toJavax(chain));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterChain.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterChain.java
index 5a14a317c6..98cdfe020c 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterChain.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterChain.java
@@ -21,7 +21,7 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
@@ -32,23 +32,22 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxFilterChain implements FilterChain
+public class JakartaToJavaxFilterChain extends AbstractJakartaToJavaxWrapper
+ implements FilterChain
{
- private final javax.servlet.FilterChain wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxFilterChain(javax.servlet.FilterChain wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException
{
try {
- this.wrapped.doFilter(ServletBridge.toJavax(request), ServletBridge.toJavax(response));
+ this.wrapped.doFilter(JakartaServletBridge.toJavax(request), JakartaServletBridge.toJavax(response));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterConfig.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterConfig.java
index 50b57ad46e..984244f747 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterConfig.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterConfig.java
@@ -21,7 +21,7 @@
import java.util.Enumeration;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletContext;
@@ -30,16 +30,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxFilterConfig implements FilterConfig
+public class JakartaToJavaxFilterConfig extends AbstractJakartaToJavaxWrapper
+ implements FilterConfig
{
- private final javax.servlet.FilterConfig wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxFilterConfig(javax.servlet.FilterConfig wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -51,7 +50,7 @@ public String getFilterName()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJakarta(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletContext());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterRegistration.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterRegistration.java
index 513cf2284d..ad87969ba0 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterRegistration.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxFilterRegistration.java
@@ -24,7 +24,7 @@
import java.util.Map;
import java.util.Set;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.FilterRegistration;
@@ -34,10 +34,9 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxFilterRegistration implements FilterRegistration
+public class JakartaToJavaxFilterRegistration
+ extends AbstractJakartaToJavaxWrapper implements FilterRegistration
{
- protected final T wrapped;
-
/**
* @version $Id$
*/
@@ -64,7 +63,7 @@ public void setAsyncSupported(boolean isAsyncSupported)
*/
public JakartaToJavaxFilterRegistration(T wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -107,7 +106,8 @@ public Map getInitParameters()
public void addMappingForServletNames(EnumSet dispatcherTypes, boolean isMatchAfter,
String... servletNames)
{
- this.wrapped.addMappingForServletNames(ServletBridge.toJavax(dispatcherTypes), isMatchAfter, servletNames);
+ this.wrapped.addMappingForServletNames(JakartaServletBridge.toJavax(dispatcherTypes), isMatchAfter,
+ servletNames);
}
@Override
@@ -120,7 +120,7 @@ public Collection getServletNameMappings()
public void addMappingForUrlPatterns(EnumSet dispatcherTypes, boolean isMatchAfter,
String... urlPatterns)
{
- this.wrapped.addMappingForUrlPatterns(ServletBridge.toJavax(dispatcherTypes), isMatchAfter, urlPatterns);
+ this.wrapped.addMappingForUrlPatterns(JakartaServletBridge.toJavax(dispatcherTypes), isMatchAfter, urlPatterns);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequest.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequest.java
index 9d38b7ed47..5b4c792526 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequest.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequest.java
@@ -24,7 +24,7 @@
import java.util.Collection;
import java.util.Enumeration;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.Cookie;
@@ -59,7 +59,7 @@ public String getAuthType()
@Override
public Cookie[] getCookies()
{
- return ServletBridge.toJakarta(this.wrapped.getCookies());
+ return JakartaServletBridge.toJakarta(this.wrapped.getCookies());
}
@Override
@@ -167,13 +167,13 @@ public String getServletPath()
@Override
public HttpSession getSession(boolean create)
{
- return ServletBridge.toJakarta(this.wrapped.getSession(create));
+ return JakartaServletBridge.toJakarta(this.wrapped.getSession(create));
}
@Override
public HttpSession getSession()
{
- return ServletBridge.toJakarta(this.wrapped.getSession());
+ return JakartaServletBridge.toJakarta(this.wrapped.getSession());
}
@Override
@@ -210,7 +210,7 @@ public boolean isRequestedSessionIdFromUrl()
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
{
try {
- return this.wrapped.authenticate(ServletBridge.toJavax(response));
+ return this.wrapped.authenticate(JakartaServletBridge.toJavax(response));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -240,7 +240,7 @@ public void logout() throws ServletException
public Collection getParts() throws IOException, ServletException
{
try {
- return this.wrapped.getParts().stream().map(p -> (Part) ServletBridge.toJakarta(p)).toList();
+ return this.wrapped.getParts().stream().map(p -> (Part) JakartaServletBridge.toJakarta(p)).toList();
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -250,7 +250,7 @@ public Collection getParts() throws IOException, ServletException
public Part getPart(String name) throws IOException, ServletException
{
try {
- return ServletBridge.toJakarta(this.wrapped.getPart(name));
+ return JakartaServletBridge.toJakarta(this.wrapped.getPart(name));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequestWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequestWrapper.java
new file mode 100644
index 0000000000..9999c4bc26
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletRequestWrapper.java
@@ -0,0 +1,515 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletRequestWrapper;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpUpgradeHandler;
+import jakarta.servlet.http.Part;
+
+/**
+ * @param the type of http servlet request
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JakartaToJavaxHttpServletRequestWrapper
+ extends HttpServletRequestWrapper implements JakartaToJavaxWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JakartaToJavaxHttpServletRequestWrapper(R wrapped)
+ {
+ super(JakartaServletBridge.toJakarta((javax.servlet.http.HttpServletRequest) wrapped.getRequest()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JakartaToJavaxWrapper
+
+ @Override
+ public R getJavax()
+ {
+ return this.wrapped;
+ }
+
+ // HttpServletRequest
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return this.wrapped.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return this.wrapped.getAttributeNames();
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ this.wrapped.setCharacterEncoding(env);
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ return this.wrapped.getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong()
+ {
+ return this.wrapped.getContentLengthLong();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getInputStream());
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return this.wrapped.getParameter(name);
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ return this.wrapped.getParameterNames();
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ return this.wrapped.getParameterValues(name);
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ return this.wrapped.getParameterMap();
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return this.wrapped.getProtocol();
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return this.wrapped.getScheme();
+ }
+
+ @Override
+ public String getServerName()
+ {
+ return this.wrapped.getServerName();
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ return this.wrapped.getServerPort();
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ return this.wrapped.getReader();
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return this.wrapped.getRemoteAddr();
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ return this.wrapped.getRemoteHost();
+ }
+
+ @Override
+ public void setAttribute(String name, Object o)
+ {
+ this.wrapped.setAttribute(name, o);
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ this.wrapped.removeAttribute(name);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ return this.wrapped.getLocales();
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ return this.wrapped.isSecure();
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getRequestDispatcher(path));
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return this.wrapped.getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ return this.wrapped.getRemotePort();
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return this.wrapped.getLocalName();
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ return this.wrapped.getLocalAddr();
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ return this.wrapped.getLocalPort();
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletContext());
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.startAsync());
+ }
+
+ @Override
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.startAsync(JakartaServletBridge.toJavax(servletRequest),
+ JakartaServletBridge.toJavax(servletResponse)));
+ }
+
+ @Override
+ public boolean isAsyncStarted()
+ {
+ return this.wrapped.isAsyncStarted();
+ }
+
+ @Override
+ public boolean isAsyncSupported()
+ {
+ return this.wrapped.isAsyncSupported();
+ }
+
+ @Override
+ public AsyncContext getAsyncContext()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getAsyncContext());
+ }
+
+ @Override
+ public DispatcherType getDispatcherType()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getDispatcherType());
+ }
+
+ @Override
+ public String getAuthType()
+ {
+ return this.wrapped.getAuthType();
+ }
+
+ @Override
+ public Cookie[] getCookies()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getCookies());
+ }
+
+ @Override
+ public long getDateHeader(String name)
+ {
+ return this.wrapped.getDateHeader(name);
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return this.wrapped.getHeader(name);
+ }
+
+ @Override
+ public Enumeration getHeaders(String name)
+ {
+ return this.wrapped.getHeaders(name);
+ }
+
+ @Override
+ public Enumeration getHeaderNames()
+ {
+ return this.wrapped.getHeaderNames();
+ }
+
+ @Override
+ public int getIntHeader(String name)
+ {
+ return this.wrapped.getIntHeader(name);
+ }
+
+ @Override
+ public String getMethod()
+ {
+ return this.wrapped.getMethod();
+ }
+
+ @Override
+ public String getPathInfo()
+ {
+ return this.wrapped.getPathInfo();
+ }
+
+ @Override
+ public String getPathTranslated()
+ {
+ return this.wrapped.getPathTranslated();
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return this.wrapped.getContextPath();
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return this.wrapped.getQueryString();
+ }
+
+ @Override
+ public String getRemoteUser()
+ {
+ return this.wrapped.getRemoteUser();
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ return this.wrapped.isUserInRole(role);
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ return this.wrapped.getUserPrincipal();
+ }
+
+ @Override
+ public String getRequestedSessionId()
+ {
+ return this.wrapped.getRequestedSessionId();
+ }
+
+ @Override
+ public String getRequestURI()
+ {
+ return this.wrapped.getRequestURI();
+ }
+
+ @Override
+ public StringBuffer getRequestURL()
+ {
+ return this.wrapped.getRequestURL();
+ }
+
+ @Override
+ public String getServletPath()
+ {
+ return this.wrapped.getServletPath();
+ }
+
+ @Override
+ public HttpSession getSession(boolean create)
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getSession(create));
+ }
+
+ @Override
+ public HttpSession getSession()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getSession());
+ }
+
+ @Override
+ public String changeSessionId()
+ {
+ return this.wrapped.changeSessionId();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid()
+ {
+ return this.wrapped.isRequestedSessionIdValid();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ return this.wrapped.isRequestedSessionIdFromCookie();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return this.wrapped.isRequestedSessionIdFromURL();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ return this.wrapped.isRequestedSessionIdFromUrl();
+ }
+
+ @Override
+ public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
+ {
+ try {
+ return this.wrapped.authenticate(JakartaServletBridge.toJavax(response));
+ } catch (javax.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void login(String username, String password) throws ServletException
+ {
+ try {
+ this.wrapped.login(username, password);
+ } catch (javax.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void logout() throws ServletException
+ {
+ try {
+ this.wrapped.logout();
+ } catch (javax.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Collection getParts() throws IOException, ServletException
+ {
+ try {
+ return this.wrapped.getParts().stream().map(p -> (Part) JakartaServletBridge.toJakarta(p)).toList();
+ } catch (javax.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Part getPart(String name) throws IOException, ServletException
+ {
+ try {
+ return JakartaServletBridge.toJakarta(this.wrapped.getPart(name));
+ } catch (javax.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public T upgrade(Class handlerClass) throws IOException, ServletException
+ {
+ // TODO
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponse.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponse.java
index 772dbb5e0c..aa3c09f9c2 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponse.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponse.java
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.util.Collection;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletResponse;
@@ -46,7 +46,7 @@ public JakartaToJavaxHttpServletResponse(R wrapped)
@Override
public void addCookie(Cookie cookie)
{
- this.wrapped.addCookie(ServletBridge.toJavax(cookie));
+ this.wrapped.addCookie(JakartaServletBridge.toJavax(cookie));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponseWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponseWrapper.java
new file mode 100644
index 0000000000..a5f515309a
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpServletResponseWrapper.java
@@ -0,0 +1,285 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Locale;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+
+import jakarta.servlet.ServletOutputStream;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * @param the type of http servlet response
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JakartaToJavaxHttpServletResponseWrapper
+ extends HttpServletResponseWrapper implements JakartaToJavaxWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JakartaToJavaxHttpServletResponseWrapper(R wrapped)
+ {
+ super(JakartaServletBridge.toJakarta((javax.servlet.http.HttpServletResponse) wrapped.getResponse()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JakartaToJavaxWrapper
+
+ @Override
+ public R getJavax()
+ {
+ return this.wrapped;
+ }
+
+ // HttpServletResponse
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getOutputStream());
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException
+ {
+ return this.wrapped.getWriter();
+ }
+
+ @Override
+ public void setCharacterEncoding(String charset)
+ {
+ this.wrapped.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentLength(int len)
+ {
+ this.wrapped.setContentLength(len);
+ }
+
+ @Override
+ public void setContentLengthLong(long len)
+ {
+ this.wrapped.setContentLengthLong(len);
+ }
+
+ @Override
+ public void setContentType(String type)
+ {
+ this.wrapped.setContentType(type);
+ }
+
+ @Override
+ public void setBufferSize(int size)
+ {
+ this.wrapped.setBufferSize(size);
+ }
+
+ @Override
+ public int getBufferSize()
+ {
+ return this.wrapped.getBufferSize();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException
+ {
+ this.wrapped.flushBuffer();
+ }
+
+ @Override
+ public void resetBuffer()
+ {
+ this.wrapped.resetBuffer();
+ }
+
+ @Override
+ public boolean isCommitted()
+ {
+ return this.wrapped.isCommitted();
+ }
+
+ @Override
+ public void reset()
+ {
+ this.wrapped.reset();
+ }
+
+ @Override
+ public void setLocale(Locale loc)
+ {
+ this.wrapped.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+
+ @Override
+ public void addCookie(Cookie cookie)
+ {
+ this.wrapped.addCookie(JakartaServletBridge.toJavax(cookie));
+ }
+
+ @Override
+ public boolean containsHeader(String name)
+ {
+ return this.wrapped.containsHeader(name);
+ }
+
+ @Override
+ public String encodeURL(String url)
+ {
+ return this.wrapped.encodeURL(url);
+ }
+
+ @Override
+ public String encodeRedirectURL(String url)
+ {
+ return this.wrapped.encodeRedirectURL(url);
+ }
+
+ @Override
+ public String encodeUrl(String url)
+ {
+ return this.wrapped.encodeUrl(url);
+ }
+
+ @Override
+ public String encodeRedirectUrl(String url)
+ {
+ return this.wrapped.encodeRedirectUrl(url);
+ }
+
+ @Override
+ public void sendError(int sc, String msg) throws IOException
+ {
+ this.wrapped.sendError(sc, msg);
+ }
+
+ @Override
+ public void sendError(int sc) throws IOException
+ {
+ this.wrapped.sendError(sc);
+ }
+
+ @Override
+ public void sendRedirect(String location) throws IOException
+ {
+ this.wrapped.sendRedirect(location);
+ }
+
+ @Override
+ public void setDateHeader(String name, long date)
+ {
+ this.wrapped.setDateHeader(name, date);
+ }
+
+ @Override
+ public void addDateHeader(String name, long date)
+ {
+ this.wrapped.addDateHeader(name, date);
+ }
+
+ @Override
+ public void setHeader(String name, String value)
+ {
+ this.wrapped.setHeader(name, value);
+ }
+
+ @Override
+ public void addHeader(String name, String value)
+ {
+ this.wrapped.addHeader(name, value);
+ }
+
+ @Override
+ public void setIntHeader(String name, int value)
+ {
+ this.wrapped.setIntHeader(name, value);
+ }
+
+ @Override
+ public void addIntHeader(String name, int value)
+ {
+ this.wrapped.addIntHeader(name, value);
+ }
+
+ @Override
+ public void setStatus(int sc)
+ {
+ this.wrapped.setStatus(sc);
+ }
+
+ @Override
+ public void setStatus(int sc, String sm)
+ {
+ this.wrapped.setStatus(sc, sm);
+ }
+
+ @Override
+ public int getStatus()
+ {
+ return this.wrapped.getStatus();
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return this.wrapped.getHeader(name);
+ }
+
+ @Override
+ public Collection getHeaders(String name)
+ {
+ return this.wrapped.getHeaders(name);
+ }
+
+ @Override
+ public Collection getHeaderNames()
+ {
+ return this.wrapped.getHeaderNames();
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSession.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSession.java
index 323338e2d4..1106001b84 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSession.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSession.java
@@ -21,7 +21,7 @@
import java.util.Enumeration;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpSession;
@@ -31,16 +31,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxHttpSession implements HttpSession
+public class JakartaToJavaxHttpSession extends AbstractJakartaToJavaxWrapper
+ implements HttpSession
{
- private final javax.servlet.http.HttpSession wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxHttpSession(javax.servlet.http.HttpSession wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -64,7 +63,7 @@ public long getLastAccessedTime()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJakarta(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletContext());
}
@Override
@@ -82,7 +81,7 @@ public int getMaxInactiveInterval()
@Override
public HttpSessionContext getSessionContext()
{
- return ServletBridge.toJakarta(this.wrapped.getSessionContext());
+ return JakartaServletBridge.toJakarta(this.wrapped.getSessionContext());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSessionContext.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSessionContext.java
index be2f20e5b8..fbc653a4ba 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSessionContext.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxHttpSessionContext.java
@@ -21,7 +21,7 @@
import java.util.Enumeration;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionContext;
@@ -30,22 +30,21 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxHttpSessionContext implements HttpSessionContext
+public class JakartaToJavaxHttpSessionContext
+ extends AbstractJakartaToJavaxWrapper implements HttpSessionContext
{
- private final javax.servlet.http.HttpSessionContext wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxHttpSessionContext(javax.servlet.http.HttpSessionContext wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public HttpSession getSession(String sessionId)
{
- return ServletBridge.toJakarta(this.wrapped.getSession(sessionId));
+ return JakartaServletBridge.toJakarta(this.wrapped.getSession(sessionId));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxPart.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxPart.java
index f1aebf6b7c..c5e02fab05 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxPart.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxPart.java
@@ -29,16 +29,14 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxPart implements Part
+public class JakartaToJavaxPart extends AbstractJakartaToJavaxWrapper implements Part
{
- private final javax.servlet.http.Part wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxPart(javax.servlet.http.Part wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxReaderListener.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxReadListener.java
similarity index 86%
rename from xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxReaderListener.java
rename to xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxReadListener.java
index 67fa68224f..b7739f5c3a 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxReaderListener.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxReadListener.java
@@ -27,16 +27,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxReaderListener implements ReadListener
+public class JakartaToJavaxReadListener extends AbstractJakartaToJavaxWrapper
+ implements ReadListener
{
- private final javax.servlet.ReadListener wrapped;
-
/**
* @param wrapped the wrapped version
*/
- public JakartaToJavaxReaderListener(javax.servlet.ReadListener wrapped)
+ public JakartaToJavaxReadListener(javax.servlet.ReadListener wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxRequestDispatcher.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxRequestDispatcher.java
index e8715be5ef..0a815a12c9 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxRequestDispatcher.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxRequestDispatcher.java
@@ -21,7 +21,7 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
@@ -32,23 +32,22 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxRequestDispatcher implements RequestDispatcher
+public class JakartaToJavaxRequestDispatcher extends AbstractJakartaToJavaxWrapper
+ implements RequestDispatcher
{
- private final javax.servlet.RequestDispatcher wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxRequestDispatcher(javax.servlet.RequestDispatcher wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
try {
- this.wrapped.forward(ServletBridge.toJavax(request), ServletBridge.toJavax(response));
+ this.wrapped.forward(JakartaServletBridge.toJavax(request), JakartaServletBridge.toJavax(response));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -58,7 +57,7 @@ public void forward(ServletRequest request, ServletResponse response) throws Ser
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
try {
- this.wrapped.include(ServletBridge.toJavax(request), ServletBridge.toJavax(response));
+ this.wrapped.include(JakartaServletBridge.toJavax(request), JakartaServletBridge.toJavax(response));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServlet.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServlet.java
index a4bc1406e4..fa2b8b113a 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServlet.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServlet.java
@@ -21,7 +21,7 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletConfig;
@@ -33,23 +33,21 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxServlet implements Servlet
+public class JakartaToJavaxServlet extends AbstractJakartaToJavaxWrapper implements Servlet
{
- private final javax.servlet.Servlet wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxServlet(javax.servlet.Servlet wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void init(ServletConfig config) throws ServletException
{
try {
- this.wrapped.init(ServletBridge.toJavax(config));
+ this.wrapped.init(JakartaServletBridge.toJavax(config));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -58,14 +56,14 @@ public void init(ServletConfig config) throws ServletException
@Override
public ServletConfig getServletConfig()
{
- return ServletBridge.toJakarta(this.wrapped.getServletConfig());
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletConfig());
}
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
{
try {
- this.wrapped.service(ServletBridge.toJavax(req), ServletBridge.toJavax(res));
+ this.wrapped.service(JakartaServletBridge.toJavax(req), JakartaServletBridge.toJavax(res));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletConfig.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletConfig.java
index 596372cf19..b17e621fb2 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletConfig.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletConfig.java
@@ -21,7 +21,7 @@
import java.util.Enumeration;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
@@ -30,16 +30,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxServletConfig implements ServletConfig
+public class JakartaToJavaxServletConfig extends AbstractJakartaToJavaxWrapper
+ implements ServletConfig
{
- private final javax.servlet.ServletConfig wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxServletConfig(javax.servlet.ServletConfig wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -51,7 +50,7 @@ public String getServletName()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJakarta(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletContext());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletContext.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletContext.java
index 3056f5a5c6..b312ab2e51 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletContext.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletContext.java
@@ -27,7 +27,7 @@
import java.util.Map;
import java.util.Set;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterRegistration;
@@ -45,16 +45,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxServletContext implements ServletContext
+public class JakartaToJavaxServletContext extends AbstractJakartaToJavaxWrapper
+ implements ServletContext
{
- private final javax.servlet.ServletContext wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxServletContext(javax.servlet.ServletContext wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -120,20 +119,20 @@ public InputStream getResourceAsStream(String path)
@Override
public RequestDispatcher getRequestDispatcher(String path)
{
- return ServletBridge.toJakarta(this.wrapped.getRequestDispatcher(path));
+ return JakartaServletBridge.toJakarta(this.wrapped.getRequestDispatcher(path));
}
@Override
public RequestDispatcher getNamedDispatcher(String name)
{
- return ServletBridge.toJakarta(this.wrapped.getNamedDispatcher(name));
+ return JakartaServletBridge.toJakarta(this.wrapped.getNamedDispatcher(name));
}
@Override
public Servlet getServlet(String name) throws ServletException
{
try {
- return ServletBridge.toJakarta(this.wrapped.getServlet(name));
+ return JakartaServletBridge.toJakarta(this.wrapped.getServlet(name));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -142,7 +141,7 @@ public Servlet getServlet(String name) throws ServletException
@Override
public Enumeration getServlets()
{
- return ServletBridge.toJakarta(this.wrapped.getServlets());
+ return JakartaServletBridge.toJakarta(this.wrapped.getServlets());
}
@Override
@@ -232,13 +231,14 @@ public String getServletContextName()
@Override
public Dynamic addServlet(String servletName, String className)
{
- return ServletBridge.toJakarta(this.wrapped.addServlet(servletName, className));
+ return JakartaServletBridge.toJakarta(this.wrapped.addServlet(servletName, className));
}
@Override
public Dynamic addServlet(String servletName, Servlet servlet)
{
- return ServletBridge.toJakarta(this.wrapped.addServlet(servletName, ServletBridge.toJavax(servlet)));
+ return JakartaServletBridge
+ .toJakarta(this.wrapped.addServlet(servletName, JakartaServletBridge.toJavax(servlet)));
}
@Override
@@ -258,7 +258,7 @@ public T createServlet(Class clazz) throws ServletExcepti
@Override
public ServletRegistration getServletRegistration(String servletName)
{
- return ServletBridge.toJakarta(this.wrapped.getServletRegistration(servletName));
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletRegistration(servletName));
}
@Override
@@ -271,13 +271,13 @@ public ServletRegistration getServletRegistration(String servletName)
@Override
public FilterRegistration.Dynamic addFilter(String filterName, String className)
{
- return ServletBridge.toJakarta(this.wrapped.addFilter(filterName, className));
+ return JakartaServletBridge.toJakarta(this.wrapped.addFilter(filterName, className));
}
@Override
public FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
{
- return ServletBridge.toJakarta(this.wrapped.addFilter(filterName, ServletBridge.toJavax(filter)));
+ return JakartaServletBridge.toJakarta(this.wrapped.addFilter(filterName, JakartaServletBridge.toJavax(filter)));
}
@Override
@@ -297,7 +297,7 @@ public T createFilter(Class clazz) throws ServletException
@Override
public FilterRegistration getFilterRegistration(String filterName)
{
- return ServletBridge.toJakarta(this.wrapped.getFilterRegistration(filterName));
+ return JakartaServletBridge.toJakarta(this.wrapped.getFilterRegistration(filterName));
}
@Override
@@ -310,25 +310,25 @@ public FilterRegistration getFilterRegistration(String filterName)
@Override
public SessionCookieConfig getSessionCookieConfig()
{
- return ServletBridge.toJakarta(this.wrapped.getSessionCookieConfig());
+ return JakartaServletBridge.toJakarta(this.wrapped.getSessionCookieConfig());
}
@Override
public void setSessionTrackingModes(Set sessionTrackingModes)
{
- this.wrapped.setSessionTrackingModes(ServletBridge.toJavax(sessionTrackingModes));
+ this.wrapped.setSessionTrackingModes(JakartaServletBridge.toJavax(sessionTrackingModes));
}
@Override
public Set getDefaultSessionTrackingModes()
{
- return ServletBridge.toJakarta(this.wrapped.getDefaultSessionTrackingModes());
+ return JakartaServletBridge.toJakarta(this.wrapped.getDefaultSessionTrackingModes());
}
@Override
public Set getEffectiveSessionTrackingModes()
{
- return ServletBridge.toJakarta(this.wrapped.getEffectiveSessionTrackingModes());
+ return JakartaServletBridge.toJakarta(this.wrapped.getEffectiveSessionTrackingModes());
}
@Override
@@ -362,7 +362,7 @@ public T createListener(Class clazz) throws Servlet
@Override
public JspConfigDescriptor getJspConfigDescriptor()
{
- return ServletBridge.toJakarta(this.wrapped.getJspConfigDescriptor());
+ return JakartaServletBridge.toJakarta(this.wrapped.getJspConfigDescriptor());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletInputStream.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletInputStream.java
index 0bac68e94d..a24b9112fb 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletInputStream.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletInputStream.java
@@ -21,7 +21,8 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;
@@ -31,6 +32,7 @@
* @since 42.0.0
*/
public class JakartaToJavaxServletInputStream extends ServletInputStream
+ implements JakartaToJavaxWrapper
{
private final javax.servlet.ServletInputStream wrapped;
@@ -42,6 +44,12 @@ public JakartaToJavaxServletInputStream(javax.servlet.ServletInputStream wrapped
this.wrapped = wrapped;
}
+ @Override
+ public javax.servlet.ServletInputStream getJavax()
+ {
+ return this.wrapped;
+ }
+
@Override
public boolean isFinished()
{
@@ -57,7 +65,7 @@ public boolean isReady()
@Override
public void setReadListener(ReadListener readListener)
{
- this.wrapped.setReadListener(ServletBridge.toJavax(readListener));
+ this.wrapped.setReadListener(JakartaServletBridge.toJavax(readListener));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletOutputStream.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletOutputStream.java
index 06ce23819d..af46351cb0 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletOutputStream.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletOutputStream.java
@@ -21,7 +21,8 @@
import java.io.IOException;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.WriteListener;
@@ -31,6 +32,7 @@
* @since 42.0.0
*/
public class JakartaToJavaxServletOutputStream extends ServletOutputStream
+ implements JakartaToJavaxWrapper
{
private final javax.servlet.ServletOutputStream wrapped;
@@ -42,6 +44,12 @@ public JakartaToJavaxServletOutputStream(javax.servlet.ServletOutputStream wrapp
this.wrapped = wrapped;
}
+ @Override
+ public javax.servlet.ServletOutputStream getJavax()
+ {
+ return this.wrapped;
+ }
+
@Override
public boolean isReady()
{
@@ -51,7 +59,7 @@ public boolean isReady()
@Override
public void setWriteListener(WriteListener writeListener)
{
- this.wrapped.setWriteListener(ServletBridge.toJavax(writeListener));
+ this.wrapped.setWriteListener(JakartaServletBridge.toJavax(writeListener));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRegistration.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRegistration.java
index 4072251a4d..e5f120741d 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRegistration.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRegistration.java
@@ -23,7 +23,7 @@
import java.util.Map;
import java.util.Set;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.ServletRegistration;
@@ -35,10 +35,8 @@
* @since 42.0.0
*/
public class JakartaToJavaxServletRegistration
- implements ServletRegistration
+ extends AbstractJakartaToJavaxWrapper implements ServletRegistration
{
- protected final T wrapped;
-
/**
* @version $Id$
*/
@@ -62,13 +60,13 @@ public void setLoadOnStartup(int loadOnStartup)
@Override
public Set setServletSecurity(ServletSecurityElement constraint)
{
- return this.wrapped.setServletSecurity(ServletBridge.toJavax(constraint));
+ return this.wrapped.setServletSecurity(JakartaServletBridge.toJavax(constraint));
}
@Override
public void setMultipartConfig(MultipartConfigElement multipartConfig)
{
- this.wrapped.setMultipartConfig(ServletBridge.toJavax(multipartConfig));
+ this.wrapped.setMultipartConfig(JakartaServletBridge.toJavax(multipartConfig));
}
@Override
@@ -89,7 +87,7 @@ public void setAsyncSupported(boolean isAsyncSupported)
*/
public JakartaToJavaxServletRegistration(T wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequest.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequest.java
index 2b0b10567b..6bab25b0e9 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequest.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequest.java
@@ -26,7 +26,7 @@
import java.util.Locale;
import java.util.Map;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
@@ -41,16 +41,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxServletRequest implements ServletRequest
+public class JakartaToJavaxServletRequest
+ extends AbstractJakartaToJavaxWrapper implements ServletRequest
{
- protected final R wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxServletRequest(R wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -98,7 +97,7 @@ public String getContentType()
@Override
public ServletInputStream getInputStream() throws IOException
{
- return ServletBridge.toJakarta(this.wrapped.getInputStream());
+ return JakartaServletBridge.toJakarta(this.wrapped.getInputStream());
}
@Override
@@ -200,7 +199,7 @@ public boolean isSecure()
@Override
public RequestDispatcher getRequestDispatcher(String path)
{
- return ServletBridge.toJakarta(this.wrapped.getRequestDispatcher(path));
+ return JakartaServletBridge.toJakarta(this.wrapped.getRequestDispatcher(path));
}
@Override
@@ -236,21 +235,21 @@ public int getLocalPort()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJakarta(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletContext());
}
@Override
public AsyncContext startAsync() throws IllegalStateException
{
- return ServletBridge.toJakarta(this.wrapped.startAsync());
+ return JakartaServletBridge.toJakarta(this.wrapped.startAsync());
}
@Override
public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
throws IllegalStateException
{
- return ServletBridge.toJakarta(this.wrapped.startAsync(ServletBridge.toJavax(servletRequest),
- ServletBridge.toJavax(servletResponse)));
+ return JakartaServletBridge.toJakarta(this.wrapped.startAsync(JakartaServletBridge.toJavax(servletRequest),
+ JakartaServletBridge.toJavax(servletResponse)));
}
@Override
@@ -268,12 +267,12 @@ public boolean isAsyncSupported()
@Override
public AsyncContext getAsyncContext()
{
- return ServletBridge.toJakarta(this.wrapped.getAsyncContext());
+ return JakartaServletBridge.toJakarta(this.wrapped.getAsyncContext());
}
@Override
public DispatcherType getDispatcherType()
{
- return ServletBridge.toJakarta(this.wrapped.getDispatcherType());
+ return JakartaServletBridge.toJakarta(this.wrapped.getDispatcherType());
}
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequestWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequestWrapper.java
new file mode 100644
index 0000000000..364fa3111d
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletRequestWrapper.java
@@ -0,0 +1,294 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletRequestWrapper;
+import jakarta.servlet.ServletResponse;
+
+/**
+ * @param the type of http servlet request
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JakartaToJavaxServletRequestWrapper
+ extends ServletRequestWrapper implements JakartaToJavaxWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JakartaToJavaxServletRequestWrapper(R wrapped)
+ {
+ super(JakartaServletBridge.toJakarta(wrapped.getRequest()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JakartaToJavaxWrapper
+
+ @Override
+ public R getJavax()
+ {
+ return this.wrapped;
+ }
+
+ // ServletRequest
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return this.wrapped.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return this.wrapped.getAttributeNames();
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ this.wrapped.setCharacterEncoding(env);
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ return this.wrapped.getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong()
+ {
+ return this.wrapped.getContentLengthLong();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getInputStream());
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return this.wrapped.getParameter(name);
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ return this.wrapped.getParameterNames();
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ return this.wrapped.getParameterValues(name);
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ return this.wrapped.getParameterMap();
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return this.wrapped.getProtocol();
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return this.wrapped.getScheme();
+ }
+
+ @Override
+ public String getServerName()
+ {
+ return this.wrapped.getServerName();
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ return this.wrapped.getServerPort();
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ return this.wrapped.getReader();
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return this.wrapped.getRemoteAddr();
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ return this.wrapped.getRemoteHost();
+ }
+
+ @Override
+ public void setAttribute(String name, Object o)
+ {
+ this.wrapped.setAttribute(name, o);
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ this.wrapped.removeAttribute(name);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ return this.wrapped.getLocales();
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ return this.wrapped.isSecure();
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getRequestDispatcher(path));
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return this.wrapped.getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ return this.wrapped.getRemotePort();
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return this.wrapped.getLocalName();
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ return this.wrapped.getLocalAddr();
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ return this.wrapped.getLocalPort();
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getServletContext());
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.startAsync());
+ }
+
+ @Override
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.startAsync(JakartaServletBridge.toJavax(servletRequest),
+ JakartaServletBridge.toJavax(servletResponse)));
+ }
+
+ @Override
+ public boolean isAsyncStarted()
+ {
+ return this.wrapped.isAsyncStarted();
+ }
+
+ @Override
+ public boolean isAsyncSupported()
+ {
+ return this.wrapped.isAsyncSupported();
+ }
+
+ @Override
+ public AsyncContext getAsyncContext()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getAsyncContext());
+ }
+
+ @Override
+ public DispatcherType getDispatcherType()
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getDispatcherType());
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponse.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponse.java
index 06056ba11b..1e9a03949a 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponse.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponse.java
@@ -23,7 +23,7 @@
import java.io.PrintWriter;
import java.util.Locale;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.ServletResponse;
@@ -33,16 +33,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxServletResponse implements ServletResponse
+public class JakartaToJavaxServletResponse
+ extends AbstractJakartaToJavaxWrapper implements ServletResponse
{
- protected final R wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxServletResponse(R wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -60,7 +59,7 @@ public String getContentType()
@Override
public ServletOutputStream getOutputStream() throws IOException
{
- return ServletBridge.toJakarta(this.wrapped.getOutputStream());
+ return JakartaServletBridge.toJakarta(this.wrapped.getOutputStream());
}
@Override
@@ -140,5 +139,4 @@ public Locale getLocale()
{
return this.wrapped.getLocale();
}
-
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponseWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponseWrapper.java
new file mode 100644
index 0000000000..77a4859b03
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxServletResponseWrapper.java
@@ -0,0 +1,157 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaToJavaxWrapper;
+
+import jakarta.servlet.ServletOutputStream;
+import jakarta.servlet.ServletResponseWrapper;
+
+/**
+ * @param the type of http servlet response
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JakartaToJavaxServletResponseWrapper
+ extends ServletResponseWrapper implements JakartaToJavaxWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JakartaToJavaxServletResponseWrapper(R wrapped)
+ {
+ super(JakartaServletBridge.toJakarta(wrapped.getResponse()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JakartaToJavaxWrapper
+
+ @Override
+ public R getJavax()
+ {
+ return this.wrapped;
+ }
+
+ // ServletResponse
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return JakartaServletBridge.toJakarta(this.wrapped.getOutputStream());
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException
+ {
+ return this.wrapped.getWriter();
+ }
+
+ @Override
+ public void setCharacterEncoding(String charset)
+ {
+ this.wrapped.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentLength(int len)
+ {
+ this.wrapped.setContentLength(len);
+ }
+
+ @Override
+ public void setContentLengthLong(long len)
+ {
+ this.wrapped.setContentLengthLong(len);
+ }
+
+ @Override
+ public void setContentType(String type)
+ {
+ this.wrapped.setContentType(type);
+ }
+
+ @Override
+ public void setBufferSize(int size)
+ {
+ this.wrapped.setBufferSize(size);
+ }
+
+ @Override
+ public int getBufferSize()
+ {
+ return this.wrapped.getBufferSize();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException
+ {
+ this.wrapped.flushBuffer();
+ }
+
+ @Override
+ public void resetBuffer()
+ {
+ this.wrapped.resetBuffer();
+ }
+
+ @Override
+ public boolean isCommitted()
+ {
+ return this.wrapped.isCommitted();
+ }
+
+ @Override
+ public void reset()
+ {
+ this.wrapped.reset();
+ }
+
+ @Override
+ public void setLocale(Locale loc)
+ {
+ this.wrapped.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxSessionCookieConfig.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxSessionCookieConfig.java
index f83ce9dde4..a0edf5e16e 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxSessionCookieConfig.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxSessionCookieConfig.java
@@ -25,16 +25,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxSessionCookieConfig implements SessionCookieConfig
+public class JakartaToJavaxSessionCookieConfig extends AbstractJakartaToJavaxWrapper
+ implements SessionCookieConfig
{
- private final javax.servlet.SessionCookieConfig wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxSessionCookieConfig(javax.servlet.SessionCookieConfig wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxWriteListener.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxWriteListener.java
index f9004e2837..ce973e3ad8 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxWriteListener.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JakartaToJavaxWriteListener.java
@@ -27,16 +27,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JakartaToJavaxWriteListener implements WriteListener
+public class JakartaToJavaxWriteListener extends AbstractJakartaToJavaxWrapper
+ implements WriteListener
{
- private final javax.servlet.WriteListener wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JakartaToJavaxWriteListener(javax.servlet.WriteListener wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncContext.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncContext.java
index afb4f94de0..332a28e8a4 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncContext.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncContext.java
@@ -26,34 +26,33 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaAsyncContext implements AsyncContext
+public class JavaxToJakartaAsyncContext extends AbstractJavaxToJakartaWrapper
+ implements AsyncContext
{
- private final jakarta.servlet.AsyncContext wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaAsyncContext(jakarta.servlet.AsyncContext wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public ServletRequest getRequest()
{
- return ServletBridge.toJavax(this.wrapped.getRequest());
+ return JakartaServletBridge.toJavax(this.wrapped.getRequest());
}
@Override
public ServletResponse getResponse()
{
- return ServletBridge.toJavax(this.wrapped.getResponse());
+ return JakartaServletBridge.toJavax(this.wrapped.getResponse());
}
@Override
@@ -77,7 +76,7 @@ public void dispatch(String path)
@Override
public void dispatch(ServletContext context, String path)
{
- this.wrapped.dispatch(ServletBridge.toJakarta(context), path);
+ this.wrapped.dispatch(JakartaServletBridge.toJakarta(context), path);
}
@Override
@@ -95,14 +94,14 @@ public void start(Runnable run)
@Override
public void addListener(AsyncListener listener)
{
- this.wrapped.addListener(ServletBridge.toJakarta(listener));
+ this.wrapped.addListener(JakartaServletBridge.toJakarta(listener));
}
@Override
public void addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse)
{
- this.wrapped.addListener(ServletBridge.toJakarta(listener), ServletBridge.toJakarta(servletRequest),
- ServletBridge.toJakarta(servletResponse));
+ this.wrapped.addListener(JakartaServletBridge.toJakarta(listener),
+ JakartaServletBridge.toJakarta(servletRequest), JakartaServletBridge.toJakarta(servletResponse));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncListener.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncListener.java
index 95be7e7278..86bddf3e2d 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncListener.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaAsyncListener.java
@@ -24,45 +24,44 @@
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaAsyncListener implements AsyncListener
+public class JavaxToJakartaAsyncListener extends AbstractJavaxToJakartaWrapper
+ implements AsyncListener
{
- private final jakarta.servlet.AsyncListener wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaAsyncListener(jakarta.servlet.AsyncListener wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void onComplete(AsyncEvent event) throws IOException
{
- this.wrapped.onComplete(ServletBridge.toJakarta(event));
+ this.wrapped.onComplete(JakartaServletBridge.toJakarta(event));
}
@Override
public void onTimeout(AsyncEvent event) throws IOException
{
- this.wrapped.onTimeout(ServletBridge.toJakarta(event));
+ this.wrapped.onTimeout(JakartaServletBridge.toJakarta(event));
}
@Override
public void onError(AsyncEvent event) throws IOException
{
- this.wrapped.onError(ServletBridge.toJakarta(event));
+ this.wrapped.onError(JakartaServletBridge.toJakarta(event));
}
@Override
public void onStartAsync(AsyncEvent event) throws IOException
{
- this.wrapped.onStartAsync(ServletBridge.toJakarta(event));
+ this.wrapped.onStartAsync(JakartaServletBridge.toJakarta(event));
}
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilter.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilter.java
index e2ccde4131..5f02604065 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilter.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilter.java
@@ -28,29 +28,27 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaFilter implements Filter
+public class JavaxToJakartaFilter extends AbstractJavaxToJakartaWrapper implements Filter
{
- private final jakarta.servlet.Filter wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaFilter(jakarta.servlet.Filter wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException
{
try {
- this.wrapped.init(ServletBridge.toJakarta(filterConfig));
+ this.wrapped.init(JakartaServletBridge.toJakarta(filterConfig));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -61,8 +59,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
throws IOException, ServletException
{
try {
- this.wrapped.doFilter(ServletBridge.toJakarta(request), ServletBridge.toJakarta(response),
- ServletBridge.toJakarta(chain));
+ this.wrapped.doFilter(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response),
+ JakartaServletBridge.toJakarta(chain));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterChain.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterChain.java
index 9ded9b1b0d..df9e49d05e 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterChain.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterChain.java
@@ -26,29 +26,28 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaFilterChain implements FilterChain
+public class JavaxToJakartaFilterChain extends AbstractJavaxToJakartaWrapper
+ implements FilterChain
{
- private final jakarta.servlet.FilterChain wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaFilterChain(jakarta.servlet.FilterChain wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException
{
try {
- this.wrapped.doFilter(ServletBridge.toJakarta(request), ServletBridge.toJakarta(response));
+ this.wrapped.doFilter(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterConfig.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterConfig.java
index 03837f5ecc..c18b9c542d 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterConfig.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterConfig.java
@@ -24,22 +24,21 @@
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaFilterConfig implements FilterConfig
+public class JavaxToJakartaFilterConfig extends AbstractJavaxToJakartaWrapper
+ implements FilterConfig
{
- private final jakarta.servlet.FilterConfig wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaFilterConfig(jakarta.servlet.FilterConfig wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -51,7 +50,7 @@ public String getFilterName()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJavax(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJavax(this.wrapped.getServletContext());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterRegistration.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterRegistration.java
index 25697fd2aa..7892ac4685 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterRegistration.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaFilterRegistration.java
@@ -27,7 +27,7 @@
import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @param the exact type of jakarta.servlet.FilterRegistration
@@ -35,10 +35,8 @@
* @since 42.0.0
*/
public class JavaxToJakartaFilterRegistration
- implements FilterRegistration
+ extends AbstractJavaxToJakartaWrapper implements FilterRegistration
{
- protected final T wrapped;
-
/**
* @version $Id$
*/
@@ -65,7 +63,7 @@ public void setAsyncSupported(boolean isAsyncSupported)
*/
public JavaxToJakartaFilterRegistration(T wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -108,7 +106,8 @@ public Map getInitParameters()
public void addMappingForServletNames(EnumSet dispatcherTypes, boolean isMatchAfter,
String... servletNames)
{
- this.wrapped.addMappingForServletNames(ServletBridge.toJakarta(dispatcherTypes), isMatchAfter, servletNames);
+ this.wrapped.addMappingForServletNames(JakartaServletBridge.toJakarta(dispatcherTypes), isMatchAfter,
+ servletNames);
}
@Override
@@ -121,7 +120,8 @@ public Collection getServletNameMappings()
public void addMappingForUrlPatterns(EnumSet dispatcherTypes, boolean isMatchAfter,
String... urlPatterns)
{
- this.wrapped.addMappingForUrlPatterns(ServletBridge.toJakarta(dispatcherTypes), isMatchAfter, urlPatterns);
+ this.wrapped.addMappingForUrlPatterns(JakartaServletBridge.toJakarta(dispatcherTypes), isMatchAfter,
+ urlPatterns);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequest.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequest.java
index c401e6b6b9..3e83fde1f0 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequest.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequest.java
@@ -32,7 +32,7 @@
import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @param the type of http servlet request
@@ -59,7 +59,7 @@ public String getAuthType()
@Override
public Cookie[] getCookies()
{
- return ServletBridge.toJavax(this.wrapped.getCookies());
+ return JakartaServletBridge.toJavax(this.wrapped.getCookies());
}
@Override
@@ -167,13 +167,13 @@ public String getServletPath()
@Override
public HttpSession getSession(boolean create)
{
- return ServletBridge.toJavax(this.wrapped.getSession(create));
+ return JakartaServletBridge.toJavax(this.wrapped.getSession(create));
}
@Override
public HttpSession getSession()
{
- return ServletBridge.toJavax(this.wrapped.getSession());
+ return JakartaServletBridge.toJavax(this.wrapped.getSession());
}
@Override
@@ -211,7 +211,7 @@ public boolean isRequestedSessionIdFromUrl()
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
{
try {
- return this.wrapped.authenticate(ServletBridge.toJakarta(response));
+ return this.wrapped.authenticate(JakartaServletBridge.toJakarta(response));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -241,7 +241,7 @@ public void logout() throws ServletException
public Collection getParts() throws IOException, ServletException
{
try {
- return this.wrapped.getParts().stream().map(p -> (Part) ServletBridge.toJavax(p)).toList();
+ return this.wrapped.getParts().stream().map(p -> (Part) JakartaServletBridge.toJavax(p)).toList();
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -251,7 +251,7 @@ public Collection getParts() throws IOException, ServletException
public Part getPart(String name) throws IOException, ServletException
{
try {
- return ServletBridge.toJavax(this.wrapped.getPart(name));
+ return JakartaServletBridge.toJavax(this.wrapped.getPart(name));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequestWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequestWrapper.java
new file mode 100644
index 0000000000..f0c5b887fc
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletRequestWrapper.java
@@ -0,0 +1,520 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.DispatcherType;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
+import javax.servlet.http.Part;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+
+/**
+ * @param the type of http servlet request
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JavaxToJakartaHttpServletRequestWrapper
+ extends HttpServletRequestWrapper implements JavaxToJakartaWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JavaxToJakartaHttpServletRequestWrapper(R wrapped)
+ {
+ // Make sure that HttpServletRequestWrapper#getRequest returns something accurate
+ super(JakartaServletBridge.toJavax((jakarta.servlet.http.HttpServletRequest) wrapped.getRequest()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JavaxToJakartaWrapper
+
+ /**
+ * @return the jakarta version
+ */
+ public R getJakarta()
+ {
+ return this.wrapped;
+ }
+
+ // HttpServletRequest
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return this.wrapped.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return this.wrapped.getAttributeNames();
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ this.wrapped.setCharacterEncoding(env);
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ return this.wrapped.getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong()
+ {
+ return this.wrapped.getContentLengthLong();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getInputStream());
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return this.wrapped.getParameter(name);
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ return this.wrapped.getParameterNames();
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ return this.wrapped.getParameterValues(name);
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ return this.wrapped.getParameterMap();
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return this.wrapped.getProtocol();
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return this.wrapped.getScheme();
+ }
+
+ @Override
+ public String getServerName()
+ {
+ return this.wrapped.getServerName();
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ return this.wrapped.getServerPort();
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ return this.wrapped.getReader();
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return this.wrapped.getRemoteAddr();
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ return this.wrapped.getRemoteHost();
+ }
+
+ @Override
+ public void setAttribute(String name, Object o)
+ {
+ this.wrapped.setAttribute(name, o);
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ this.wrapped.removeAttribute(name);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ return this.wrapped.getLocales();
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ return this.wrapped.isSecure();
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getRequestDispatcher(path));
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ // Since deprecated APIs where removed in Servlet 6, it's safer to use alternatives
+ return this.wrapped.getServletContext().getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ return this.wrapped.getRemotePort();
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return this.wrapped.getLocalName();
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ return this.wrapped.getLocalAddr();
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ return this.wrapped.getLocalPort();
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getServletContext());
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.startAsync());
+ }
+
+ @Override
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.startAsync(JakartaServletBridge.toJakarta(servletRequest),
+ JakartaServletBridge.toJakarta(servletResponse)));
+ }
+
+ @Override
+ public boolean isAsyncStarted()
+ {
+ return this.wrapped.isAsyncStarted();
+ }
+
+ @Override
+ public boolean isAsyncSupported()
+ {
+ return this.wrapped.isAsyncSupported();
+ }
+
+ @Override
+ public AsyncContext getAsyncContext()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getAsyncContext());
+ }
+
+ @Override
+ public DispatcherType getDispatcherType()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getDispatcherType());
+ }
+
+ @Override
+ public String getAuthType()
+ {
+ return this.wrapped.getAuthType();
+ }
+
+ @Override
+ public Cookie[] getCookies()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getCookies());
+ }
+
+ @Override
+ public long getDateHeader(String name)
+ {
+ return this.wrapped.getDateHeader(name);
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return this.wrapped.getHeader(name);
+ }
+
+ @Override
+ public Enumeration getHeaders(String name)
+ {
+ return this.wrapped.getHeaders(name);
+ }
+
+ @Override
+ public Enumeration getHeaderNames()
+ {
+ return this.wrapped.getHeaderNames();
+ }
+
+ @Override
+ public int getIntHeader(String name)
+ {
+ return this.wrapped.getIntHeader(name);
+ }
+
+ @Override
+ public String getMethod()
+ {
+ return this.wrapped.getMethod();
+ }
+
+ @Override
+ public String getPathInfo()
+ {
+ return this.wrapped.getPathInfo();
+ }
+
+ @Override
+ public String getPathTranslated()
+ {
+ return this.wrapped.getPathTranslated();
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return this.wrapped.getContextPath();
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return this.wrapped.getQueryString();
+ }
+
+ @Override
+ public String getRemoteUser()
+ {
+ return this.wrapped.getRemoteUser();
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ return this.wrapped.isUserInRole(role);
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ return this.wrapped.getUserPrincipal();
+ }
+
+ @Override
+ public String getRequestedSessionId()
+ {
+ return this.wrapped.getRequestedSessionId();
+ }
+
+ @Override
+ public String getRequestURI()
+ {
+ return this.wrapped.getRequestURI();
+ }
+
+ @Override
+ public StringBuffer getRequestURL()
+ {
+ return this.wrapped.getRequestURL();
+ }
+
+ @Override
+ public String getServletPath()
+ {
+ return this.wrapped.getServletPath();
+ }
+
+ @Override
+ public HttpSession getSession(boolean create)
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getSession(create));
+ }
+
+ @Override
+ public HttpSession getSession()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getSession());
+ }
+
+ @Override
+ public String changeSessionId()
+ {
+ return this.wrapped.changeSessionId();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid()
+ {
+ return this.wrapped.isRequestedSessionIdValid();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ return this.wrapped.isRequestedSessionIdFromCookie();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return this.wrapped.isRequestedSessionIdFromURL();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ // Since deprecated APIs where removed in Servlet 6, it's safer to use alternatives
+ return this.wrapped.isRequestedSessionIdFromURL();
+ }
+
+ @Override
+ public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
+ {
+ try {
+ return this.wrapped.authenticate(JakartaServletBridge.toJakarta(response));
+ } catch (jakarta.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void login(String username, String password) throws ServletException
+ {
+ try {
+ this.wrapped.login(username, password);
+ } catch (jakarta.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void logout() throws ServletException
+ {
+ try {
+ this.wrapped.logout();
+ } catch (jakarta.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Collection getParts() throws IOException, ServletException
+ {
+ try {
+ return this.wrapped.getParts().stream().map(p -> (Part) JakartaServletBridge.toJavax(p)).toList();
+ } catch (jakarta.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Part getPart(String name) throws IOException, ServletException
+ {
+ try {
+ return JakartaServletBridge.toJavax(this.wrapped.getPart(name));
+ } catch (jakarta.servlet.ServletException e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public T upgrade(Class handlerClass) throws IOException, ServletException
+ {
+ // TODO
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponse.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponse.java
index 1cdc801290..83a0d3a4bc 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponse.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponse.java
@@ -25,7 +25,7 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @param the type of http servlet response
@@ -46,7 +46,7 @@ public JavaxToJakartaHttpServletResponse(R wrapped)
@Override
public void addCookie(Cookie cookie)
{
- this.wrapped.addCookie(ServletBridge.toJakarta(cookie));
+ this.wrapped.addCookie(JakartaServletBridge.toJakarta(cookie));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponseWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponseWrapper.java
new file mode 100644
index 0000000000..3349bbdacb
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpServletResponseWrapper.java
@@ -0,0 +1,291 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+
+/**
+ * @param the type of http servlet response
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JavaxToJakartaHttpServletResponseWrapper
+ extends HttpServletResponseWrapper implements JavaxToJakartaWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JavaxToJakartaHttpServletResponseWrapper(R wrapped)
+ {
+ // Make sure that HttpServletRequestWrapper#getResponse returns something accurate
+ super(JakartaServletBridge.toJavax((jakarta.servlet.http.HttpServletResponse) wrapped.getResponse()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JavaxToJakartaWrapper
+
+ /**
+ * @return the jakarta version
+ */
+ public R getJakarta()
+ {
+ return this.wrapped;
+ }
+
+ // HttpServletResponse
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getOutputStream());
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException
+ {
+ return this.wrapped.getWriter();
+ }
+
+ @Override
+ public void setCharacterEncoding(String charset)
+ {
+ this.wrapped.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentLength(int len)
+ {
+ this.wrapped.setContentLength(len);
+ }
+
+ @Override
+ public void setContentLengthLong(long len)
+ {
+ this.wrapped.setContentLengthLong(len);
+ }
+
+ @Override
+ public void setContentType(String type)
+ {
+ this.wrapped.setContentType(type);
+ }
+
+ @Override
+ public void setBufferSize(int size)
+ {
+ this.wrapped.setBufferSize(size);
+ }
+
+ @Override
+ public int getBufferSize()
+ {
+ return this.wrapped.getBufferSize();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException
+ {
+ this.wrapped.flushBuffer();
+ }
+
+ @Override
+ public void resetBuffer()
+ {
+ this.wrapped.resetBuffer();
+ }
+
+ @Override
+ public boolean isCommitted()
+ {
+ return this.wrapped.isCommitted();
+ }
+
+ @Override
+ public void reset()
+ {
+ this.wrapped.reset();
+ }
+
+ @Override
+ public void setLocale(Locale loc)
+ {
+ this.wrapped.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+
+ @Override
+ public void addCookie(Cookie cookie)
+ {
+ this.wrapped.addCookie(JakartaServletBridge.toJakarta(cookie));
+ }
+
+ @Override
+ public boolean containsHeader(String name)
+ {
+ return this.wrapped.containsHeader(name);
+ }
+
+ @Override
+ public String encodeURL(String url)
+ {
+ return this.wrapped.encodeURL(url);
+ }
+
+ @Override
+ public String encodeRedirectURL(String url)
+ {
+ return this.wrapped.encodeRedirectURL(url);
+ }
+
+ @Override
+ public String encodeUrl(String url)
+ {
+ // Since deprecated APIs where removed in Servlet 6, it's safer to use alternatives
+ return this.wrapped.encodeURL(url);
+ }
+
+ @Override
+ public String encodeRedirectUrl(String url)
+ {
+ // Since deprecated APIs where removed in Servlet 6, it's safer to use alternatives
+ return this.wrapped.encodeRedirectURL(url);
+ }
+
+ @Override
+ public void sendError(int sc, String msg) throws IOException
+ {
+ this.wrapped.sendError(sc, msg);
+ }
+
+ @Override
+ public void sendError(int sc) throws IOException
+ {
+ this.wrapped.sendError(sc);
+ }
+
+ @Override
+ public void sendRedirect(String location) throws IOException
+ {
+ this.wrapped.sendRedirect(location);
+ }
+
+ @Override
+ public void setDateHeader(String name, long date)
+ {
+ this.wrapped.setDateHeader(name, date);
+ }
+
+ @Override
+ public void addDateHeader(String name, long date)
+ {
+ this.wrapped.addDateHeader(name, date);
+ }
+
+ @Override
+ public void setHeader(String name, String value)
+ {
+ this.wrapped.setHeader(name, value);
+ }
+
+ @Override
+ public void addHeader(String name, String value)
+ {
+ this.wrapped.addHeader(name, value);
+ }
+
+ @Override
+ public void setIntHeader(String name, int value)
+ {
+ this.wrapped.setIntHeader(name, value);
+ }
+
+ @Override
+ public void addIntHeader(String name, int value)
+ {
+ this.wrapped.addIntHeader(name, value);
+ }
+
+ @Override
+ public void setStatus(int sc)
+ {
+ this.wrapped.setStatus(sc);
+ }
+
+ @Override
+ public void setStatus(int sc, String sm)
+ {
+ // Since deprecated APIs where removed in Servlet 6, it's safer to use alternatives
+ this.wrapped.setStatus(sc);
+ }
+
+ @Override
+ public int getStatus()
+ {
+ return this.wrapped.getStatus();
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return this.wrapped.getHeader(name);
+ }
+
+ @Override
+ public Collection getHeaders(String name)
+ {
+ return this.wrapped.getHeaders(name);
+ }
+
+ @Override
+ public Collection getHeaderNames()
+ {
+ return this.wrapped.getHeaderNames();
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSession.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSession.java
index 47e5743391..8c4eee9c8f 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSession.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSession.java
@@ -26,24 +26,23 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaHttpSession implements HttpSession
+public class JavaxToJakartaHttpSession extends AbstractJavaxToJakartaWrapper
+ implements HttpSession
{
private static final String[] EMPTY_ARRAY = new String[0];
- private final jakarta.servlet.http.HttpSession wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaHttpSession(jakarta.servlet.http.HttpSession wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -67,7 +66,7 @@ public long getLastAccessedTime()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJavax(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJavax(this.wrapped.getServletContext());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSessionContext.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSessionContext.java
index 2d039639fd..c33b851c17 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSessionContext.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaHttpSessionContext.java
@@ -24,28 +24,27 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaHttpSessionContext implements HttpSessionContext
+public class JavaxToJakartaHttpSessionContext
+ extends AbstractJavaxToJakartaWrapper implements HttpSessionContext
{
- private final jakarta.servlet.http.HttpSessionContext wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaHttpSessionContext(jakarta.servlet.http.HttpSessionContext wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public HttpSession getSession(String sessionId)
{
- return ServletBridge.toJavax(this.wrapped.getSession(sessionId));
+ return JakartaServletBridge.toJavax(this.wrapped.getSession(sessionId));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaPart.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaPart.java
index eed4120ba2..d542e75b84 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaPart.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaPart.java
@@ -29,16 +29,14 @@
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaPart implements Part
+public class JavaxToJakartaPart extends AbstractJavaxToJakartaWrapper implements Part
{
- private final jakarta.servlet.http.Part wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaPart(jakarta.servlet.http.Part wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaReaderListener.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaReadListener.java
similarity index 86%
rename from xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaReaderListener.java
rename to xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaReadListener.java
index 439bb7970b..cf766ef173 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaReaderListener.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaReadListener.java
@@ -27,16 +27,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaReaderListener implements ReadListener
+public class JavaxToJakartaReadListener extends AbstractJavaxToJakartaWrapper
+ implements ReadListener
{
- private final jakarta.servlet.ReadListener wrapped;
-
/**
* @param wrapped the wrapped version
*/
- public JavaxToJakartaReaderListener(jakarta.servlet.ReadListener wrapped)
+ public JavaxToJakartaReadListener(jakarta.servlet.ReadListener wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaRequestDispatcher.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaRequestDispatcher.java
index 01c7977731..ff8a9a4ce9 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaRequestDispatcher.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaRequestDispatcher.java
@@ -26,29 +26,36 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaRequestDispatcher implements RequestDispatcher
+public class JavaxToJakartaRequestDispatcher extends AbstractJavaxToJakartaWrapper
+ implements RequestDispatcher
{
- private final jakarta.servlet.RequestDispatcher wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaRequestDispatcher(jakarta.servlet.RequestDispatcher wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
+ }
+
+ /**
+ * @return the wrapped version
+ */
+ public jakarta.servlet.RequestDispatcher getJakarta()
+ {
+ return this.wrapped;
}
@Override
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
try {
- this.wrapped.forward(ServletBridge.toJakarta(request), ServletBridge.toJakarta(response));
+ this.wrapped.forward(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -58,7 +65,7 @@ public void forward(ServletRequest request, ServletResponse response) throws Ser
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
try {
- this.wrapped.include(ServletBridge.toJakarta(request), ServletBridge.toJakarta(response));
+ this.wrapped.include(JakartaServletBridge.toJakarta(request), JakartaServletBridge.toJakarta(response));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServlet.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServlet.java
index f81ef77d75..4a1881e997 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServlet.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServlet.java
@@ -27,29 +27,27 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaServlet implements Servlet
+public class JavaxToJakartaServlet extends AbstractJavaxToJakartaWrapper implements Servlet
{
- private final jakarta.servlet.Servlet wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaServlet(jakarta.servlet.Servlet wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
public void init(ServletConfig config) throws ServletException
{
try {
- this.wrapped.init(ServletBridge.toJakarta(config));
+ this.wrapped.init(JakartaServletBridge.toJakarta(config));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -65,7 +63,7 @@ public ServletConfig getServletConfig()
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
{
try {
- this.wrapped.service(ServletBridge.toJakarta(req), ServletBridge.toJakarta(res));
+ this.wrapped.service(JakartaServletBridge.toJakarta(req), JakartaServletBridge.toJakarta(res));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletConfig.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletConfig.java
index c2bdab90c2..4026cb3eaa 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletConfig.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletConfig.java
@@ -24,22 +24,21 @@
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaServletConfig implements ServletConfig
+public class JavaxToJakartaServletConfig extends AbstractJavaxToJakartaWrapper
+ implements ServletConfig
{
- private final jakarta.servlet.ServletConfig wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaServletConfig(jakarta.servlet.ServletConfig wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -51,7 +50,7 @@ public String getServletName()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJavax(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJavax(this.wrapped.getServletContext());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletContext.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletContext.java
index b4fe46e5d4..0067588b71 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletContext.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletContext.java
@@ -39,22 +39,21 @@
import javax.servlet.SessionTrackingMode;
import javax.servlet.descriptor.JspConfigDescriptor;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaServletContext implements ServletContext
+public class JavaxToJakartaServletContext extends AbstractJavaxToJakartaWrapper
+ implements ServletContext
{
- private final jakarta.servlet.ServletContext wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaServletContext(jakarta.servlet.ServletContext wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -66,7 +65,7 @@ public String getContextPath()
@Override
public ServletContext getContext(String uripath)
{
- return ServletBridge.toJavax(this.wrapped.getContext(uripath));
+ return JakartaServletBridge.toJavax(this.wrapped.getContext(uripath));
}
@Override
@@ -120,7 +119,7 @@ public InputStream getResourceAsStream(String path)
@Override
public RequestDispatcher getRequestDispatcher(String path)
{
- return ServletBridge.toJavax(this.wrapped.getRequestDispatcher(path));
+ return JakartaServletBridge.toJavax(this.wrapped.getRequestDispatcher(path));
}
@Override
@@ -133,7 +132,7 @@ public RequestDispatcher getNamedDispatcher(String name)
public Servlet getServlet(String name) throws ServletException
{
try {
- return ServletBridge.toJavax(this.wrapped.getServlet(name));
+ return JakartaServletBridge.toJavax(this.wrapped.getServlet(name));
} catch (jakarta.servlet.ServletException e) {
throw new ServletException(e.getMessage(), e);
}
@@ -142,7 +141,7 @@ public Servlet getServlet(String name) throws ServletException
@Override
public Enumeration getServlets()
{
- return ServletBridge.toJavax(this.wrapped.getServlets());
+ return JakartaServletBridge.toJavax(this.wrapped.getServlets());
}
@Override
@@ -233,13 +232,13 @@ public String getServletContextName()
@Override
public Dynamic addServlet(String servletName, String className)
{
- return ServletBridge.toJavax(this.wrapped.addServlet(servletName, className));
+ return JakartaServletBridge.toJavax(this.wrapped.addServlet(servletName, className));
}
@Override
public Dynamic addServlet(String servletName, Servlet servlet)
{
- return ServletBridge.toJavax(this.wrapped.addServlet(servletName, ServletBridge.toJakarta(servlet)));
+ return JakartaServletBridge.toJavax(this.wrapped.addServlet(servletName, JakartaServletBridge.toJakarta(servlet)));
}
@Override
@@ -259,7 +258,7 @@ public T createServlet(Class clazz) throws ServletExcepti
@Override
public ServletRegistration getServletRegistration(String servletName)
{
- return ServletBridge.toJavax(this.wrapped.getServletRegistration(servletName));
+ return JakartaServletBridge.toJavax(this.wrapped.getServletRegistration(servletName));
}
@Override
@@ -272,13 +271,13 @@ public ServletRegistration getServletRegistration(String servletName)
@Override
public FilterRegistration.Dynamic addFilter(String filterName, String className)
{
- return ServletBridge.toJavax(this.wrapped.addFilter(filterName, className));
+ return JakartaServletBridge.toJavax(this.wrapped.addFilter(filterName, className));
}
@Override
public FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
{
- return ServletBridge.toJavax(this.wrapped.addFilter(filterName, ServletBridge.toJakarta(filter)));
+ return JakartaServletBridge.toJavax(this.wrapped.addFilter(filterName, JakartaServletBridge.toJakarta(filter)));
}
@Override
@@ -298,7 +297,7 @@ public T createFilter(Class clazz) throws ServletException
@Override
public FilterRegistration getFilterRegistration(String filterName)
{
- return ServletBridge.toJavax(this.wrapped.getFilterRegistration(filterName));
+ return JakartaServletBridge.toJavax(this.wrapped.getFilterRegistration(filterName));
}
@Override
@@ -311,25 +310,25 @@ public FilterRegistration getFilterRegistration(String filterName)
@Override
public SessionCookieConfig getSessionCookieConfig()
{
- return ServletBridge.toJavax(this.wrapped.getSessionCookieConfig());
+ return JakartaServletBridge.toJavax(this.wrapped.getSessionCookieConfig());
}
@Override
public void setSessionTrackingModes(Set sessionTrackingModes)
{
- this.wrapped.setSessionTrackingModes(ServletBridge.toJakarta(sessionTrackingModes));
+ this.wrapped.setSessionTrackingModes(JakartaServletBridge.toJakarta(sessionTrackingModes));
}
@Override
public Set getDefaultSessionTrackingModes()
{
- return ServletBridge.toJavax(this.wrapped.getDefaultSessionTrackingModes());
+ return JakartaServletBridge.toJavax(this.wrapped.getDefaultSessionTrackingModes());
}
@Override
public Set getEffectiveSessionTrackingModes()
{
- return ServletBridge.toJavax(this.wrapped.getEffectiveSessionTrackingModes());
+ return JakartaServletBridge.toJavax(this.wrapped.getEffectiveSessionTrackingModes());
}
@Override
@@ -363,7 +362,7 @@ public T createListener(Class clazz) throws Servlet
@Override
public JspConfigDescriptor getJspConfigDescriptor()
{
- return ServletBridge.toJavax(this.wrapped.getJspConfigDescriptor());
+ return JakartaServletBridge.toJavax(this.wrapped.getJspConfigDescriptor());
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletInputStream.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletInputStream.java
index d8ef85917e..0053ef355e 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletInputStream.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletInputStream.java
@@ -24,13 +24,15 @@
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
public class JavaxToJakartaServletInputStream extends ServletInputStream
+ implements JavaxToJakartaWrapper
{
private final jakarta.servlet.ServletInputStream wrapped;
@@ -42,6 +44,12 @@ public JavaxToJakartaServletInputStream(jakarta.servlet.ServletInputStream wrapp
this.wrapped = wrapped;
}
+ @Override
+ public jakarta.servlet.ServletInputStream getJakarta()
+ {
+ return this.wrapped;
+ }
+
@Override
public boolean isFinished()
{
@@ -57,7 +65,7 @@ public boolean isReady()
@Override
public void setReadListener(ReadListener readListener)
{
- this.wrapped.setReadListener(ServletBridge.toJakarta(readListener));
+ this.wrapped.setReadListener(JakartaServletBridge.toJakarta(readListener));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletOutputStream.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletOutputStream.java
index 40e0bb1317..3394c5ccd6 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletOutputStream.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletOutputStream.java
@@ -24,13 +24,15 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @version $Id$
* @since 42.0.0
*/
public class JavaxToJakartaServletOutputStream extends ServletOutputStream
+ implements JavaxToJakartaWrapper
{
private final jakarta.servlet.ServletOutputStream wrapped;
@@ -42,6 +44,12 @@ public JavaxToJakartaServletOutputStream(jakarta.servlet.ServletOutputStream wra
this.wrapped = wrapped;
}
+ @Override
+ public jakarta.servlet.ServletOutputStream getJakarta()
+ {
+ return this.wrapped;
+ }
+
@Override
public boolean isReady()
{
@@ -51,7 +59,7 @@ public boolean isReady()
@Override
public void setWriteListener(WriteListener writeListener)
{
- this.wrapped.setWriteListener(ServletBridge.toJakarta(writeListener));
+ this.wrapped.setWriteListener(JakartaServletBridge.toJakarta(writeListener));
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRegistration.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRegistration.java
index 0f37cca6b7..d0485344f6 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRegistration.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRegistration.java
@@ -27,7 +27,7 @@
import javax.servlet.ServletRegistration;
import javax.servlet.ServletSecurityElement;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @param the exact type of jakarta.servlet.ServletRegistration
@@ -35,10 +35,8 @@
* @since 42.0.0
*/
public class JavaxToJakartaServletRegistration
- implements ServletRegistration
+ extends AbstractJavaxToJakartaWrapper implements ServletRegistration
{
- protected final T wrapped;
-
/**
* @version $Id$
*/
@@ -62,13 +60,13 @@ public void setLoadOnStartup(int loadOnStartup)
@Override
public Set setServletSecurity(ServletSecurityElement constraint)
{
- return this.wrapped.setServletSecurity(ServletBridge.toJakarta(constraint));
+ return this.wrapped.setServletSecurity(JakartaServletBridge.toJakarta(constraint));
}
@Override
public void setMultipartConfig(MultipartConfigElement multipartConfig)
{
- this.wrapped.setMultipartConfig(ServletBridge.toJakarta(multipartConfig));
+ this.wrapped.setMultipartConfig(JakartaServletBridge.toJakarta(multipartConfig));
}
@Override
@@ -89,7 +87,7 @@ public void setAsyncSupported(boolean isAsyncSupported)
*/
public JavaxToJakartaServletRegistration(T wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequest.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequest.java
index 30013110ee..1533667c3d 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequest.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequest.java
@@ -34,23 +34,22 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @param the type of servlet request
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaServletRequest implements ServletRequest
+public class JavaxToJakartaServletRequest
+ extends AbstractJavaxToJakartaWrapper implements ServletRequest
{
- protected final R wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaServletRequest(R wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -98,7 +97,7 @@ public String getContentType()
@Override
public ServletInputStream getInputStream() throws IOException
{
- return ServletBridge.toJavax(this.wrapped.getInputStream());
+ return JakartaServletBridge.toJavax(this.wrapped.getInputStream());
}
@Override
@@ -200,7 +199,7 @@ public boolean isSecure()
@Override
public RequestDispatcher getRequestDispatcher(String path)
{
- return ServletBridge.toJavax(this.wrapped.getRequestDispatcher(path));
+ return JakartaServletBridge.toJavax(this.wrapped.getRequestDispatcher(path));
}
@Override
@@ -237,21 +236,21 @@ public int getLocalPort()
@Override
public ServletContext getServletContext()
{
- return ServletBridge.toJavax(this.wrapped.getServletContext());
+ return JakartaServletBridge.toJavax(this.wrapped.getServletContext());
}
@Override
public AsyncContext startAsync() throws IllegalStateException
{
- return ServletBridge.toJavax(this.wrapped.startAsync());
+ return JakartaServletBridge.toJavax(this.wrapped.startAsync());
}
@Override
public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
throws IllegalStateException
{
- return ServletBridge.toJavax(this.wrapped.startAsync(ServletBridge.toJakarta(servletRequest),
- ServletBridge.toJakarta(servletResponse)));
+ return JakartaServletBridge.toJavax(this.wrapped.startAsync(JakartaServletBridge.toJakarta(servletRequest),
+ JakartaServletBridge.toJakarta(servletResponse)));
}
@Override
@@ -269,12 +268,12 @@ public boolean isAsyncSupported()
@Override
public AsyncContext getAsyncContext()
{
- return ServletBridge.toJavax(this.wrapped.getAsyncContext());
+ return JakartaServletBridge.toJavax(this.wrapped.getAsyncContext());
}
@Override
public DispatcherType getDispatcherType()
{
- return ServletBridge.toJavax(this.wrapped.getDispatcherType());
+ return JakartaServletBridge.toJavax(this.wrapped.getDispatcherType());
}
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequestWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequestWrapper.java
new file mode 100644
index 0000000000..0f3c20be9a
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletRequestWrapper.java
@@ -0,0 +1,298 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.DispatcherType;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletRequestWrapper;
+import javax.servlet.ServletResponse;
+
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+
+/**
+ * @param the type of http servlet request
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JavaxToJakartaServletRequestWrapper
+ extends ServletRequestWrapper implements JavaxToJakartaWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JavaxToJakartaServletRequestWrapper(R wrapped)
+ {
+ // Make sure that HttpServletRequestWrapper#getRequest returns something accurate
+ super(JakartaServletBridge.toJavax(wrapped.getRequest()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JavaxToJakartaWrapper
+
+ /**
+ * @return the jakarta version
+ */
+ public R getJakarta()
+ {
+ return this.wrapped;
+ }
+
+ // HttpServletRequest
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return this.wrapped.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return this.wrapped.getAttributeNames();
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ this.wrapped.setCharacterEncoding(env);
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ return this.wrapped.getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong()
+ {
+ return this.wrapped.getContentLengthLong();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getInputStream());
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return this.wrapped.getParameter(name);
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ return this.wrapped.getParameterNames();
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ return this.wrapped.getParameterValues(name);
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ return this.wrapped.getParameterMap();
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return this.wrapped.getProtocol();
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return this.wrapped.getScheme();
+ }
+
+ @Override
+ public String getServerName()
+ {
+ return this.wrapped.getServerName();
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ return this.wrapped.getServerPort();
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ return this.wrapped.getReader();
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return this.wrapped.getRemoteAddr();
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ return this.wrapped.getRemoteHost();
+ }
+
+ @Override
+ public void setAttribute(String name, Object o)
+ {
+ this.wrapped.setAttribute(name, o);
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ this.wrapped.removeAttribute(name);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ return this.wrapped.getLocales();
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ return this.wrapped.isSecure();
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getRequestDispatcher(path));
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ // Since deprecated APIs where removed in Servlet 6, it's safer to use alternatives
+ return this.wrapped.getServletContext().getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ return this.wrapped.getRemotePort();
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return this.wrapped.getLocalName();
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ return this.wrapped.getLocalAddr();
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ return this.wrapped.getLocalPort();
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getServletContext());
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.startAsync());
+ }
+
+ @Override
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.startAsync(JakartaServletBridge.toJakarta(servletRequest),
+ JakartaServletBridge.toJakarta(servletResponse)));
+ }
+
+ @Override
+ public boolean isAsyncStarted()
+ {
+ return this.wrapped.isAsyncStarted();
+ }
+
+ @Override
+ public boolean isAsyncSupported()
+ {
+ return this.wrapped.isAsyncSupported();
+ }
+
+ @Override
+ public AsyncContext getAsyncContext()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getAsyncContext());
+ }
+
+ @Override
+ public DispatcherType getDispatcherType()
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getDispatcherType());
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponse.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponse.java
index 5f818efd6d..d25e1a148b 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponse.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponse.java
@@ -26,23 +26,22 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
-import org.xwiki.jakartabridge.servlet.ServletBridge;
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
/**
* @param the type of servlet response
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaServletResponse implements ServletResponse
+public class JavaxToJakartaServletResponse
+ extends AbstractJavaxToJakartaWrapper implements ServletResponse
{
- protected final R wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaServletResponse(R wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
@@ -60,7 +59,7 @@ public String getContentType()
@Override
public ServletOutputStream getOutputStream() throws IOException
{
- return ServletBridge.toJavax(this.wrapped.getOutputStream());
+ return JakartaServletBridge.toJavax(this.wrapped.getOutputStream());
}
@Override
@@ -140,5 +139,4 @@ public Locale getLocale()
{
return this.wrapped.getLocale();
}
-
}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponseWrapper.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponseWrapper.java
new file mode 100644
index 0000000000..54056d2d02
--- /dev/null
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaServletResponseWrapper.java
@@ -0,0 +1,159 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.jakartabridge.servlet.internal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletResponseWrapper;
+
+import org.xwiki.jakartabridge.servlet.JakartaServletBridge;
+import org.xwiki.jakartabridge.servlet.JavaxToJakartaWrapper;
+
+/**
+ * @param the type of http servlet response
+ * @version $Id$
+ * @since 42.0.0
+ */
+public class JavaxToJakartaServletResponseWrapper
+ extends ServletResponseWrapper implements JavaxToJakartaWrapper
+{
+ protected final R wrapped;
+
+ /**
+ * @param wrapped the wrapped version
+ */
+ public JavaxToJakartaServletResponseWrapper(R wrapped)
+ {
+ super(JakartaServletBridge.toJavax(wrapped.getResponse()));
+
+ this.wrapped = wrapped;
+ }
+
+ // JavaxToJakartaWrapper
+
+ /**
+ * @return the jakarta version
+ */
+ public R getJakarta()
+ {
+ return this.wrapped;
+ }
+
+ // HttpServletResponse
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return this.wrapped.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return this.wrapped.getContentType();
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return JakartaServletBridge.toJavax(this.wrapped.getOutputStream());
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException
+ {
+ return this.wrapped.getWriter();
+ }
+
+ @Override
+ public void setCharacterEncoding(String charset)
+ {
+ this.wrapped.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentLength(int len)
+ {
+ this.wrapped.setContentLength(len);
+ }
+
+ @Override
+ public void setContentLengthLong(long len)
+ {
+ this.wrapped.setContentLengthLong(len);
+ }
+
+ @Override
+ public void setContentType(String type)
+ {
+ this.wrapped.setContentType(type);
+ }
+
+ @Override
+ public void setBufferSize(int size)
+ {
+ this.wrapped.setBufferSize(size);
+ }
+
+ @Override
+ public int getBufferSize()
+ {
+ return this.wrapped.getBufferSize();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException
+ {
+ this.wrapped.flushBuffer();
+ }
+
+ @Override
+ public void resetBuffer()
+ {
+ this.wrapped.resetBuffer();
+ }
+
+ @Override
+ public boolean isCommitted()
+ {
+ return this.wrapped.isCommitted();
+ }
+
+ @Override
+ public void reset()
+ {
+ this.wrapped.reset();
+ }
+
+ @Override
+ public void setLocale(Locale loc)
+ {
+ this.wrapped.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return this.wrapped.getLocale();
+ }
+}
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaSessionCookieConfig.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaSessionCookieConfig.java
index 88ac6f5a35..539b6336e4 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaSessionCookieConfig.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaSessionCookieConfig.java
@@ -25,16 +25,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaSessionCookieConfig implements SessionCookieConfig
+public class JavaxToJakartaSessionCookieConfig
+ extends AbstractJavaxToJakartaWrapper implements SessionCookieConfig
{
- private final jakarta.servlet.SessionCookieConfig wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaSessionCookieConfig(jakarta.servlet.SessionCookieConfig wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaWriteListener.java b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaWriteListener.java
index 68495122b3..90c06f833c 100644
--- a/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaWriteListener.java
+++ b/xwiki-commons-core/xwiki-commons-jakartabridge/xwiki-commons-jakartabridge-servlet/src/main/java/org/xwiki/jakartabridge/servlet/internal/JavaxToJakartaWriteListener.java
@@ -27,16 +27,15 @@
* @version $Id$
* @since 42.0.0
*/
-public class JavaxToJakartaWriteListener implements WriteListener
+public class JavaxToJakartaWriteListener extends AbstractJavaxToJakartaWrapper
+ implements WriteListener
{
- private final jakarta.servlet.WriteListener wrapped;
-
/**
* @param wrapped the wrapped version
*/
public JavaxToJakartaWriteListener(jakarta.servlet.WriteListener wrapped)
{
- this.wrapped = wrapped;
+ super(wrapped);
}
@Override
diff --git a/xwiki-commons-core/xwiki-commons-properties/pom.xml b/xwiki-commons-core/xwiki-commons-properties/pom.xml
index 494bc0c4cb..41c39f1c7a 100644
--- a/xwiki-commons-core/xwiki-commons-properties/pom.xml
+++ b/xwiki-commons-core/xwiki-commons-properties/pom.xml
@@ -73,11 +73,9 @@
hibernate-validator
test
-
- org.mortbay.jasper
- apache-el
+ org.glassfish.expressly
+ expressly
test
diff --git a/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/DefaultBeanManager.java b/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/DefaultBeanManager.java
index fdaf32ee85..17622d545d 100644
--- a/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/DefaultBeanManager.java
+++ b/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/DefaultBeanManager.java
@@ -28,12 +28,12 @@
import javax.inject.Inject;
import javax.inject.Singleton;
-import javax.validation.ConstraintViolation;
-import javax.validation.NoProviderFoundException;
-import javax.validation.Validation;
-import javax.validation.ValidationException;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
+import jakarta.validation.ConstraintViolation;
+import jakarta.validation.NoProviderFoundException;
+import jakarta.validation.Validation;
+import jakarta.validation.ValidationException;
+import jakarta.validation.Validator;
+import jakarta.validation.ValidatorFactory;
import org.slf4j.Logger;
import org.xwiki.collection.SoftCache;
diff --git a/xwiki-commons-core/xwiki-commons-properties/src/test/java/org/xwiki/properties/test/TestBeanValidation.java b/xwiki-commons-core/xwiki-commons-properties/src/test/java/org/xwiki/properties/test/TestBeanValidation.java
index 7750a62944..c611e797c3 100644
--- a/xwiki-commons-core/xwiki-commons-properties/src/test/java/org/xwiki/properties/test/TestBeanValidation.java
+++ b/xwiki-commons-core/xwiki-commons-properties/src/test/java/org/xwiki/properties/test/TestBeanValidation.java
@@ -19,7 +19,7 @@
*/
package org.xwiki.properties.test;
-import javax.validation.constraints.AssertTrue;
+import jakarta.validation.constraints.AssertTrue;
public class TestBeanValidation
{