You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2024/06/12 15:14:13 UTC
(felix-dev) branch master updated: Add branch for 1.0.x wrappers
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new af7ddebcc5 Add branch for 1.0.x wrappers
af7ddebcc5 is described below
commit af7ddebcc5a96093431dbdee22f48922f94962e0
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jun 12 17:14:01 2024 +0200
Add branch for 1.0.x wrappers
---
http/wrappers-1.0.x/README | 1 +
http/wrappers-1.0.x/pom.xml | 94 +++++
.../http/jakartawrappers/AsyncContextWrapper.java | 109 ++++++
.../http/jakartawrappers/AsyncListenerWrapper.java | 77 ++++
.../felix/http/jakartawrappers/CookieWrapper.java | 113 ++++++
.../http/jakartawrappers/EventListenerWrapper.java | 229 +++++++++++
.../jakartawrappers/FilterRegistrationWrapper.java | 115 ++++++
.../felix/http/jakartawrappers/FilterWrapper.java | 78 ++++
.../jakartawrappers/HttpServletMappingWrapper.java | 73 ++++
.../jakartawrappers/HttpServletRequestWrapper.java | 268 +++++++++++++
.../HttpServletResponseWrapper.java | 151 ++++++++
.../jakartawrappers/HttpSessionContextWrapper.java | 55 +++
.../http/jakartawrappers/HttpSessionWrapper.java | 132 +++++++
.../felix/http/jakartawrappers/PartWrapper.java | 91 +++++
.../http/jakartawrappers/PushBuilderWrapper.java | 116 ++++++
.../http/jakartawrappers/ReadListenerWrapper.java | 55 +++
.../jakartawrappers/RequestDispatcherWrapper.java | 62 +++
.../http/jakartawrappers/ServletConfigWrapper.java | 60 +++
.../jakartawrappers/ServletContextWrapper.java | 417 ++++++++++++++++++++
.../http/jakartawrappers/ServletExceptionUtil.java | 40 ++
.../jakartawrappers/ServletExceptionWrapper.java | 47 +++
.../jakartawrappers/ServletInputStreamWrapper.java | 128 +++++++
.../ServletOutputStreamWrapper.java | 150 ++++++++
.../ServletRegistrationWrapper.java | 86 +++++
.../jakartawrappers/ServletRequestWrapper.java | 420 +++++++++++++++++++++
.../jakartawrappers/ServletResponseWrapper.java | 145 +++++++
.../felix/http/jakartawrappers/ServletWrapper.java | 98 +++++
.../SessionCookieConfigWrapper.java | 107 ++++++
.../http/jakartawrappers/WriteListenerWrapper.java | 49 +++
.../felix/http/jakartawrappers/package-info.java | 21 ++
.../http/javaxwrappers/AsyncContextWrapper.java | 104 +++++
.../http/javaxwrappers/AsyncListenerWrapper.java | 78 ++++
.../felix/http/javaxwrappers/CookieWrapper.java | 113 ++++++
.../http/javaxwrappers/FilterChainWrapper.java | 51 +++
.../http/javaxwrappers/FilterConfigWrapper.java | 59 +++
.../javaxwrappers/FilterRegistrationWrapper.java | 115 ++++++
.../javaxwrappers/HttpServletMappingWrapper.java | 72 ++++
.../javaxwrappers/HttpServletRequestWrapper.java | 264 +++++++++++++
.../javaxwrappers/HttpServletResponseWrapper.java | 151 ++++++++
.../javaxwrappers/HttpSessionContextWrapper.java | 55 +++
.../http/javaxwrappers/HttpSessionWrapper.java | 130 +++++++
.../felix/http/javaxwrappers/PartWrapper.java | 91 +++++
.../http/javaxwrappers/PushBuilderWrapper.java | 116 ++++++
.../http/javaxwrappers/ReadListenerWrapper.java | 55 +++
.../javaxwrappers/RequestDispatcherWrapper.java | 61 +++
.../http/javaxwrappers/ServletConfigWrapper.java | 59 +++
.../http/javaxwrappers/ServletContextWrapper.java | 416 ++++++++++++++++++++
.../http/javaxwrappers/ServletExceptionUtil.java | 40 ++
.../javaxwrappers/ServletExceptionWrapper.java | 47 +++
.../javaxwrappers/ServletInputStreamWrapper.java | 128 +++++++
.../javaxwrappers/ServletOutputStreamWrapper.java | 150 ++++++++
.../javaxwrappers/ServletRegistrationWrapper.java | 86 +++++
.../http/javaxwrappers/ServletRequestWrapper.java | 417 ++++++++++++++++++++
.../http/javaxwrappers/ServletResponseWrapper.java | 145 +++++++
.../felix/http/javaxwrappers/ServletWrapper.java | 83 ++++
.../javaxwrappers/SessionCookieConfigWrapper.java | 107 ++++++
.../http/javaxwrappers/WriteListenerWrapper.java | 49 +++
.../felix/http/javaxwrappers/package-info.java | 21 ++
.../http/jakartawrappers/ServletRequestTest.java | 279 ++++++++++++++
.../http/javaxwrappers/ServletRequestTest.java | 279 ++++++++++++++
60 files changed, 7408 insertions(+)
diff --git a/http/wrappers-1.0.x/README b/http/wrappers-1.0.x/README
new file mode 100644
index 0000000000..75f419fab5
--- /dev/null
+++ b/http/wrappers-1.0.x/README
@@ -0,0 +1 @@
+This directory contains wrappers from javax.servlet to jakarta.servlet
diff --git a/http/wrappers-1.0.x/pom.xml b/http/wrappers-1.0.x/pom.xml
new file mode 100644
index 0000000000..11ed0ac9f7
--- /dev/null
+++ b/http/wrappers-1.0.x/pom.xml
@@ -0,0 +1,94 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix-parent</artifactId>
+ <version>9</version>
+ <relativePath>../pom/pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Felix Http Wrappers</name>
+ <artifactId>org.apache.felix.http.wrappers</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <scm>
+ <connection>scm:git:https://github.com/apache/felix-dev.git</connection>
+ <developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
+ <url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
+ </scm>
+
+ <properties>
+ <felix.java.version>11</felix.java.version>
+ <baseline.skip>true</baseline.skip>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>5.1.9</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jetbrains</groupId>
+ <artifactId>annotations</artifactId>
+ <version>16.0.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.annotation</artifactId>
+ <version>6.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>4.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>jakarta.servlet-api</artifactId>
+ <version>5.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.13.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>5.5.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/AsyncContextWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/AsyncContextWrapper.java
new file mode 100644
index 0000000000..ea9b8ec7ff
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/AsyncContextWrapper.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.AsyncListener;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+
+/**
+ * async context wrapper
+ */
+public class AsyncContextWrapper implements AsyncContext {
+
+ private final javax.servlet.AsyncContext context;
+
+ /**
+ * Create new context
+ * @param c Wrapped context
+ */
+ public AsyncContextWrapper(@NotNull final javax.servlet.AsyncContext c) {
+ this.context = c;
+ }
+
+ @Override
+ public ServletRequest getRequest() {
+ return ServletRequestWrapper.getWrapper(context.getRequest());
+ }
+
+ @Override
+ public ServletResponse getResponse() {
+ return ServletResponseWrapper.getWrapper(context.getResponse());
+ }
+
+ @Override
+ public boolean hasOriginalRequestAndResponse() {
+ return context.hasOriginalRequestAndResponse();
+ }
+
+ @Override
+ public void dispatch() {
+ context.dispatch();
+ }
+
+ @Override
+ public void dispatch(final String path) {
+ context.dispatch(path);
+ }
+
+ @Override
+ public void dispatch(final ServletContext sc, final String path) {
+ context.dispatch(new org.apache.felix.http.javaxwrappers.ServletContextWrapper(sc), path);
+ }
+
+ @Override
+ public void complete() {
+ context.complete();
+ }
+
+ @Override
+ public void start(final Runnable run) {
+ context.start(run);
+ }
+
+ @Override
+ public void addListener(final AsyncListener listener) {
+ context.addListener(new org.apache.felix.http.javaxwrappers.AsyncListenerWrapper(listener));
+ }
+
+ @Override
+ public void addListener(final AsyncListener listener, final ServletRequest servletRequest, final ServletResponse servletResponse) {
+ context.addListener(new org.apache.felix.http.javaxwrappers.AsyncListenerWrapper(listener),
+ org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(servletRequest),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(servletResponse));
+ }
+
+ @Override
+ public <T extends AsyncListener> T createListener(final Class<T> clazz) throws ServletException {
+ throw new ServletException();
+ }
+
+ @Override
+ public void setTimeout(final long timeout) {
+ context.setTimeout(timeout);
+ }
+
+ @Override
+ public long getTimeout() {
+ return context.getTimeout();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/AsyncListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/AsyncListenerWrapper.java
new file mode 100644
index 0000000000..f617f7b4dd
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/AsyncListenerWrapper.java
@@ -0,0 +1,77 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.AsyncEvent;
+import jakarta.servlet.AsyncListener;
+
+/**
+ * Async listener wrapper
+ */
+public class AsyncListenerWrapper implements AsyncListener {
+
+ private final javax.servlet.AsyncListener listener;
+
+ /**
+ * Create new listener
+ * @param c Wrapped listener
+ */
+ public AsyncListenerWrapper(@NotNull final javax.servlet.AsyncListener c) {
+ this.listener = c;
+ }
+
+ @Override
+ public void onComplete(final AsyncEvent event) throws IOException {
+ this.listener.onComplete(new javax.servlet.AsyncEvent(
+ new org.apache.felix.http.javaxwrappers.AsyncContextWrapper(event.getAsyncContext()),
+ org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+
+ @Override
+ public void onTimeout(final AsyncEvent event) throws IOException {
+ this.listener.onTimeout(new javax.servlet.AsyncEvent(
+ new org.apache.felix.http.javaxwrappers.AsyncContextWrapper(event.getAsyncContext()),
+ org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+
+ @Override
+ public void onError(final AsyncEvent event) throws IOException {
+ this.listener.onError(new javax.servlet.AsyncEvent(
+ new org.apache.felix.http.javaxwrappers.AsyncContextWrapper(event.getAsyncContext()),
+ org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+
+ @Override
+ public void onStartAsync(final AsyncEvent event) throws IOException {
+ this.listener.onStartAsync(new javax.servlet.AsyncEvent(
+ new org.apache.felix.http.javaxwrappers.AsyncContextWrapper(event.getAsyncContext()),
+ org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/CookieWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/CookieWrapper.java
new file mode 100644
index 0000000000..9c85fdeb51
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/CookieWrapper.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.Cookie;
+
+/**
+ * Cookie
+ */
+public class CookieWrapper extends Cookie {
+
+ private static final long serialVersionUID = 5230437594501050941L;
+
+ /**
+ * Wrap an array of cookies
+ * @param array The array
+ * @return The result
+ */
+ public static Cookie[] wrap(final javax.servlet.http.Cookie[] array) {
+ if ( array == null ) {
+ return null;
+ }
+ final Cookie[] result = new Cookie[array.length];
+ for(int i=0;i<array.length;i++) {
+ result[i] = new CookieWrapper(array[i]);
+ }
+ return result;
+ }
+
+ private final javax.servlet.http.Cookie cookie;
+
+ /**
+ * Create new cookie
+ * @param c Wrapped cookie
+ */
+ public CookieWrapper(@NotNull final javax.servlet.http.Cookie c) {
+ super(c.getName(), c.getValue());
+ this.cookie = c;
+ super.setComment(c.getComment());
+ if ( c.getDomain() != null ) {
+ super.setDomain(c.getDomain());
+ }
+ super.setHttpOnly(c.isHttpOnly());
+ super.setMaxAge(c.getMaxAge());
+ super.setPath(c.getPath());
+ super.setSecure(c.getSecure());
+ super.setVersion(c.getVersion());
+ }
+
+ @Override
+ public void setComment(final String purpose) {
+ this.cookie.setComment(purpose);
+ super.setComment(purpose);
+ }
+
+ @Override
+ public void setDomain(final String domain) {
+ this.cookie.setDomain(domain);
+ super.setDomain(domain);
+ }
+
+ @Override
+ public void setMaxAge(final int expiry) {
+ this.cookie.setMaxAge(expiry);
+ super.setMaxAge(expiry);
+ }
+
+ @Override
+ public void setPath(final String uri) {
+ this.cookie.setPath(uri);
+ super.setPath(uri);
+ }
+
+ @Override
+ public void setSecure(final boolean flag) {
+ this.cookie.setSecure(flag);
+ super.setSecure(flag);
+ }
+
+ @Override
+ public void setValue(final String newValue) {
+ this.cookie.setValue(newValue);
+ super.setValue(newValue);
+ }
+
+ @Override
+ public void setVersion(final int v) {
+ this.cookie.setVersion(v);
+ super.setVersion(v);
+ }
+
+ @Override
+ public void setHttpOnly(final boolean isHttpOnly) {
+ this.cookie.setHttpOnly(isHttpOnly);
+ super.setHttpOnly(isHttpOnly);
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/EventListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/EventListenerWrapper.java
new file mode 100644
index 0000000000..b33539c398
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/EventListenerWrapper.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.EventListener;
+import java.util.Set;
+
+import org.apache.felix.http.javaxwrappers.HttpSessionWrapper;
+import org.apache.felix.http.javaxwrappers.ServletContextWrapper;
+import org.apache.felix.http.javaxwrappers.ServletRequestWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletContextAttributeEvent;
+import jakarta.servlet.ServletContextAttributeListener;
+import jakarta.servlet.ServletContextEvent;
+import jakarta.servlet.ServletContextListener;
+import jakarta.servlet.ServletRequestAttributeEvent;
+import jakarta.servlet.ServletRequestAttributeListener;
+import jakarta.servlet.ServletRequestEvent;
+import jakarta.servlet.ServletRequestListener;
+import jakarta.servlet.http.HttpSessionAttributeListener;
+import jakarta.servlet.http.HttpSessionBindingEvent;
+import jakarta.servlet.http.HttpSessionEvent;
+import jakarta.servlet.http.HttpSessionIdListener;
+import jakarta.servlet.http.HttpSessionListener;
+
+/**
+ * Wrapper for all listeners
+ */
+public class EventListenerWrapper implements HttpSessionAttributeListener,
+ HttpSessionIdListener,
+ HttpSessionListener,
+ ServletContextListener,
+ ServletContextAttributeListener,
+ ServletRequestListener,
+ ServletRequestAttributeListener {
+
+ private final javax.servlet.http.HttpSessionAttributeListener httpSessionAttributeListener;
+ private final javax.servlet.http.HttpSessionIdListener httpSessionIdListener;
+ private final javax.servlet.http.HttpSessionListener httpSessionListener;
+ private final javax.servlet.ServletContextListener servletContextListener;
+ private final javax.servlet.ServletContextAttributeListener servletContextAttributeListener;
+ private final javax.servlet.ServletRequestListener servletRequestListener;
+ private final javax.servlet.ServletRequestAttributeListener servletRequestAttributeListener;
+ private final EventListener listener;
+
+ /**
+ * Create new wrapper
+ * @param listener Wrapped listener
+ * @param listenerTypes Service interfaces
+ */
+ public EventListenerWrapper(@NotNull final EventListener listener,
+ @NotNull final Set<String> listenerTypes) {
+ this.listener = listener;
+ if ( listenerTypes.contains(HttpSessionAttributeListener.class.getName()) ) {
+ this.httpSessionAttributeListener = (javax.servlet.http.HttpSessionAttributeListener) listener;
+ } else {
+ this.httpSessionAttributeListener = null;
+ }
+ if ( listenerTypes.contains(HttpSessionIdListener.class.getName()) ) {
+ this.httpSessionIdListener = (javax.servlet.http.HttpSessionIdListener) listener;
+ } else {
+ this.httpSessionIdListener = null;
+ }
+ if ( listenerTypes.contains(HttpSessionListener.class.getName()) ) {
+ this.httpSessionListener = (javax.servlet.http.HttpSessionListener) listener;
+ } else {
+ this.httpSessionListener = null;
+ }
+ if ( listenerTypes.contains(ServletContextListener.class.getName()) ) {
+ this.servletContextListener = (javax.servlet.ServletContextListener) listener;
+ } else {
+ this.servletContextListener = null;
+ }
+ if ( listenerTypes.contains(ServletContextAttributeListener.class.getName()) ) {
+ this.servletContextAttributeListener = (javax.servlet.ServletContextAttributeListener) listener;
+ } else {
+ this.servletContextAttributeListener = null;
+ }
+ if ( listenerTypes.contains(ServletRequestListener.class.getName()) ) {
+ this.servletRequestListener = (javax.servlet.ServletRequestListener) listener;
+ } else {
+ this.servletRequestListener = null;
+ }
+ if ( listenerTypes.contains(ServletRequestAttributeListener.class.getName()) ) {
+ this.servletRequestAttributeListener = (javax.servlet.ServletRequestAttributeListener) listener;
+ } else {
+ this.servletRequestAttributeListener = null;
+ }
+ }
+
+ @Override
+ public void attributeAdded(final ServletRequestAttributeEvent srae) {
+ if ( this.servletRequestAttributeListener != null ) {
+ this.servletRequestAttributeListener.attributeAdded(new javax.servlet.ServletRequestAttributeEvent(new ServletContextWrapper(srae.getServletContext()),
+ ServletRequestWrapper.getWrapper(srae.getServletRequest()), srae.getName(), srae.getValue()));
+ }
+ }
+ @Override
+ public void attributeRemoved(final ServletRequestAttributeEvent srae) {
+ if ( this.servletRequestAttributeListener != null ) {
+ this.servletRequestAttributeListener.attributeRemoved(new javax.servlet.ServletRequestAttributeEvent(new ServletContextWrapper(srae.getServletContext()),
+ ServletRequestWrapper.getWrapper(srae.getServletRequest()), srae.getName(), srae.getValue()));
+ }
+ }
+
+ @Override
+ public void attributeReplaced(final ServletRequestAttributeEvent srae) {
+ if ( this.servletRequestAttributeListener != null ) {
+ this.servletRequestAttributeListener.attributeReplaced(new javax.servlet.ServletRequestAttributeEvent(new ServletContextWrapper(srae.getServletContext()),
+ ServletRequestWrapper.getWrapper(srae.getServletRequest()), srae.getName(), srae.getValue()));
+ }
+ }
+
+ @Override
+ public void requestDestroyed(final ServletRequestEvent sre) {
+ if ( this.servletRequestListener != null ) {
+ this.servletRequestListener.requestDestroyed(new javax.servlet.ServletRequestEvent(new ServletContextWrapper(sre.getServletContext()),
+ ServletRequestWrapper.getWrapper(sre.getServletRequest())));
+ }
+ }
+
+ @Override
+ public void requestInitialized(final ServletRequestEvent sre) {
+ if ( this.servletRequestListener != null ) {
+ this.servletRequestListener.requestInitialized(new javax.servlet.ServletRequestEvent(new ServletContextWrapper(sre.getServletContext()),
+ ServletRequestWrapper.getWrapper(sre.getServletRequest())));
+ }
+ }
+
+ @Override
+ public void attributeAdded(final ServletContextAttributeEvent event) {
+ if ( this.servletContextAttributeListener != null ) {
+ this.servletContextAttributeListener.attributeAdded(new javax.servlet.ServletContextAttributeEvent(new ServletContextWrapper(event.getServletContext()), event.getName(), event.getValue()));
+ }
+ }
+
+ @Override
+ public void attributeRemoved(final ServletContextAttributeEvent event) {
+ if ( this.servletContextAttributeListener != null ) {
+ this.servletContextAttributeListener.attributeRemoved(new javax.servlet.ServletContextAttributeEvent(new ServletContextWrapper(event.getServletContext()), event.getName(), event.getValue()));
+ }
+ }
+
+ @Override
+ public void attributeReplaced(final ServletContextAttributeEvent event) {
+ if ( this.servletContextAttributeListener != null ) {
+ this.servletContextAttributeListener.attributeReplaced(new javax.servlet.ServletContextAttributeEvent(new ServletContextWrapper(event.getServletContext()), event.getName(), event.getValue()));
+ }
+ }
+
+ @Override
+ public void contextInitialized(final ServletContextEvent sce) {
+ if ( this.servletContextListener != null ) {
+ this.servletContextListener.contextInitialized(new javax.servlet.ServletContextEvent(new ServletContextWrapper(sce.getServletContext())));
+ }
+ }
+
+ @Override
+ public void contextDestroyed(final ServletContextEvent sce) {
+ if ( this.servletContextListener != null ) {
+ this.servletContextListener.contextDestroyed(new javax.servlet.ServletContextEvent(new ServletContextWrapper(sce.getServletContext())));
+ }
+ }
+
+ @Override
+ public void sessionCreated(final HttpSessionEvent se) {
+ if ( this.httpSessionListener != null ) {
+ this.httpSessionListener.sessionCreated(new javax.servlet.http.HttpSessionEvent(new HttpSessionWrapper(se.getSession())));
+ }
+ }
+
+ @Override
+ public void sessionDestroyed(final HttpSessionEvent se) {
+ if ( this.httpSessionListener != null ) {
+ this.httpSessionListener.sessionDestroyed(new javax.servlet.http.HttpSessionEvent(new HttpSessionWrapper(se.getSession())));
+ }
+ }
+
+ @Override
+ public void sessionIdChanged(final HttpSessionEvent event, final String oldSessionId) {
+ if ( this.httpSessionIdListener != null ) {
+ this.httpSessionIdListener.sessionIdChanged(new javax.servlet.http.HttpSessionEvent(new HttpSessionWrapper(event.getSession())), oldSessionId);
+ }
+ }
+
+ @Override
+ public void attributeAdded(final HttpSessionBindingEvent event) {
+ if ( this.httpSessionAttributeListener != null ) {
+ this.httpSessionAttributeListener.attributeAdded(new javax.servlet.http.HttpSessionBindingEvent(new HttpSessionWrapper(event.getSession()), event.getName(), event.getValue()));
+ }
+ }
+
+ @Override
+ public void attributeRemoved(final HttpSessionBindingEvent event) {
+ if ( this.httpSessionAttributeListener != null ) {
+ this.httpSessionAttributeListener.attributeRemoved(new javax.servlet.http.HttpSessionBindingEvent(new HttpSessionWrapper(event.getSession()), event.getName(), event.getValue()));
+ }
+ }
+
+ @Override
+ public void attributeReplaced(final HttpSessionBindingEvent event) {
+ if ( this.httpSessionAttributeListener != null ) {
+ this.httpSessionAttributeListener.attributeReplaced(new javax.servlet.http.HttpSessionBindingEvent(new HttpSessionWrapper(event.getSession()), event.getName(), event.getValue()));
+ }
+ }
+
+ /**
+ * Get the listener
+ * @return The listener
+ */
+ public @NotNull EventListener getListener() {
+ return this.listener;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/FilterRegistrationWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/FilterRegistrationWrapper.java
new file mode 100644
index 0000000000..2acf15d890
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/FilterRegistrationWrapper.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.FilterRegistration;
+
+/**
+ * Filter registration wrapper
+ */
+public class FilterRegistrationWrapper implements FilterRegistration {
+
+ private final javax.servlet.FilterRegistration reg;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped registration
+ */
+ public FilterRegistrationWrapper(@NotNull final javax.servlet.FilterRegistration c) {
+ this.reg = c;
+ }
+
+ private EnumSet<javax.servlet.DispatcherType> wrap(final EnumSet<DispatcherType> dispatcherTypes) {
+ final EnumSet<javax.servlet.DispatcherType> set = EnumSet.noneOf(javax.servlet.DispatcherType.class);
+ if ( dispatcherTypes.contains(DispatcherType.ASYNC)) {
+ set.add(javax.servlet.DispatcherType.ASYNC);
+ }
+ if ( dispatcherTypes.contains(DispatcherType.ERROR)) {
+ set.add(javax.servlet.DispatcherType.ERROR);
+ }
+ if ( dispatcherTypes.contains(DispatcherType.FORWARD)) {
+ set.add(javax.servlet.DispatcherType.FORWARD);
+ }
+ if ( dispatcherTypes.contains(DispatcherType.INCLUDE)) {
+ set.add(javax.servlet.DispatcherType.INCLUDE);
+ }
+ if ( dispatcherTypes.contains(DispatcherType.REQUEST)) {
+ set.add(javax.servlet.DispatcherType.REQUEST);
+ }
+ return set;
+ }
+
+ @Override
+ public void addMappingForServletNames(final EnumSet<DispatcherType> dispatcherTypes, final boolean isMatchAfter,
+ final String... servletNames) {
+ reg.addMappingForServletNames(wrap(dispatcherTypes), isMatchAfter, servletNames);
+ }
+
+ @Override
+ public String getName() {
+ return reg.getName();
+ }
+
+ @Override
+ public String getClassName() {
+ return reg.getClassName();
+ }
+
+ @Override
+ public boolean setInitParameter(final String name, final String value) {
+ return reg.setInitParameter(name, value);
+ }
+
+ @Override
+ public Collection<String> getServletNameMappings() {
+ return reg.getServletNameMappings();
+ }
+
+ @Override
+ public void addMappingForUrlPatterns(final EnumSet<DispatcherType> dispatcherTypes, final boolean isMatchAfter,
+ final String... urlPatterns) {
+ reg.addMappingForUrlPatterns(wrap(dispatcherTypes), isMatchAfter, urlPatterns);
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return reg.getInitParameter(name);
+ }
+
+ @Override
+ public Set<String> setInitParameters(final Map<String, String> initParameters) {
+ return reg.setInitParameters(initParameters);
+ }
+
+ @Override
+ public Collection<String> getUrlPatternMappings() {
+ return reg.getUrlPatternMappings();
+ }
+
+ @Override
+ public Map<String, String> getInitParameters() {
+ return reg.getInitParameters();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/FilterWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/FilterWrapper.java
new file mode 100644
index 0000000000..58bfa22632
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/FilterWrapper.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.FilterConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+
+/**
+ * Jakarta Filter based on a javax filter
+ */
+public class FilterWrapper implements Filter {
+
+ private final javax.servlet.Filter filter;
+
+ /**
+ * Create new filter
+ * @param filter wrapped filter
+ */
+ public FilterWrapper(@NotNull final javax.servlet.Filter filter) {
+ this.filter = filter;
+ }
+
+ @Override
+ public void init(final FilterConfig filterConfig) throws ServletException {
+ try {
+ this.filter.init(new org.apache.felix.http.javaxwrappers.FilterConfigWrapper(filterConfig));
+ } catch (final javax.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws IOException, ServletException {
+ try {
+ this.filter.doFilter(org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(request),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(response),
+ new org.apache.felix.http.javaxwrappers.FilterChainWrapper(chain));
+ } catch (final javax.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ this.filter.destroy();
+ }
+
+ /**
+ * Get the filter
+ * @return The filter
+ */
+ public @NotNull javax.servlet.Filter getFilter() {
+ return this.filter;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletMappingWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletMappingWrapper.java
new file mode 100644
index 0000000000..bffff0991c
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletMappingWrapper.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpServletMapping;
+import jakarta.servlet.http.MappingMatch;
+
+/**
+ * Http Mapping wrapper
+ */
+public class HttpServletMappingWrapper implements HttpServletMapping {
+
+ private final javax.servlet.http.HttpServletMapping mapping;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped mapper
+ */
+ public HttpServletMappingWrapper(@NotNull final javax.servlet.http.HttpServletMapping c) {
+ this.mapping = c;
+ }
+
+ @Override
+ public String getMatchValue() {
+ return mapping.getMatchValue();
+ }
+
+ @Override
+ public String getPattern() {
+ return mapping.getPattern();
+ }
+
+ @Override
+ public String getServletName() {
+ return mapping.getServletName();
+ }
+
+ @Override
+ public MappingMatch getMappingMatch() {
+ switch (mapping.getMappingMatch()) {
+ case CONTEXT_ROOT : return MappingMatch.CONTEXT_ROOT;
+ case DEFAULT : return MappingMatch.DEFAULT;
+ case EXACT : return MappingMatch.EXACT;
+ case EXTENSION : return MappingMatch.EXTENSION;
+ case PATH : return MappingMatch.PATH;
+ }
+ return null;
+ }
+
+ /**
+ * Get the wrapped mapping
+ * @return The mapping
+ */
+ public javax.servlet.http.HttpServletMapping getMapping() {
+ return this.mapping;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletRequestWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletRequestWrapper.java
new file mode 100644
index 0000000000..2967dd3c63
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletRequestWrapper.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletMapping;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpUpgradeHandler;
+import jakarta.servlet.http.Part;
+import jakarta.servlet.http.PushBuilder;
+
+/**
+ * Http servlet request wrapper
+ */
+public class HttpServletRequestWrapper extends ServletRequestWrapper
+ implements HttpServletRequest {
+
+ private final javax.servlet.http.HttpServletRequest request;
+
+ /**
+ * Create new wrapper
+ * @param r Wrapped request
+ */
+ public HttpServletRequestWrapper(@NotNull final javax.servlet.http.HttpServletRequest r) {
+ super(r);
+ this.request = r;
+ }
+
+ @Override
+ public String getAuthType() {
+ return this.request.getAuthType();
+ }
+
+ @Override
+ public Cookie[] getCookies() {
+ return CookieWrapper.wrap(this.request.getCookies());
+ }
+
+ @Override
+ public long getDateHeader(final String name) {
+ return this.request.getDateHeader(name);
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.request.getHeader(name);
+ }
+
+ @Override
+ public Enumeration<String> getHeaders(final String name) {
+ return this.request.getHeaders(name);
+ }
+
+ @Override
+ public Enumeration<String> getHeaderNames() {
+ return this.request.getHeaderNames();
+ }
+
+ @Override
+ public int getIntHeader(final String name) {
+ return this.request.getIntHeader(name);
+ }
+
+ @Override
+ public String getMethod() {
+ return this.request.getMethod();
+ }
+
+ @Override
+ public String getPathInfo() {
+ return this.request.getPathInfo();
+ }
+
+ @Override
+ public String getPathTranslated() {
+ return this.request.getPathTranslated();
+ }
+
+ @Override
+ public String getContextPath() {
+ return this.request.getContextPath();
+ }
+
+ @Override
+ public String getQueryString() {
+ return this.request.getQueryString();
+ }
+
+ @Override
+ public String getRemoteUser() {
+ return this.request.getRemoteUser();
+ }
+
+ @Override
+ public boolean isUserInRole(final String role) {
+ return this.request.isUserInRole(role);
+ }
+
+ @Override
+ public Principal getUserPrincipal() {
+ return this.request.getUserPrincipal();
+ }
+
+ @Override
+ public String getRequestedSessionId() {
+ return this.request.getRequestedSessionId();
+ }
+
+ @Override
+ public String getRequestURI() {
+ return this.request.getRequestURI();
+ }
+
+ @Override
+ public StringBuffer getRequestURL() {
+ return this.request.getRequestURL();
+ }
+
+ @Override
+ public String getServletPath() {
+ return this.request.getServletPath();
+ }
+
+ @Override
+ public HttpSession getSession(final boolean create) {
+ final javax.servlet.http.HttpSession session = this.request.getSession(create);
+ if ( session != null ) {
+ return new HttpSessionWrapper(session);
+ }
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession() {
+ return new HttpSessionWrapper(this.request.getSession());
+ }
+
+ @Override
+ public String changeSessionId() {
+ return this.request.changeSessionId();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid() {
+ return this.request.isRequestedSessionIdValid();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie() {
+ return this.request.isRequestedSessionIdFromCookie();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL() {
+ return this.request.isRequestedSessionIdFromURL();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean isRequestedSessionIdFromUrl() {
+ return this.request.isRequestedSessionIdFromUrl();
+ }
+
+ @Override
+ public boolean authenticate(final HttpServletResponse response) throws IOException, ServletException {
+ try {
+ return this.request.authenticate((javax.servlet.http.HttpServletResponse)org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(response));
+ } catch ( final javax.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void login(final String username, final String password) throws ServletException {
+ try {
+ this.request.login(username, password);
+ } catch ( final javax.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void logout() throws ServletException {
+ try {
+ this.request.logout();
+ } catch ( final javax.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public Collection<Part> getParts() throws IOException, ServletException {
+ try {
+ final List<Part> result = new ArrayList<>();
+ for(final javax.servlet.http.Part p : this.request.getParts()) {
+ result.add(new PartWrapper(p));
+ }
+ return result;
+ } catch ( final javax.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public Part getPart(final String name) throws IOException, ServletException {
+ try {
+ return new PartWrapper(this.request.getPart(name));
+ } catch ( final javax.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public <T extends HttpUpgradeHandler> T upgrade(final Class<T> handlerClass) throws IOException, ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public HttpServletMapping getHttpServletMapping() {
+ return new HttpServletMappingWrapper(this.request.getHttpServletMapping());
+ }
+
+ @Override
+ public PushBuilder newPushBuilder() {
+ final javax.servlet.http.PushBuilder builder = this.request.newPushBuilder();
+ if ( builder != null ) {
+ return new PushBuilderWrapper(builder);
+ }
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getTrailerFields() {
+ return this.request.getTrailerFields();
+ }
+
+ @Override
+ public boolean isTrailerFieldsReady() {
+ return this.request.isTrailerFieldsReady();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletResponseWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletResponseWrapper.java
new file mode 100644
index 0000000000..cf8ac0b4b5
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpServletResponseWrapper.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * Http servlet response wrapper
+*/
+public class HttpServletResponseWrapper extends ServletResponseWrapper
+ implements HttpServletResponse {
+
+ private final javax.servlet.http.HttpServletResponse response;
+
+ /**
+ * Create a new response
+ * @param r Wrapped response
+ */
+ public HttpServletResponseWrapper(@NotNull final javax.servlet.http.HttpServletResponse r) {
+ super(r);
+ this.response = r;
+ }
+
+ @Override
+ public void addCookie(final Cookie cookie) {
+ this.response.addCookie(new org.apache.felix.http.javaxwrappers.CookieWrapper(cookie));
+ }
+
+ @Override
+ public boolean containsHeader(final String name) {
+ return this.response.containsHeader(name);
+ }
+
+ @Override
+ public String encodeURL(final String url) {
+ return this.response.encodeURL(url);
+ }
+
+ @Override
+ public String encodeRedirectURL(final String url) {
+ return this.response.encodeRedirectURL(url);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String encodeUrl(final String url) {
+ return this.response.encodeUrl(url);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String encodeRedirectUrl(final String url) {
+ return this.response.encodeRedirectUrl(url);
+ }
+
+ @Override
+ public void sendError(final int sc, final String msg) throws IOException {
+ this.response.sendError(sc, msg);
+ }
+
+ @Override
+ public void sendError(final int sc) throws IOException {
+ this.response.sendError(sc);
+ }
+
+ @Override
+ public void sendRedirect(final String location) throws IOException {
+ this.response.sendRedirect(location);
+ }
+
+ @Override
+ public void setDateHeader(final String name, final long date) {
+ this.response.setDateHeader(name, date);
+ }
+
+ @Override
+ public void addDateHeader(final String name, final long date) {
+ this.response.addDateHeader(name, date);
+ }
+
+ @Override
+ public void setHeader(final String name, final String value) {
+ this.response.setHeader(name, value);
+ }
+
+ @Override
+ public void addHeader(final String name, final String value) {
+ this.response.addHeader(name, value);
+ }
+
+ @Override
+ public void setIntHeader(final String name, final int value) {
+ this.response.setIntHeader(name, value);
+ }
+
+ @Override
+ public void addIntHeader(final String name, final int value) {
+ this.response.addIntHeader(name, value);
+ }
+
+ @Override
+ public void setStatus(int sc) {
+ this.response.setStatus(sc);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setStatus(final int sc, final String sm) {
+ this.response.setStatus(sc, sm);
+ }
+
+ @Override
+ public int getStatus() {
+ return this.response.getStatus();
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.response.getHeader(name);
+ }
+
+ @Override
+ public Collection<String> getHeaders(final String name) {
+ return this.response.getHeaders(name);
+ }
+
+ @Override
+ public Collection<String> getHeaderNames() {
+ return this.response.getHeaderNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpSessionContextWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpSessionContextWrapper.java
new file mode 100644
index 0000000000..d5f01ad59c
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpSessionContextWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpSessionContext;
+
+/**
+ * http session context wrapper
+ */
+@SuppressWarnings("deprecation")
+public class HttpSessionContextWrapper implements HttpSessionContext {
+
+ private final javax.servlet.http.HttpSessionContext context;
+
+ /**
+ * Create new context
+ * @param c Wrapped context
+ */
+ public HttpSessionContextWrapper(@NotNull final javax.servlet.http.HttpSessionContext c) {
+ this.context = c;
+ }
+
+ @Override
+ public HttpSession getSession(final String sessionId) {
+ final javax.servlet.http.HttpSession session = context.getSession(sessionId);
+ if ( session != null ) {
+ return new HttpSessionWrapper(session);
+ }
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getIds() {
+ return context.getIds();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpSessionWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpSessionWrapper.java
new file mode 100644
index 0000000000..4696be66c8
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/HttpSessionWrapper.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpSessionContext;
+
+/**
+ * Http session wrapper
+ */
+public class HttpSessionWrapper implements HttpSession {
+
+ private final javax.servlet.http.HttpSession session;
+
+ /**
+ * Create new session
+ * @param session Wrapped session
+ */
+ public HttpSessionWrapper(@NotNull final javax.servlet.http.HttpSession session) {
+ this.session = session;
+ }
+
+
+ @Override
+ public long getCreationTime() {
+ return session.getCreationTime();
+ }
+
+ @Override
+ public String getId() {
+ return session.getId();
+ }
+
+ @Override
+ public long getLastAccessedTime() {
+ return session.getLastAccessedTime();
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return new ServletContextWrapper(session.getServletContext());
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int interval) {
+ session.setMaxInactiveInterval(interval);
+ }
+
+ @Override
+ public int getMaxInactiveInterval() {
+ return session.getMaxInactiveInterval();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public HttpSessionContext getSessionContext() {
+ return new HttpSessionContextWrapper(session.getSessionContext());
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ return session.getAttribute(name);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Object getValue(String name) {
+ return session.getValue(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return session.getAttributeNames();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String[] getValueNames() {
+ return session.getValueNames();
+ }
+
+ @Override
+ public void setAttribute(String name, Object value) {
+ session.setAttribute(name, value);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void putValue(String name, Object value) {
+ session.putValue(name, value);
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ session.removeAttribute(name);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void removeValue(String name) {
+ session.removeValue(name);
+ }
+
+ @Override
+ public void invalidate() {
+ session.invalidate();
+ }
+
+ @Override
+ public boolean isNew() {
+ return session.isNew();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/PartWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/PartWrapper.java
new file mode 100644
index 0000000000..1796495ac4
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/PartWrapper.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.Part;
+
+/**
+ * Part wrapper
+ */
+public class PartWrapper implements Part {
+
+ private final javax.servlet.http.Part part;
+
+ /**
+ * Create new part
+ * @param p Wrapped part
+ */
+ public PartWrapper(@NotNull final javax.servlet.http.Part p) {
+ this.part = p;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return this.part.getInputStream();
+ }
+
+ @Override
+ public String getContentType() {
+ return this.part.getContentType();
+ }
+
+ @Override
+ public String getName() {
+ return this.part.getName();
+ }
+
+ @Override
+ public String getSubmittedFileName() {
+ return this.part.getSubmittedFileName();
+ }
+
+ @Override
+ public long getSize() {
+ return this.part.getSize();
+ }
+
+ @Override
+ public void write(String fileName) throws IOException {
+ this.part.write(fileName);
+ }
+
+ @Override
+ public void delete() throws IOException {
+ this.part.delete();
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.part.getHeader(name);
+ }
+
+ @Override
+ public Collection<String> getHeaders(final String name) {
+ return this.part.getHeaders(name);
+ }
+
+ @Override
+ public Collection<String> getHeaderNames() {
+ return this.part.getHeaderNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/PushBuilderWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/PushBuilderWrapper.java
new file mode 100644
index 0000000000..7ce9f5266d
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/PushBuilderWrapper.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.PushBuilder;
+
+/**
+ * Push builder wrapper
+ */
+public class PushBuilderWrapper implements PushBuilder {
+
+ private final javax.servlet.http.PushBuilder builder;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped builder
+ */
+ public PushBuilderWrapper(@NotNull final javax.servlet.http.PushBuilder c) {
+ this.builder = c;
+ }
+
+ @Override
+ public PushBuilder method(final String method) {
+ this.builder.method(method);
+ return this;
+ }
+
+ @Override
+ public PushBuilder queryString(final String queryString) {
+ this.builder.queryString(queryString);
+ return this;
+ }
+
+ @Override
+ public PushBuilder sessionId(final String sessionId) {
+ this.builder.sessionId(sessionId);
+ return this;
+ }
+
+ @Override
+ public PushBuilder setHeader(final String name, final String value) {
+ this.builder.setHeader(name, value);
+ return this;
+ }
+
+ @Override
+ public PushBuilder addHeader(final String name, final String value) {
+ this.builder.addHeader(name, value);
+ return this;
+ }
+
+ @Override
+ public PushBuilder removeHeader(final String name) {
+ this.builder.removeHeader(name);
+ return this;
+ }
+
+ @Override
+ public PushBuilder path(final String path) {
+ this.builder.path(path);
+ return this;
+ }
+
+ @Override
+ public void push() {
+ this.builder.push();
+ }
+
+ @Override
+ public String getMethod() {
+ return this.builder.getMethod();
+ }
+
+ @Override
+ public String getQueryString() {
+ return this.builder.getQueryString();
+ }
+
+ @Override
+ public String getSessionId() {
+ return this.builder.getSessionId();
+ }
+
+ @Override
+ public Set<String> getHeaderNames() {
+ return this.builder.getHeaderNames();
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.builder.getHeader(name);
+ }
+
+ @Override
+ public String getPath() {
+ return this.builder.getPath();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ReadListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ReadListenerWrapper.java
new file mode 100644
index 0000000000..3bbc847c82
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ReadListenerWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ReadListener;
+
+/**
+ * Read listener
+ */
+public class ReadListenerWrapper implements ReadListener {
+
+ private final javax.servlet.ReadListener listener;
+
+ /**
+ * Create new lister
+ * @param listener Wrapped listener
+ */
+ public ReadListenerWrapper(@NotNull final javax.servlet.ReadListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void onDataAvailable() throws IOException {
+ listener.onDataAvailable();
+ }
+
+ @Override
+ public void onAllDataRead() throws IOException {
+ listener.onAllDataRead();
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ listener.onError(t);
+ }
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/RequestDispatcherWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/RequestDispatcherWrapper.java
new file mode 100644
index 0000000000..4e8c3eaf48
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/RequestDispatcherWrapper.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+
+/**
+ * Dispatcher wrapper
+ */
+public class RequestDispatcherWrapper implements RequestDispatcher {
+
+ private final javax.servlet.RequestDispatcher dispatcher;
+
+ /**
+ * Create new dispatcher
+ * @param dispatcher Dispatcher
+ */
+ public RequestDispatcherWrapper(@NotNull javax.servlet.RequestDispatcher dispatcher) {
+ this.dispatcher = dispatcher;
+ }
+
+ @Override
+ public void forward(final ServletRequest request, final ServletResponse response) throws ServletException, IOException {
+ try {
+ dispatcher.forward(org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(request),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(response));
+ } catch (final javax.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void include(final ServletRequest request, final ServletResponse response) throws ServletException, IOException {
+ try {
+ dispatcher.include(org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(request),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(response));
+ } catch (final javax.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletConfigWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletConfigWrapper.java
new file mode 100644
index 0000000000..9d2235e8d0
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletConfigWrapper.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletContext;
+
+/**
+ * Servlet config wrapper
+ */
+public class ServletConfigWrapper implements ServletConfig {
+
+ private final javax.servlet.ServletConfig config;
+
+ /**
+ * Create new servlet config
+ * @param config wrapped servlet config
+ */
+ public ServletConfigWrapper(@NotNull final javax.servlet.ServletConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public String getServletName() {
+ return config.getServletName();
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return new ServletContextWrapper(config.getServletContext());
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return config.getInitParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getInitParameterNames() {
+ return config.getInitParameterNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletContextWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletContextWrapper.java
new file mode 100644
index 0000000000..4c4c2b95ce
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletContextWrapper.java
@@ -0,0 +1,417 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterRegistration;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRegistration;
+import jakarta.servlet.ServletRegistration.Dynamic;
+import jakarta.servlet.SessionCookieConfig;
+import jakarta.servlet.SessionTrackingMode;
+import jakarta.servlet.descriptor.JspConfigDescriptor;
+
+/**
+ * Servlet context wrapper
+ */
+public class ServletContextWrapper implements ServletContext {
+
+ private final javax.servlet.ServletContext context;
+
+ /**
+ * Create new context
+ * @param c Wrapped context
+ */
+ public ServletContextWrapper(@NotNull final javax.servlet.ServletContext c) {
+ this.context = c;
+ }
+
+ @Override
+ public String getContextPath() {
+ return this.context.getContextPath();
+ }
+
+ @Override
+ public ServletContext getContext(final String uripath) {
+ final javax.servlet.ServletContext c = this.context.getContext(uripath);
+ if ( c != null ) {
+ return new ServletContextWrapper(c);
+ }
+ return null;
+ }
+
+ @Override
+ public int getMajorVersion() {
+ return this.context.getMajorVersion();
+ }
+
+ @Override
+ public int getMinorVersion() {
+ return this.context.getMinorVersion();
+ }
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ return this.context.getEffectiveMajorVersion();
+ }
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ return this.context.getEffectiveMinorVersion();
+ }
+
+ @Override
+ public String getMimeType(final String file) {
+ return this.context.getMimeType(file);
+ }
+
+ @Override
+ public Set<String> getResourcePaths(final String path) {
+ return this.context.getResourcePaths(path);
+ }
+
+ @Override
+ public URL getResource(final String path) throws MalformedURLException {
+ return this.context.getResource(path);
+ }
+
+ @Override
+ public InputStream getResourceAsStream(final String path) {
+ return this.context.getResourceAsStream(path);
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(final String path) {
+ final javax.servlet.RequestDispatcher dispatcher = this.context.getRequestDispatcher(path);
+ if ( dispatcher != null ) {
+ return new RequestDispatcherWrapper(dispatcher);
+ }
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getNamedDispatcher(final String name) {
+ final javax.servlet.RequestDispatcher dispatcher = this.context.getNamedDispatcher(name);
+ if ( dispatcher != null ) {
+ return new RequestDispatcherWrapper(dispatcher);
+ }
+ return null;
+ }
+
+ @Override
+ public Servlet getServlet(final String name) throws ServletException {
+ return null;
+ }
+
+ @Override
+ public Enumeration<Servlet> getServlets() {
+ return Collections.emptyEnumeration();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Enumeration<String> getServletNames() {
+ return this.context.getServletNames();
+ }
+
+ @Override
+ public void log(final String msg) {
+ this.context.log(msg);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void log(final Exception exception, final String msg) {
+ this.context.log(exception, msg);
+ }
+
+ @Override
+ public void log(final String message, final Throwable throwable) {
+ this.context.log(message, throwable);
+ }
+
+ @Override
+ public String getRealPath(final String path) {
+ return this.context.getRealPath(path);
+ }
+
+ @Override
+ public String getServerInfo() {
+ return this.context.getServerInfo();
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return this.context.getInitParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getInitParameterNames() {
+ return this.context.getInitParameterNames();
+ }
+
+ @Override
+ public boolean setInitParameter(final String name, final String value) {
+ return this.context.setInitParameter(name, value);
+ }
+
+ @Override
+ public Object getAttribute(final String name) {
+ return this.context.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return this.context.getAttributeNames();
+ }
+
+ @Override
+ public void setAttribute(final String name, final Object object) {
+ this.context.setAttribute(name, object);
+ }
+
+ @Override
+ public void removeAttribute(final String name) {
+ this.context.removeAttribute(name);
+ }
+
+ @Override
+ public String getServletContextName() {
+ return this.context.getServletContextName();
+ }
+
+ @Override
+ public ServletRegistration.Dynamic addServlet(final String servletName, final String className) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ServletRegistration.Dynamic addServlet(final String servletName, final Servlet servlet) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ServletRegistration.Dynamic addServlet(final String servletName, final Class<? extends Servlet> servletClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends Servlet> T createServlet(final Class<T> clazz) throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ServletRegistration getServletRegistration(final String servletName) {
+ final javax.servlet.ServletRegistration reg = this.context.getServletRegistration(servletName);
+ if ( reg != null ) {
+ return new ServletRegistrationWrapper(reg);
+ }
+ return null;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ final Map result = new HashMap<>();
+ for(final Map.Entry<String, ? extends javax.servlet.ServletRegistration> e : this.context.getServletRegistrations().entrySet()) {
+ result.put(e.getKey(), new ServletRegistrationWrapper(e.getValue()));
+ }
+ return result;
+ }
+
+ @Override
+ public FilterRegistration.Dynamic addFilter(final String filterName, final String className) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public FilterRegistration.Dynamic addFilter(final String filterName, final Filter filter) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public FilterRegistration.Dynamic addFilter(final String filterName, final Class<? extends Filter> filterClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends Filter> T createFilter(final Class<T> clazz) throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public FilterRegistration getFilterRegistration(final String filterName) {
+ return new FilterRegistrationWrapper(this.context.getFilterRegistration(filterName));
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ final Map result = new HashMap<>();
+ for(final Map.Entry<String, ? extends javax.servlet.FilterRegistration> e : this.context.getFilterRegistrations().entrySet()) {
+ result.put(e.getKey(), new FilterRegistrationWrapper(e.getValue()));
+ }
+ return result;
+ }
+
+ @Override
+ public SessionCookieConfig getSessionCookieConfig() {
+ return new SessionCookieConfigWrapper(this.context.getSessionCookieConfig());
+ }
+
+ @Override
+ public void setSessionTrackingModes(final Set<SessionTrackingMode> sessionTrackingModes) {
+ if ( sessionTrackingModes == null ) {
+ this.context.setSessionTrackingModes(null);
+ } else {
+ final Set<javax.servlet.SessionTrackingMode> modes = new HashSet<>();
+ if ( sessionTrackingModes.contains(SessionTrackingMode.COOKIE)) {
+ modes.add(javax.servlet.SessionTrackingMode.COOKIE);
+ }
+ if ( sessionTrackingModes.contains(SessionTrackingMode.SSL)) {
+ modes.add(javax.servlet.SessionTrackingMode.SSL);
+ }
+ if ( sessionTrackingModes.contains(SessionTrackingMode.URL)) {
+ modes.add(javax.servlet.SessionTrackingMode.URL);
+ }
+ this.context.setSessionTrackingModes(modes);
+ }
+ }
+
+ @Override
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ final Set<javax.servlet.SessionTrackingMode> sessionTrackingModes = this.context.getDefaultSessionTrackingModes();
+ final Set<SessionTrackingMode> modes = new HashSet<>();
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.COOKIE)) {
+ modes.add(SessionTrackingMode.COOKIE);
+ }
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.SSL)) {
+ modes.add(SessionTrackingMode.SSL);
+ }
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.URL)) {
+ modes.add(SessionTrackingMode.URL);
+ }
+ return modes;
+ }
+
+ @Override
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ final Set<javax.servlet.SessionTrackingMode> sessionTrackingModes = this.context.getEffectiveSessionTrackingModes();
+ final Set<SessionTrackingMode> modes = new HashSet<>();
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.COOKIE)) {
+ modes.add(SessionTrackingMode.COOKIE);
+ }
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.SSL)) {
+ modes.add(SessionTrackingMode.SSL);
+ }
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.URL)) {
+ modes.add(SessionTrackingMode.URL);
+ }
+ return modes;
+ }
+
+ @Override
+ public void addListener(String className) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends EventListener> void addListener(final T t) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addListener(final Class<? extends EventListener> listenerClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends EventListener> T createListener(final Class<T> clazz) throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ return null;
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return this.context.getClassLoader();
+ }
+
+ @Override
+ public void declareRoles(final String... roleNames) {
+ this.context.declareRoles(roleNames);
+ }
+
+ @Override
+ public String getVirtualServerName() {
+ return this.context.getVirtualServerName();
+ }
+
+ @Override
+ public Dynamic addJspFile(final String servletName, final String jspFile) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getSessionTimeout() {
+ return this.context.getSessionTimeout();
+ }
+
+ @Override
+ public void setSessionTimeout(int sessionTimeout) {
+ this.context.setSessionTimeout(sessionTimeout);
+ }
+
+ @Override
+ public String getRequestCharacterEncoding() {
+ return this.context.getRequestCharacterEncoding();
+ }
+
+ @Override
+ public void setRequestCharacterEncoding(final String encoding) {
+ this.context.setRequestCharacterEncoding(encoding);
+ }
+
+ @Override
+ public String getResponseCharacterEncoding() {
+ return this.context.getResponseCharacterEncoding();
+ }
+
+ @Override
+ public void setResponseCharacterEncoding(final String encoding) {
+ this.context.setResponseCharacterEncoding(encoding);
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletExceptionUtil.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletExceptionUtil.java
new file mode 100644
index 0000000000..379da0b63d
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletExceptionUtil.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletException;
+
+/**
+ * Helper class to wrap servlet exceptions
+ */
+public class ServletExceptionUtil {
+
+ /**
+ * Throw jakarta servlet exception
+ * @param e javax exception
+ * @return The exception
+ */
+ public static ServletException getServletException(@NotNull final javax.servlet.ServletException e) {
+ if ( e instanceof org.apache.felix.http.javaxwrappers.ServletExceptionWrapper) {
+ return ((org.apache.felix.http.javaxwrappers.ServletExceptionWrapper)e).getException();
+ }
+ return new ServletExceptionWrapper(e);
+ }
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletExceptionWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletExceptionWrapper.java
new file mode 100644
index 0000000000..3f4bfba1c3
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletExceptionWrapper.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletException;
+
+/**
+ * Wrapper for servlet exception
+ */
+public class ServletExceptionWrapper extends ServletException {
+
+ private static final long serialVersionUID = 1L;
+
+ private final javax.servlet.ServletException exception;
+
+ /**
+ * Create new wrapepr exception
+ * @param e Original exception
+ */
+ public ServletExceptionWrapper(@NotNull final javax.servlet.ServletException e) {
+ this.exception = e;
+ }
+
+ /**
+ * Get the original exception
+ * @return The original exception
+ */
+ @NotNull public javax.servlet.ServletException getException() {
+ return this.exception;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletInputStreamWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletInputStreamWrapper.java
new file mode 100644
index 0000000000..d6eaf85b7f
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletInputStreamWrapper.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ReadListener;
+import jakarta.servlet.ServletInputStream;
+
+/**
+ * Servlet input stream wrapper
+ */
+public class ServletInputStreamWrapper extends ServletInputStream {
+
+ private final javax.servlet.ServletInputStream stream;
+
+ /**
+ * Create input stream
+ * @param stream Wrapped stream
+ */
+ public ServletInputStreamWrapper(@NotNull final javax.servlet.ServletInputStream stream) {
+ this.stream = stream;
+ }
+
+ @Override
+ public int readLine(final byte[] b, final int off, final int len) throws IOException {
+ return this.stream.readLine(b, off, len);
+ }
+
+ @Override
+ public boolean isFinished() {
+ return this.stream.isFinished();
+ }
+
+ @Override
+ public boolean isReady() {
+ return this.stream.isReady();
+ }
+
+ @Override
+ public void setReadListener(final ReadListener readListener) {
+ this.stream.setReadListener(new org.apache.felix.http.javaxwrappers.ReadListenerWrapper(readListener));
+ }
+
+ @Override
+ public int read() throws IOException {
+ return this.stream.read();
+ }
+
+ @Override
+ public int read(final byte[] b) throws IOException {
+ return this.stream.read(b);
+ }
+
+ @Override
+ public int read(final byte[] b, final int off, final int len) throws IOException {
+ return this.stream.read(b, off, len);
+ }
+
+ @Override
+ public byte[] readAllBytes() throws IOException {
+ return this.stream.readAllBytes();
+ }
+
+ @Override
+ public byte[] readNBytes(final int len) throws IOException {
+ return this.stream.readNBytes(len);
+ }
+
+ @Override
+ public int readNBytes(final byte[] b, final int off, final int len) throws IOException {
+ return this.stream.readNBytes(b, off, len);
+ }
+
+ @Override
+ public long skip(final long n) throws IOException {
+ return this.stream.skip(n);
+ }
+
+ @Override
+ public int available() throws IOException {
+ return this.stream.available();
+ }
+
+ @Override
+ public void close() throws IOException {
+ this.stream.close();
+ }
+
+ @Override
+ public synchronized void mark(final int readlimit) {
+ this.stream.mark(readlimit);
+ }
+
+ @Override
+ public synchronized void reset() throws IOException {
+ this.stream.reset();
+ }
+
+ @Override
+ public boolean markSupported() {
+ return this.stream.markSupported();
+ }
+
+ @Override
+ public long transferTo(final OutputStream out) throws IOException {
+ return this.stream.transferTo(out);
+ }
+
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletOutputStreamWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletOutputStreamWrapper.java
new file mode 100644
index 0000000000..13235c0ed6
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletOutputStreamWrapper.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletOutputStream;
+import jakarta.servlet.WriteListener;
+
+/**
+ * Servlet output stream
+ */
+public class ServletOutputStreamWrapper extends ServletOutputStream {
+
+ private final javax.servlet.ServletOutputStream stream;
+
+ /**
+ * Create new stream
+ * @param stream wrapped stream
+ */
+ public ServletOutputStreamWrapper(@NotNull final javax.servlet.ServletOutputStream stream) {
+ this.stream = stream;
+ }
+
+ @Override
+ public void print(final String s) throws IOException {
+ this.stream.print(s);
+ }
+
+ @Override
+ public void print(final boolean b) throws IOException {
+ this.stream.print(b);
+ }
+
+ @Override
+ public void print(final char c) throws IOException {
+ this.stream.print(c);
+ }
+
+ @Override
+ public void print(final int i) throws IOException {
+ this.stream.print(i);
+ }
+
+ @Override
+ public void print(final long l) throws IOException {
+ this.stream.print(l);
+ }
+
+ @Override
+ public void print(final float f) throws IOException {
+ this.stream.print(f);
+ }
+
+ @Override
+ public void print(final double d) throws IOException {
+ this.stream.print(d);
+ }
+
+ @Override
+ public void println() throws IOException {
+ this.stream.println();
+ }
+
+ @Override
+ public void println(final String s) throws IOException {
+ this.stream.println(s);
+ }
+
+ @Override
+ public void println(final boolean b) throws IOException {
+ this.stream.println(b);
+ }
+
+ @Override
+ public void println(final char c) throws IOException {
+ this.stream.println(c);
+ }
+
+ @Override
+ public void println(final int i) throws IOException {
+ this.stream.println(i);
+ }
+
+ @Override
+ public void println(final long l) throws IOException {
+ this.stream.println(l);
+ }
+
+ @Override
+ public void println(final float f) throws IOException {
+ this.stream.println(f);
+ }
+
+ @Override
+ public void println(final double d) throws IOException {
+ this.stream.println(d);
+ }
+
+ @Override
+ public boolean isReady() {
+ return this.stream.isReady();
+ }
+
+ @Override
+ public void setWriteListener(final WriteListener writeListener) {
+ this.stream.setWriteListener(new org.apache.felix.http.javaxwrappers.WriteListenerWrapper(writeListener));
+ }
+
+ @Override
+ public void write(final int b) throws IOException {
+ this.stream.write(b);
+ }
+
+ @Override
+ public void write(final byte[] b) throws IOException {
+ this.stream.write(b);
+ }
+
+ @Override
+ public void write(final byte[] b, final int off, final int len) throws IOException {
+ this.stream.write(b, off, len);
+ }
+
+ @Override
+ public void flush() throws IOException {
+ this.stream.flush();
+ }
+
+ @Override
+ public void close() throws IOException {
+ this.stream.close();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletRegistrationWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletRegistrationWrapper.java
new file mode 100644
index 0000000000..82d06c2661
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletRegistrationWrapper.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletRegistration;
+
+/**
+ * servlet registration wrapper
+ */
+public class ServletRegistrationWrapper implements ServletRegistration {
+
+ private final javax.servlet.ServletRegistration reg;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped registration
+ */
+ public ServletRegistrationWrapper(@NotNull final javax.servlet.ServletRegistration c) {
+ this.reg = c;
+ }
+
+ @Override
+ public Set<String> addMapping(final String... urlPatterns) {
+ return reg.addMapping(urlPatterns);
+ }
+
+ @Override
+ public String getName() {
+ return reg.getName();
+ }
+
+ @Override
+ public Collection<String> getMappings() {
+ return reg.getMappings();
+ }
+
+ @Override
+ public String getClassName() {
+ return reg.getClassName();
+ }
+
+ @Override
+ public boolean setInitParameter(final String name, final String value) {
+ return reg.setInitParameter(name, value);
+ }
+
+ @Override
+ public String getRunAsRole() {
+ return reg.getRunAsRole();
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return reg.getInitParameter(name);
+ }
+
+ @Override
+ public Set<String> setInitParameters(final Map<String, String> initParameters) {
+ return reg.setInitParameters(initParameters);
+ }
+
+ @Override
+ public Map<String, String> getInitParameters() {
+ return reg.getInitParameters();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletRequestWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletRequestWrapper.java
new file mode 100644
index 0000000000..2d11a541a0
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletRequestWrapper.java
@@ -0,0 +1,420 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import static jakarta.servlet.AsyncContext.ASYNC_CONTEXT_PATH;
+import static jakarta.servlet.AsyncContext.ASYNC_MAPPING;
+import static jakarta.servlet.AsyncContext.ASYNC_PATH_INFO;
+import static jakarta.servlet.AsyncContext.ASYNC_QUERY_STRING;
+import static jakarta.servlet.AsyncContext.ASYNC_REQUEST_URI;
+import static jakarta.servlet.AsyncContext.ASYNC_SERVLET_PATH;
+import static jakarta.servlet.RequestDispatcher.ERROR_EXCEPTION;
+import static jakarta.servlet.RequestDispatcher.ERROR_EXCEPTION_TYPE;
+import static jakarta.servlet.RequestDispatcher.ERROR_MESSAGE;
+import static jakarta.servlet.RequestDispatcher.ERROR_REQUEST_URI;
+import static jakarta.servlet.RequestDispatcher.ERROR_SERVLET_NAME;
+import static jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE;
+import static jakarta.servlet.RequestDispatcher.FORWARD_CONTEXT_PATH;
+import static jakarta.servlet.RequestDispatcher.FORWARD_MAPPING;
+import static jakarta.servlet.RequestDispatcher.FORWARD_PATH_INFO;
+import static jakarta.servlet.RequestDispatcher.FORWARD_QUERY_STRING;
+import static jakarta.servlet.RequestDispatcher.FORWARD_REQUEST_URI;
+import static jakarta.servlet.RequestDispatcher.FORWARD_SERVLET_PATH;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_CONTEXT_PATH;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_MAPPING;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_PATH_INFO;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_QUERY_STRING;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_REQUEST_URI;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_SERVLET_PATH;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.jetbrains.annotations.NotNull;
+
+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.ServletResponse;
+
+/**
+ * Servlet request wrapper
+ */
+public class ServletRequestWrapper implements ServletRequest {
+
+ private final javax.servlet.ServletRequest request;
+
+ /**
+ * Get the wrapper
+ * @param r The request
+ * @return The wrapped request
+ */
+ public static ServletRequest getWrapper(final javax.servlet.ServletRequest r) {
+ if ( r instanceof org.apache.felix.http.javaxwrappers.ServletRequestWrapper) {
+ return ((org.apache.felix.http.javaxwrappers.ServletRequestWrapper)r).getRequest();
+ }
+ if ( r instanceof javax.servlet.http.HttpServletRequest ) {
+ return new HttpServletRequestWrapper((javax.servlet.http.HttpServletRequest)r);
+ }
+ return new ServletRequestWrapper(r);
+ }
+
+ /**
+ * Create a wrapper
+ * @param r The wrapped request
+ */
+ public ServletRequestWrapper(@NotNull final javax.servlet.ServletRequest r) {
+ this.request = r;
+ }
+
+
+ /**
+ * Get the request
+ * @return The request
+ */
+ public javax.servlet.ServletRequest getRequest() {
+ return this.request;
+ }
+
+ private Object wrapHttpServletMapping(final Object value) {
+ if ( value instanceof org.apache.felix.http.javaxwrappers.HttpServletMappingWrapper ) {
+ return ((org.apache.felix.http.javaxwrappers.HttpServletMappingWrapper)value).getMapping();
+ }
+ if ( value instanceof javax.servlet.http.HttpServletMapping ) {
+ return new HttpServletMappingWrapper((javax.servlet.http.HttpServletMapping)value);
+ }
+ return value;
+ }
+
+ public static String getTranslatedAttributeName(final String name) {
+ if ( FORWARD_CONTEXT_PATH.equals(name) ) {
+ return javax.servlet.RequestDispatcher.FORWARD_CONTEXT_PATH;
+
+ } else if ( FORWARD_MAPPING.equals(name) ) {
+ return javax.servlet.RequestDispatcher.FORWARD_MAPPING;
+
+ } else if ( FORWARD_PATH_INFO.equals(name) ) {
+ return javax.servlet.RequestDispatcher.FORWARD_PATH_INFO;
+
+ } else if ( FORWARD_QUERY_STRING.equals(name) ) {
+ return javax.servlet.RequestDispatcher.FORWARD_QUERY_STRING;
+
+ } else if ( FORWARD_REQUEST_URI.equals(name) ) {
+ return javax.servlet.RequestDispatcher.FORWARD_REQUEST_URI;
+
+ } else if ( FORWARD_SERVLET_PATH.equals(name) ) {
+ return javax.servlet.RequestDispatcher.FORWARD_SERVLET_PATH;
+
+ } else if ( INCLUDE_CONTEXT_PATH.equals(name) ) {
+ return javax.servlet.RequestDispatcher.INCLUDE_CONTEXT_PATH;
+
+ } else if ( INCLUDE_MAPPING.equals(name) ) {
+ return javax.servlet.RequestDispatcher.INCLUDE_MAPPING;
+
+ } else if ( INCLUDE_PATH_INFO.equals(name) ) {
+ return javax.servlet.RequestDispatcher.INCLUDE_PATH_INFO;
+
+ } else if ( INCLUDE_QUERY_STRING.equals(name) ) {
+ return javax.servlet.RequestDispatcher.INCLUDE_QUERY_STRING;
+
+ } else if ( INCLUDE_REQUEST_URI.equals(name) ) {
+ return javax.servlet.RequestDispatcher.INCLUDE_REQUEST_URI;
+
+ } else if ( INCLUDE_SERVLET_PATH.equals(name) ) {
+ return javax.servlet.RequestDispatcher.INCLUDE_SERVLET_PATH;
+
+ } else if ( ERROR_EXCEPTION.equals(name) ) {
+ return javax.servlet.RequestDispatcher.ERROR_EXCEPTION;
+
+ } else if ( ERROR_EXCEPTION_TYPE.equals(name) ) {
+ return javax.servlet.RequestDispatcher.ERROR_EXCEPTION_TYPE;
+
+ } else if ( ERROR_MESSAGE.equals(name) ) {
+ return javax.servlet.RequestDispatcher.ERROR_MESSAGE;
+
+ } else if ( ERROR_REQUEST_URI.equals(name) ) {
+ return javax.servlet.RequestDispatcher.ERROR_REQUEST_URI;
+
+ } else if ( ERROR_SERVLET_NAME.equals(name) ) {
+ return javax.servlet.RequestDispatcher.ERROR_SERVLET_NAME;
+
+ } else if ( ERROR_STATUS_CODE.equals(name) ) {
+ return javax.servlet.RequestDispatcher.ERROR_STATUS_CODE;
+
+ } else if ( ASYNC_CONTEXT_PATH.equals(name) ) {
+ return javax.servlet.AsyncContext.ASYNC_CONTEXT_PATH;
+
+ } else if ( ASYNC_MAPPING.equals(name) ) {
+ return javax.servlet.AsyncContext.ASYNC_MAPPING;
+
+ } else if ( ASYNC_PATH_INFO.equals(name) ) {
+ return javax.servlet.AsyncContext.ASYNC_PATH_INFO;
+
+ } else if ( ASYNC_QUERY_STRING.equals(name) ) {
+ return javax.servlet.AsyncContext.ASYNC_QUERY_STRING;
+
+ } else if ( ASYNC_REQUEST_URI.equals(name) ) {
+ return javax.servlet.AsyncContext.ASYNC_REQUEST_URI;
+
+ } else if ( ASYNC_SERVLET_PATH.equals(name) ) {
+ return javax.servlet.AsyncContext.ASYNC_SERVLET_PATH;
+ }
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(final String name) {
+ final String translatedName = getTranslatedAttributeName(name);
+ if ( translatedName != null ) {
+ final Object value = this.request.getAttribute(translatedName);
+ if ( FORWARD_MAPPING.equals(name) ) {
+ return wrapHttpServletMapping(value);
+ } else if ( INCLUDE_MAPPING.equals(name) ) {
+ return wrapHttpServletMapping(value);
+ } else if ( ASYNC_MAPPING.equals(name) ) {
+ return wrapHttpServletMapping(value);
+ }
+ return value;
+ }
+ return this.request.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ final List<String> names = Collections.list(this.request.getAttributeNames());
+ final List<String> translatedNames = new ArrayList<>();
+ for(final String name : names) {
+ final String translatedName = org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getTranslatedAttributeName(name);
+ if ( translatedName != null ) {
+ translatedNames.add(translatedName);
+ } else {
+ translatedNames.add(name);
+ }
+ }
+ return Collections.enumeration(translatedNames);
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return this.request.getCharacterEncoding();
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
+ this.request.setCharacterEncoding(env);
+ }
+
+ @Override
+ public int getContentLength() {
+ return this.request.getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong() {
+ return this.request.getContentLengthLong();
+ }
+
+ @Override
+ public String getContentType() {
+ return this.request.getContentType();
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException {
+ return new ServletInputStreamWrapper(this.request.getInputStream());
+ }
+
+ @Override
+ public String getParameter(String name) {
+ return this.request.getParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getParameterNames() {
+ return this.request.getParameterNames();
+ }
+
+ @Override
+ public String[] getParameterValues(final String name) {
+ return this.request.getParameterValues(name);
+ }
+
+ @Override
+ public Map<String, String[]> getParameterMap() {
+ return this.request.getParameterMap();
+ }
+
+ @Override
+ public String getProtocol() {
+ return this.request.getProtocol();
+ }
+
+ @Override
+ public String getScheme() {
+ return this.request.getScheme();
+ }
+
+ @Override
+ public String getServerName() {
+ return this.request.getServerName();
+ }
+
+ @Override
+ public int getServerPort() {
+ return this.request.getServerPort();
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException {
+ return this.request.getReader();
+ }
+
+ @Override
+ public String getRemoteAddr() {
+ return this.request.getRemoteAddr();
+ }
+
+ @Override
+ public String getRemoteHost() {
+ return this.request.getRemoteHost();
+ }
+
+ @Override
+ public void setAttribute(final String name, final Object o) {
+ final String translatedName = getTranslatedAttributeName(name);
+ if (translatedName != null) {
+ this.request.setAttribute(translatedName, o);
+ this.request.removeAttribute(name);
+ } else {
+ this.request.setAttribute(name, o);
+ }
+ }
+
+ @Override
+ public void removeAttribute(final String name) {
+ final String translatedName = getTranslatedAttributeName(name);
+ this.request.removeAttribute(name);
+ if (translatedName != null) {
+ this.request.removeAttribute(translatedName);
+ }
+ }
+
+ @Override
+ public Locale getLocale() {
+ return this.request.getLocale();
+ }
+
+ @Override
+ public Enumeration<Locale> getLocales() {
+ return this.request.getLocales();
+ }
+
+ @Override
+ public boolean isSecure() {
+ return this.request.isSecure();
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(final String path) {
+ final javax.servlet.RequestDispatcher dispatcher = this.request.getRequestDispatcher(path);
+ if ( dispatcher != null ) {
+ return new RequestDispatcherWrapper(dispatcher);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String getRealPath(final String path) {
+ return this.request.getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort() {
+ return this.request.getRemotePort();
+ }
+
+ @Override
+ public String getLocalName() {
+ return this.request.getLocalName();
+ }
+
+ @Override
+ public String getLocalAddr() {
+ return this.request.getLocalAddr();
+ }
+
+ @Override
+ public int getLocalPort() {
+ return this.request.getLocalPort();
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return new ServletContextWrapper(this.request.getServletContext());
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException {
+ return new AsyncContextWrapper(this.request.startAsync());
+ }
+
+ @Override
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException {
+ return new AsyncContextWrapper(this.request.startAsync(
+ org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(servletRequest),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(servletResponse)));
+ }
+
+ @Override
+ public boolean isAsyncStarted() {
+ return this.request.isAsyncStarted();
+ }
+
+ @Override
+ public boolean isAsyncSupported() {
+ return this.request.isAsyncSupported();
+ }
+
+ @Override
+ public AsyncContext getAsyncContext() {
+ return new AsyncContextWrapper(this.request.getAsyncContext());
+ }
+
+ @Override
+ public DispatcherType getDispatcherType() {
+ switch (this.request.getDispatcherType()) {
+ case ASYNC : return DispatcherType.ASYNC;
+ case ERROR : return DispatcherType.ERROR;
+ case FORWARD : return DispatcherType.FORWARD;
+ case INCLUDE : return DispatcherType.INCLUDE;
+ case REQUEST : return DispatcherType.REQUEST;
+ }
+ return null;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletResponseWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletResponseWrapper.java
new file mode 100644
index 0000000000..17d24091e5
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletResponseWrapper.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletOutputStream;
+import jakarta.servlet.ServletResponse;
+
+/**
+ * Servlet response wrapper
+ */
+public class ServletResponseWrapper implements ServletResponse {
+
+ private final javax.servlet.ServletResponse response;
+
+ /**
+ * Get a wrapper
+ * @param r Response
+ * @return Wrapped response
+ */
+ public static ServletResponse getWrapper(final javax.servlet.ServletResponse r) {
+ if ( r instanceof org.apache.felix.http.javaxwrappers.ServletResponseWrapper) {
+ return ((org.apache.felix.http.javaxwrappers.ServletResponseWrapper)r).getResponse();
+ }
+ if ( r instanceof javax.servlet.http.HttpServletResponse ) {
+ return new HttpServletResponseWrapper((javax.servlet.http.HttpServletResponse)r);
+ }
+ return new ServletResponseWrapper(r);
+ }
+
+ /**
+ * Create new response
+ * @param r Wrapped response
+ */
+ public ServletResponseWrapper(@NotNull final javax.servlet.ServletResponse r) {
+ this.response = r;
+ }
+
+ /**
+ * Get the wrapped response
+ * @return The response
+ */
+ public javax.servlet.ServletResponse getResponse() {
+ return this.response;
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return this.response.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType() {
+ return this.response.getContentType();
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException {
+ return new ServletOutputStreamWrapper(this.response.getOutputStream());
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException {
+ return this.response.getWriter();
+ }
+
+ @Override
+ public void setCharacterEncoding(final String charset) {
+ this.response.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentLength(final int len) {
+ this.response.setContentLength(len);
+ }
+
+ @Override
+ public void setContentLengthLong(final long len) {
+ this.response.setContentLengthLong(len);
+ }
+
+ @Override
+ public void setContentType(final String type) {
+ this.response.setContentType(type);
+ }
+
+ @Override
+ public void setBufferSize(final int size) {
+ this.response.setBufferSize(size);
+ }
+
+ @Override
+ public int getBufferSize() {
+ return this.response.getBufferSize();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException {
+ this.response.flushBuffer();
+ }
+
+ @Override
+ public void resetBuffer() {
+ this.response.resetBuffer();
+ }
+
+ @Override
+ public boolean isCommitted() {
+ return this.response.isCommitted();
+ }
+
+ @Override
+ public void reset() {
+ this.response.reset();
+ }
+
+ @Override
+ public void setLocale(final Locale loc) {
+ this.response.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return this.response.getLocale();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletWrapper.java
new file mode 100644
index 0000000000..43d32cb6ae
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/ServletWrapper.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+
+/**
+ * Servlet wrapper
+ */
+public class ServletWrapper implements Servlet {
+
+ private final javax.servlet.Servlet servlet;
+
+ /**
+ * Get the registered servlet
+ * @param s The servlet
+ * @return The registered servlet
+ */
+ public static Servlet getRegisteredServlet(final javax.servlet.Servlet s) {
+ if ( s instanceof org.apache.felix.http.javaxwrappers.ServletWrapper ) {
+ return ((org.apache.felix.http.javaxwrappers.ServletWrapper)s).getServlet();
+ }
+ return new ServletWrapper(s);
+ }
+
+ /**
+ * Create new servlet
+ * @param servlet wrapped servlet
+ */
+ public ServletWrapper(@NotNull final javax.servlet.Servlet servlet) {
+ this.servlet = servlet;
+ }
+
+ @Override
+ public void init(final ServletConfig config) throws ServletException {
+ try {
+ servlet.init(new org.apache.felix.http.javaxwrappers.ServletConfigWrapper(config));
+ } catch (javax.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public ServletConfig getServletConfig() {
+ return new ServletConfigWrapper(servlet.getServletConfig());
+ }
+
+ @Override
+ public void service(final ServletRequest req, final ServletResponse res)
+ throws ServletException, IOException {
+ try {
+ servlet.service(org.apache.felix.http.javaxwrappers.ServletRequestWrapper.getWrapper(req),
+ org.apache.felix.http.javaxwrappers.ServletResponseWrapper.getWrapper(res));
+ } catch (javax.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public String getServletInfo() {
+ return servlet.getServletInfo();
+ }
+
+ @Override
+ public void destroy() {
+ servlet.destroy();
+ }
+
+ /**
+ * Get the wrapped servlet
+ * @return The servlet
+ */
+ public @NotNull javax.servlet.Servlet getServlet() {
+ return this.servlet;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/SessionCookieConfigWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/SessionCookieConfigWrapper.java
new file mode 100644
index 0000000000..a2246ce9f1
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/SessionCookieConfigWrapper.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.SessionCookieConfig;
+
+/**
+ * Session cookie config wrapper
+ */
+public class SessionCookieConfigWrapper implements SessionCookieConfig {
+
+ private final javax.servlet.SessionCookieConfig config;
+
+ /**
+ * Create new config
+ * @param c Wrapped config
+ */
+ public SessionCookieConfigWrapper(@NotNull final javax.servlet.SessionCookieConfig c) {
+ this.config = c;
+ }
+
+ @Override
+ public void setName(String name) {
+ config.setName(name);
+ }
+
+ @Override
+ public String getName() {
+ return config.getName();
+ }
+
+ @Override
+ public void setDomain(final String domain) {
+ config.setDomain(domain);
+ }
+
+ @Override
+ public String getDomain() {
+ return config.getDomain();
+ }
+
+ @Override
+ public void setPath(final String path) {
+ config.setPath(path);
+ }
+
+ @Override
+ public String getPath() {
+ return config.getPath();
+ }
+
+ @Override
+ public void setComment(final String comment) {
+ config.setComment(comment);
+ }
+
+ @Override
+ public String getComment() {
+ return config.getComment();
+ }
+
+ @Override
+ public void setHttpOnly(final boolean httpOnly) {
+ config.setHttpOnly(httpOnly);
+ }
+
+ @Override
+ public boolean isHttpOnly() {
+ return config.isHttpOnly();
+ }
+
+ @Override
+ public void setSecure(final boolean secure) {
+ config.setSecure(secure);
+ }
+
+ @Override
+ public boolean isSecure() {
+ return config.isSecure();
+ }
+
+ @Override
+ public void setMaxAge(final int maxAge) {
+ config.setMaxAge(maxAge);
+ }
+
+ @Override
+ public int getMaxAge() {
+ return config.getMaxAge();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/WriteListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/WriteListenerWrapper.java
new file mode 100644
index 0000000000..58390b0dc6
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/WriteListenerWrapper.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.WriteListener;
+
+/**
+ * Write listener
+ */
+public class WriteListenerWrapper implements WriteListener {
+
+ private final javax.servlet.WriteListener listener;
+
+ /**
+ * Create new lister
+ * @param listener Wrapped listener
+ */
+ public WriteListenerWrapper(@NotNull final javax.servlet.WriteListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void onWritePossible() throws IOException {
+ listener.onWritePossible();
+ }
+
+ @Override
+ public void onError(final Throwable t) {
+ listener.onError(t);
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/package-info.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/package-info.java
new file mode 100644
index 0000000000..5fb595c15c
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/jakartawrappers/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+@org.osgi.annotation.versioning.Version("1.0.2")
+package org.apache.felix.http.jakartawrappers;
+
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/AsyncContextWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/AsyncContextWrapper.java
new file mode 100644
index 0000000000..faccef3740
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/AsyncContextWrapper.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.AsyncContext;
+
+/**
+ * async context wrapper
+ */
+public class AsyncContextWrapper implements javax.servlet.AsyncContext {
+
+ private final AsyncContext context;
+
+ /**
+ * Create new context
+ * @param c Wrapped context
+ */
+ public AsyncContextWrapper(@NotNull final AsyncContext c) {
+ this.context = c;
+ }
+
+ @Override
+ public javax.servlet.ServletRequest getRequest() {
+ return ServletRequestWrapper.getWrapper(context.getRequest());
+ }
+
+ @Override
+ public javax.servlet.ServletResponse getResponse() {
+ return ServletResponseWrapper.getWrapper(context.getResponse());
+ }
+
+ @Override
+ public boolean hasOriginalRequestAndResponse() {
+ return context.hasOriginalRequestAndResponse();
+ }
+
+ @Override
+ public void dispatch() {
+ context.dispatch();
+ }
+
+ @Override
+ public void dispatch(final String path) {
+ context.dispatch(path);
+ }
+
+ @Override
+ public void dispatch(final javax.servlet.ServletContext sc, final String path) {
+ context.dispatch(new org.apache.felix.http.jakartawrappers.ServletContextWrapper(sc), path);
+ }
+
+ @Override
+ public void complete() {
+ context.complete();
+ }
+
+ @Override
+ public void start(final Runnable run) {
+ context.start(run);
+ }
+
+ @Override
+ public void addListener(final javax.servlet.AsyncListener listener) {
+ context.addListener(new org.apache.felix.http.jakartawrappers.AsyncListenerWrapper(listener));
+ }
+
+ @Override
+ public void addListener(final javax.servlet.AsyncListener listener, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) {
+ context.addListener(new org.apache.felix.http.jakartawrappers.AsyncListenerWrapper(listener),
+ org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getWrapper(servletRequest),
+ org.apache.felix.http.jakartawrappers.ServletResponseWrapper.getWrapper(servletResponse));
+ }
+
+ @Override
+ public <T extends javax.servlet.AsyncListener> T createListener(final Class<T> clazz) throws javax.servlet.ServletException {
+ throw new javax.servlet.ServletException();
+ }
+
+ @Override
+ public void setTimeout(final long timeout) {
+ context.setTimeout(timeout);
+ }
+
+ @Override
+ public long getTimeout() {
+ return context.getTimeout();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/AsyncListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/AsyncListenerWrapper.java
new file mode 100644
index 0000000000..94086d1f34
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/AsyncListenerWrapper.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.apache.felix.http.jakartawrappers.ServletRequestWrapper;
+import org.apache.felix.http.jakartawrappers.ServletResponseWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.AsyncEvent;
+import jakarta.servlet.AsyncListener;
+
+/**
+ * Async listener wrapper
+ */
+public class AsyncListenerWrapper implements javax.servlet.AsyncListener {
+
+ private final AsyncListener listener;
+
+ /**
+ * Create new listener
+ * @param c Wrapped listener
+ */
+ public AsyncListenerWrapper(@NotNull final AsyncListener c) {
+ this.listener = c;
+ }
+
+ @Override
+ public void onComplete(final javax.servlet.AsyncEvent event) throws IOException {
+ this.listener.onComplete(new AsyncEvent(
+ new org.apache.felix.http.jakartawrappers.AsyncContextWrapper(event.getAsyncContext()),
+ ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+
+ @Override
+ public void onTimeout(final javax.servlet.AsyncEvent event) throws IOException {
+ this.listener.onTimeout(new AsyncEvent(
+ new org.apache.felix.http.jakartawrappers.AsyncContextWrapper(event.getAsyncContext()),
+ ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+
+ @Override
+ public void onError(final javax.servlet.AsyncEvent event) throws IOException {
+ this.listener.onError(new AsyncEvent(
+ new org.apache.felix.http.jakartawrappers.AsyncContextWrapper(event.getAsyncContext()),
+ ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+
+ @Override
+ public void onStartAsync(final javax.servlet.AsyncEvent event) throws IOException {
+ this.listener.onStartAsync(new AsyncEvent(
+ new org.apache.felix.http.jakartawrappers.AsyncContextWrapper(event.getAsyncContext()),
+ ServletRequestWrapper.getWrapper(event.getSuppliedRequest()),
+ ServletResponseWrapper.getWrapper(event.getSuppliedResponse()),
+ event.getThrowable()));
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/CookieWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/CookieWrapper.java
new file mode 100644
index 0000000000..7c8bcd79c8
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/CookieWrapper.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.Cookie;
+
+/**
+ * Javax cookie based on a jakarta cookie
+ */
+public class CookieWrapper extends javax.servlet.http.Cookie {
+
+ private static final long serialVersionUID = -6762987885237379239L;
+
+ /**
+ * Wrap an array of cookies
+ * @param array The array
+ * @return The result
+ */
+ public static javax.servlet.http.Cookie[] wrap(final Cookie[] array) {
+ if ( array == null ) {
+ return null;
+ }
+ final javax.servlet.http.Cookie[] result = new javax.servlet.http.Cookie[array.length];
+ for(int i=0;i<array.length;i++) {
+ result[i] = new CookieWrapper(array[i]);
+ }
+ return result;
+ }
+
+ private final Cookie cookie;
+
+ /**
+ * Create new cookie
+ * @param c Wrapped cookie
+ */
+ public CookieWrapper(@NotNull final Cookie c) {
+ super(c.getName(), c.getValue());
+ this.cookie = c;
+ super.setComment(c.getComment());
+ if ( c.getDomain() != null ) {
+ super.setDomain(c.getDomain());
+ }
+ super.setHttpOnly(c.isHttpOnly());
+ super.setMaxAge(c.getMaxAge());
+ super.setPath(c.getPath());
+ super.setSecure(c.getSecure());
+ super.setVersion(c.getVersion());
+ }
+
+ @Override
+ public void setComment(final String purpose) {
+ this.cookie.setComment(purpose);
+ super.setComment(purpose);
+ }
+
+ @Override
+ public void setDomain(final String domain) {
+ this.cookie.setDomain(domain);
+ super.setDomain(domain);
+ }
+
+ @Override
+ public void setMaxAge(final int expiry) {
+ this.cookie.setMaxAge(expiry);
+ super.setMaxAge(expiry);
+ }
+
+ @Override
+ public void setPath(final String uri) {
+ this.cookie.setPath(uri);
+ super.setPath(uri);
+ }
+
+ @Override
+ public void setSecure(final boolean flag) {
+ this.cookie.setSecure(flag);
+ super.setSecure(flag);
+ }
+
+ @Override
+ public void setValue(final String newValue) {
+ this.cookie.setValue(newValue);
+ super.setValue(newValue);
+ }
+
+ @Override
+ public void setVersion(final int v) {
+ this.cookie.setVersion(v);
+ super.setVersion(v);
+ }
+
+ @Override
+ public void setHttpOnly(final boolean isHttpOnly) {
+ this.cookie.setHttpOnly(isHttpOnly);
+ super.setHttpOnly(isHttpOnly);
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterChainWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterChainWrapper.java
new file mode 100644
index 0000000000..307c89c933
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterChainWrapper.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.apache.felix.http.jakartawrappers.ServletResponseWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.FilterChain;
+
+/**
+ * Javax filter chain based on a jakarta filter chain
+ */
+public class FilterChainWrapper implements javax.servlet.FilterChain {
+
+ private final FilterChain filterChain;
+
+ /**
+ * Create new chain
+ * @param chain Wrapped chain
+ */
+ public FilterChainWrapper(@NotNull final FilterChain chain) {
+ this.filterChain = chain;
+ }
+
+ @Override
+ public void doFilter(final javax.servlet.ServletRequest request, final javax.servlet.ServletResponse response)
+ throws IOException, javax.servlet.ServletException {
+ try {
+ filterChain.doFilter(org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getWrapper(request),
+ ServletResponseWrapper.getWrapper(response));
+ } catch (final jakarta.servlet.ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterConfigWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterConfigWrapper.java
new file mode 100644
index 0000000000..b040e3762b
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterConfigWrapper.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.FilterConfig;
+
+/**
+ * Filter config wrapper
+ */
+public class FilterConfigWrapper implements javax.servlet.FilterConfig {
+
+ private final FilterConfig filterConfig;
+
+ /**
+ * Create config
+ * @param filterConfig wrapped config
+ */
+ public FilterConfigWrapper(@NotNull final FilterConfig filterConfig) {
+ this.filterConfig = filterConfig;
+ }
+
+ @Override
+ public String getFilterName() {
+ return this.filterConfig.getFilterName();
+ }
+
+ @Override
+ public javax.servlet.ServletContext getServletContext() {
+ return new ServletContextWrapper(this.filterConfig.getServletContext());
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return this.filterConfig.getInitParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getInitParameterNames() {
+ return this.filterConfig.getInitParameterNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterRegistrationWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterRegistrationWrapper.java
new file mode 100644
index 0000000000..fa9bfbaae8
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/FilterRegistrationWrapper.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.FilterRegistration;
+
+/**
+ * Filter registration wrapper
+ */
+public class FilterRegistrationWrapper implements javax.servlet.FilterRegistration {
+
+ private final FilterRegistration reg;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped registration
+ */
+ public FilterRegistrationWrapper(@NotNull final FilterRegistration c) {
+ this.reg = c;
+ }
+
+ private EnumSet<DispatcherType> wrap(final EnumSet<javax.servlet.DispatcherType> dispatcherTypes) {
+ final EnumSet<DispatcherType> set = EnumSet.noneOf(DispatcherType.class);
+ if ( dispatcherTypes.contains(javax.servlet.DispatcherType.ASYNC)) {
+ set.add(DispatcherType.ASYNC);
+ }
+ if ( dispatcherTypes.contains(javax.servlet.DispatcherType.ERROR)) {
+ set.add(DispatcherType.ERROR);
+ }
+ if ( dispatcherTypes.contains(javax.servlet.DispatcherType.FORWARD)) {
+ set.add(DispatcherType.FORWARD);
+ }
+ if ( dispatcherTypes.contains(javax.servlet.DispatcherType.INCLUDE)) {
+ set.add(DispatcherType.INCLUDE);
+ }
+ if ( dispatcherTypes.contains(javax.servlet.DispatcherType.REQUEST)) {
+ set.add(DispatcherType.REQUEST);
+ }
+ return set;
+ }
+
+ @Override
+ public void addMappingForServletNames(final EnumSet<javax.servlet.DispatcherType> dispatcherTypes, final boolean isMatchAfter,
+ final String... servletNames) {
+ reg.addMappingForServletNames(wrap(dispatcherTypes), isMatchAfter, servletNames);
+ }
+
+ @Override
+ public String getName() {
+ return reg.getName();
+ }
+
+ @Override
+ public String getClassName() {
+ return reg.getClassName();
+ }
+
+ @Override
+ public boolean setInitParameter(final String name, final String value) {
+ return reg.setInitParameter(name, value);
+ }
+
+ @Override
+ public Collection<String> getServletNameMappings() {
+ return reg.getServletNameMappings();
+ }
+
+ @Override
+ public void addMappingForUrlPatterns(final EnumSet<javax.servlet.DispatcherType> dispatcherTypes, final boolean isMatchAfter,
+ final String... urlPatterns) {
+ reg.addMappingForUrlPatterns(wrap(dispatcherTypes), isMatchAfter, urlPatterns);
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return reg.getInitParameter(name);
+ }
+
+ @Override
+ public Set<String> setInitParameters(final Map<String, String> initParameters) {
+ return reg.setInitParameters(initParameters);
+ }
+
+ @Override
+ public Collection<String> getUrlPatternMappings() {
+ return reg.getUrlPatternMappings();
+ }
+
+ @Override
+ public Map<String, String> getInitParameters() {
+ return reg.getInitParameters();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletMappingWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletMappingWrapper.java
new file mode 100644
index 0000000000..6d1a1c961f
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletMappingWrapper.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpServletMapping;
+
+/**
+ * Http Mapping wrapper
+ */
+public class HttpServletMappingWrapper implements javax.servlet.http.HttpServletMapping {
+
+ private final HttpServletMapping mapping;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped mapper
+ */
+ public HttpServletMappingWrapper(@NotNull final HttpServletMapping c) {
+ this.mapping = c;
+ }
+
+ @Override
+ public String getMatchValue() {
+ return mapping.getMatchValue();
+ }
+
+ @Override
+ public String getPattern() {
+ return mapping.getPattern();
+ }
+
+ @Override
+ public String getServletName() {
+ return mapping.getServletName();
+ }
+
+ @Override
+ public javax.servlet.http.MappingMatch getMappingMatch() {
+ switch (mapping.getMappingMatch()) {
+ case CONTEXT_ROOT : return javax.servlet.http.MappingMatch.CONTEXT_ROOT;
+ case DEFAULT : return javax.servlet.http.MappingMatch.DEFAULT;
+ case EXACT : return javax.servlet.http.MappingMatch.EXACT;
+ case EXTENSION : return javax.servlet.http.MappingMatch.EXTENSION;
+ case PATH : return javax.servlet.http.MappingMatch.PATH;
+ }
+ return null;
+ }
+
+ /**
+ * Get the wrapped mapping
+ * @return The mapping
+ */
+ public HttpServletMapping getMapping() {
+ return this.mapping;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletRequestWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletRequestWrapper.java
new file mode 100644
index 0000000000..7396e62db3
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletRequestWrapper.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.Part;
+import jakarta.servlet.http.PushBuilder;
+
+/**
+ * Http servlet request wrapper
+ */
+public class HttpServletRequestWrapper extends ServletRequestWrapper
+ implements javax.servlet.http.HttpServletRequest {
+
+ private final HttpServletRequest request;
+
+ /**
+ * Create new request
+ * @param r wrapped request
+ */
+ public HttpServletRequestWrapper(@NotNull final HttpServletRequest r) {
+ super(r);
+ this.request = r;
+ }
+
+ @Override
+ public String getAuthType() {
+ return this.request.getAuthType();
+ }
+
+ @Override
+ public javax.servlet.http.Cookie[] getCookies() {
+ return CookieWrapper.wrap(this.request.getCookies());
+ }
+
+ @Override
+ public long getDateHeader(final String name) {
+ return this.request.getDateHeader(name);
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.request.getHeader(name);
+ }
+
+ @Override
+ public Enumeration<String> getHeaders(final String name) {
+ return this.request.getHeaders(name);
+ }
+
+ @Override
+ public Enumeration<String> getHeaderNames() {
+ return this.request.getHeaderNames();
+ }
+
+ @Override
+ public int getIntHeader(final String name) {
+ return this.request.getIntHeader(name);
+ }
+
+ @Override
+ public String getMethod() {
+ return this.request.getMethod();
+ }
+
+ @Override
+ public String getPathInfo() {
+ return this.request.getPathInfo();
+ }
+
+ @Override
+ public String getPathTranslated() {
+ return this.request.getPathTranslated();
+ }
+
+ @Override
+ public String getContextPath() {
+ return this.request.getContextPath();
+ }
+
+ @Override
+ public String getQueryString() {
+ return this.request.getQueryString();
+ }
+
+ @Override
+ public String getRemoteUser() {
+ return this.request.getRemoteUser();
+ }
+
+ @Override
+ public boolean isUserInRole(final String role) {
+ return this.request.isUserInRole(role);
+ }
+
+ @Override
+ public Principal getUserPrincipal() {
+ return this.request.getUserPrincipal();
+ }
+
+ @Override
+ public String getRequestedSessionId() {
+ return this.request.getRequestedSessionId();
+ }
+
+ @Override
+ public String getRequestURI() {
+ return this.request.getRequestURI();
+ }
+
+ @Override
+ public StringBuffer getRequestURL() {
+ return this.request.getRequestURL();
+ }
+
+ @Override
+ public String getServletPath() {
+ return this.request.getServletPath();
+ }
+
+ @Override
+ public javax.servlet.http.HttpSession getSession(final boolean create) {
+ final HttpSession session = this.request.getSession(create);
+ if ( session != null ) {
+ return new HttpSessionWrapper(session);
+ }
+ return null;
+ }
+
+ @Override
+ public javax.servlet.http.HttpSession getSession() {
+ return new HttpSessionWrapper(this.request.getSession());
+ }
+
+ @Override
+ public String changeSessionId() {
+ return this.request.changeSessionId();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid() {
+ return this.request.isRequestedSessionIdValid();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie() {
+ return this.request.isRequestedSessionIdFromCookie();
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL() {
+ return this.request.isRequestedSessionIdFromURL();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean isRequestedSessionIdFromUrl() {
+ return this.request.isRequestedSessionIdFromUrl();
+ }
+
+ @Override
+ public boolean authenticate(final javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException {
+ try {
+ return this.request.authenticate((HttpServletResponse)org.apache.felix.http.jakartawrappers.ServletResponseWrapper.getWrapper(response));
+ } catch ( final jakarta.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void login(final String username, final String password) throws javax.servlet.ServletException {
+ try {
+ this.request.login(username, password);
+ } catch ( final jakarta.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void logout() throws javax.servlet.ServletException {
+ try {
+ this.request.logout();
+ } catch ( final jakarta.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public Collection<javax.servlet.http.Part> getParts() throws IOException, javax.servlet.ServletException {
+ try {
+ final List<javax.servlet.http.Part> result = new ArrayList<>();
+ for(final Part p : this.request.getParts()) {
+ result.add(new PartWrapper(p));
+ }
+ return result;
+ } catch ( final jakarta.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public javax.servlet.http.Part getPart(final String name) throws IOException, javax.servlet.ServletException {
+ try {
+ return new PartWrapper(this.request.getPart(name));
+ } catch ( final jakarta.servlet.ServletException e ) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(final Class<T> handlerClass) throws IOException, javax.servlet.ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.http.HttpServletMapping getHttpServletMapping() {
+ return new HttpServletMappingWrapper(this.request.getHttpServletMapping());
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder newPushBuilder() {
+ final PushBuilder builder = this.request.newPushBuilder();
+ if ( builder != null ) {
+ return new PushBuilderWrapper(builder);
+ }
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getTrailerFields() {
+ return this.request.getTrailerFields();
+ }
+
+ @Override
+ public boolean isTrailerFieldsReady() {
+ return this.request.isTrailerFieldsReady();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletResponseWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletResponseWrapper.java
new file mode 100644
index 0000000000..d1f2475057
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpServletResponseWrapper.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.felix.http.jakartawrappers.CookieWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * Http servlet response wrapper
+*/
+public class HttpServletResponseWrapper extends ServletResponseWrapper
+ implements javax.servlet.http.HttpServletResponse {
+
+ private final HttpServletResponse response;
+
+ /**
+ * Create a new response
+ * @param r Wrapped response
+ */
+ public HttpServletResponseWrapper(@NotNull final HttpServletResponse r) {
+ super(r);
+ this.response = r;
+ }
+
+ @Override
+ public void addCookie(final javax.servlet.http.Cookie cookie) {
+ this.response.addCookie(new CookieWrapper(cookie));
+ }
+
+ @Override
+ public boolean containsHeader(final String name) {
+ return this.response.containsHeader(name);
+ }
+
+ @Override
+ public String encodeURL(final String url) {
+ return this.response.encodeURL(url);
+ }
+
+ @Override
+ public String encodeRedirectURL(final String url) {
+ return this.response.encodeRedirectURL(url);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String encodeUrl(final String url) {
+ return this.response.encodeUrl(url);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String encodeRedirectUrl(final String url) {
+ return this.response.encodeRedirectUrl(url);
+ }
+
+ @Override
+ public void sendError(final int sc, final String msg) throws IOException {
+ this.response.sendError(sc, msg);
+ }
+
+ @Override
+ public void sendError(final int sc) throws IOException {
+ this.response.sendError(sc);
+ }
+
+ @Override
+ public void sendRedirect(final String location) throws IOException {
+ this.response.sendRedirect(location);
+ }
+
+ @Override
+ public void setDateHeader(final String name, final long date) {
+ this.response.setDateHeader(name, date);
+ }
+
+ @Override
+ public void addDateHeader(final String name, final long date) {
+ this.response.addDateHeader(name, date);
+ }
+
+ @Override
+ public void setHeader(final String name, final String value) {
+ this.response.setHeader(name, value);
+ }
+
+ @Override
+ public void addHeader(final String name, final String value) {
+ this.response.addHeader(name, value);
+ }
+
+ @Override
+ public void setIntHeader(final String name, final int value) {
+ this.response.setIntHeader(name, value);
+ }
+
+ @Override
+ public void addIntHeader(final String name, final int value) {
+ this.response.addIntHeader(name, value);
+ }
+
+ @Override
+ public void setStatus(int sc) {
+ this.response.setStatus(sc);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setStatus(final int sc, final String sm) {
+ this.response.setStatus(sc, sm);
+ }
+
+ @Override
+ public int getStatus() {
+ return this.response.getStatus();
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.response.getHeader(name);
+ }
+
+ @Override
+ public Collection<String> getHeaders(final String name) {
+ return this.response.getHeaders(name);
+ }
+
+ @Override
+ public Collection<String> getHeaderNames() {
+ return this.response.getHeaderNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpSessionContextWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpSessionContextWrapper.java
new file mode 100644
index 0000000000..8ef38c7361
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpSessionContextWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpSessionContext;
+
+/**
+ * http session context wrapper
+ */
+@SuppressWarnings("deprecation")
+public class HttpSessionContextWrapper implements javax.servlet.http.HttpSessionContext {
+
+ private final HttpSessionContext context;
+
+ /**
+ * Create new context
+ * @param c Wrapped context
+ */
+ public HttpSessionContextWrapper(@NotNull final HttpSessionContext c) {
+ this.context = c;
+ }
+
+ @Override
+ public javax.servlet.http.HttpSession getSession(final String sessionId) {
+ final HttpSession session = context.getSession(sessionId);
+ if ( session != null ) {
+ return new HttpSessionWrapper(session);
+ }
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getIds() {
+ return context.getIds();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpSessionWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpSessionWrapper.java
new file mode 100644
index 0000000000..bf15be31f9
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/HttpSessionWrapper.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.HttpSession;
+
+/**
+ * Http session wrapper
+ */
+public class HttpSessionWrapper implements javax.servlet.http.HttpSession {
+
+ private final HttpSession session;
+
+ /**
+ * Create new session
+ * @param session Wrapped session
+ */
+ public HttpSessionWrapper(@NotNull final HttpSession session) {
+ this.session = session;
+ }
+
+
+ @Override
+ public long getCreationTime() {
+ return session.getCreationTime();
+ }
+
+ @Override
+ public String getId() {
+ return session.getId();
+ }
+
+ @Override
+ public long getLastAccessedTime() {
+ return session.getLastAccessedTime();
+ }
+
+ @Override
+ public javax.servlet.ServletContext getServletContext() {
+ return new ServletContextWrapper(session.getServletContext());
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int interval) {
+ session.setMaxInactiveInterval(interval);
+ }
+
+ @Override
+ public int getMaxInactiveInterval() {
+ return session.getMaxInactiveInterval();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public javax.servlet.http.HttpSessionContext getSessionContext() {
+ return new HttpSessionContextWrapper(session.getSessionContext());
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ return session.getAttribute(name);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Object getValue(String name) {
+ return session.getValue(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return session.getAttributeNames();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String[] getValueNames() {
+ return session.getValueNames();
+ }
+
+ @Override
+ public void setAttribute(String name, Object value) {
+ session.setAttribute(name, value);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void putValue(String name, Object value) {
+ session.putValue(name, value);
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ session.removeAttribute(name);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void removeValue(String name) {
+ session.removeValue(name);
+ }
+
+ @Override
+ public void invalidate() {
+ session.invalidate();
+ }
+
+ @Override
+ public boolean isNew() {
+ return session.isNew();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/PartWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/PartWrapper.java
new file mode 100644
index 0000000000..23daed2a0c
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/PartWrapper.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.Part;
+
+/**
+ * Part wrapper
+ */
+public class PartWrapper implements javax.servlet.http.Part {
+
+ private final Part part;
+
+ /**
+ * Create new part
+ * @param p Wrapped part
+ */
+ public PartWrapper(@NotNull final Part p) {
+ this.part = p;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return this.part.getInputStream();
+ }
+
+ @Override
+ public String getContentType() {
+ return this.part.getContentType();
+ }
+
+ @Override
+ public String getName() {
+ return this.part.getName();
+ }
+
+ @Override
+ public String getSubmittedFileName() {
+ return this.part.getSubmittedFileName();
+ }
+
+ @Override
+ public long getSize() {
+ return this.part.getSize();
+ }
+
+ @Override
+ public void write(String fileName) throws IOException {
+ this.part.write(fileName);
+ }
+
+ @Override
+ public void delete() throws IOException {
+ this.part.delete();
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.part.getHeader(name);
+ }
+
+ @Override
+ public Collection<String> getHeaders(final String name) {
+ return this.part.getHeaders(name);
+ }
+
+ @Override
+ public Collection<String> getHeaderNames() {
+ return this.part.getHeaderNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/PushBuilderWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/PushBuilderWrapper.java
new file mode 100644
index 0000000000..09ccf1d71a
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/PushBuilderWrapper.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.http.PushBuilder;
+
+/**
+ * Push builder wrapper
+ */
+public class PushBuilderWrapper implements javax.servlet.http.PushBuilder {
+
+ private final PushBuilder builder;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped builder
+ */
+ public PushBuilderWrapper(@NotNull final PushBuilder c) {
+ this.builder = c;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder method(final String method) {
+ this.builder.method(method);
+ return this;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder queryString(final String queryString) {
+ this.builder.queryString(queryString);
+ return this;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder sessionId(final String sessionId) {
+ this.builder.sessionId(sessionId);
+ return this;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder setHeader(final String name, final String value) {
+ this.builder.setHeader(name, value);
+ return this;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder addHeader(final String name, final String value) {
+ this.builder.addHeader(name, value);
+ return this;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder removeHeader(final String name) {
+ this.builder.removeHeader(name);
+ return this;
+ }
+
+ @Override
+ public javax.servlet.http.PushBuilder path(final String path) {
+ this.builder.path(path);
+ return this;
+ }
+
+ @Override
+ public void push() {
+ this.builder.push();
+ }
+
+ @Override
+ public String getMethod() {
+ return this.builder.getMethod();
+ }
+
+ @Override
+ public String getQueryString() {
+ return this.builder.getQueryString();
+ }
+
+ @Override
+ public String getSessionId() {
+ return this.builder.getSessionId();
+ }
+
+ @Override
+ public Set<String> getHeaderNames() {
+ return this.builder.getHeaderNames();
+ }
+
+ @Override
+ public String getHeader(final String name) {
+ return this.builder.getHeader(name);
+ }
+
+ @Override
+ public String getPath() {
+ return this.builder.getPath();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ReadListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ReadListenerWrapper.java
new file mode 100644
index 0000000000..bdd78cd0ac
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ReadListenerWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ReadListener;
+
+/**
+ * Read listener
+ */
+public class ReadListenerWrapper implements javax.servlet.ReadListener {
+
+ private final ReadListener listener;
+
+ /**
+ * Create new lister
+ * @param listener Wrapped listener
+ */
+ public ReadListenerWrapper(@NotNull final ReadListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void onDataAvailable() throws IOException {
+ listener.onDataAvailable();
+ }
+
+ @Override
+ public void onAllDataRead() throws IOException {
+ listener.onAllDataRead();
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ listener.onError(t);
+ }
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/RequestDispatcherWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/RequestDispatcherWrapper.java
new file mode 100644
index 0000000000..6fcf612575
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/RequestDispatcherWrapper.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletException;
+
+/**
+ * Dispatcher wrapper
+ */
+public class RequestDispatcherWrapper implements javax.servlet.RequestDispatcher {
+
+ private final RequestDispatcher dispatcher;
+
+ /**
+ * Create new dispatcher
+ * @param dispatcher Dispatcher
+ */
+ public RequestDispatcherWrapper(@NotNull RequestDispatcher dispatcher) {
+ this.dispatcher = dispatcher;
+ }
+
+ @Override
+ public void forward(final javax.servlet.ServletRequest request, final javax.servlet.ServletResponse response) throws javax.servlet.ServletException, IOException {
+ try {
+ dispatcher.forward(org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getWrapper(request),
+ org.apache.felix.http.jakartawrappers.ServletResponseWrapper.getWrapper(response));
+ } catch (final ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public void include(final javax.servlet.ServletRequest request, final javax.servlet.ServletResponse response) throws javax.servlet.ServletException, IOException {
+ try {
+ dispatcher.include(org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getWrapper(request),
+ org.apache.felix.http.jakartawrappers.ServletResponseWrapper.getWrapper(response));
+ } catch (final ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletConfigWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletConfigWrapper.java
new file mode 100644
index 0000000000..3a7c916caf
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletConfigWrapper.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Enumeration;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletConfig;
+
+/**
+ * Servlet config wrapper
+ */
+public class ServletConfigWrapper implements javax.servlet.ServletConfig {
+
+ private final ServletConfig config;
+
+ /**
+ * Create new servlet config
+ * @param config wrapped servlet config
+ */
+ public ServletConfigWrapper(@NotNull final ServletConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public String getServletName() {
+ return config.getServletName();
+ }
+
+ @Override
+ public javax.servlet.ServletContext getServletContext() {
+ return new ServletContextWrapper(config.getServletContext());
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return config.getInitParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getInitParameterNames() {
+ return config.getInitParameterNames();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletContextWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletContextWrapper.java
new file mode 100644
index 0000000000..8ce5e9957b
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletContextWrapper.java
@@ -0,0 +1,416 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.FilterRegistration;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletRegistration;
+import jakarta.servlet.SessionTrackingMode;
+
+/**
+ * Javax servlet context based on a jakarta servlet context
+ */
+public class ServletContextWrapper implements javax.servlet.ServletContext {
+
+ private final ServletContext context;
+
+ /**
+ * Create new context
+ * @param c Wrapped context
+ */
+ public ServletContextWrapper(@NotNull final ServletContext c) {
+ this.context = c;
+ }
+
+ @Override
+ public String getContextPath() {
+ return this.context.getContextPath();
+ }
+
+ @Override
+ public javax.servlet.ServletContext getContext(final String uripath) {
+ final ServletContext c = this.context.getContext(uripath);
+ if ( c != null ) {
+ return new ServletContextWrapper(c);
+ }
+ return null;
+ }
+
+ @Override
+ public int getMajorVersion() {
+ return this.context.getMajorVersion();
+ }
+
+ @Override
+ public int getMinorVersion() {
+ return this.context.getMinorVersion();
+ }
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ return this.context.getEffectiveMajorVersion();
+ }
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ return this.context.getEffectiveMinorVersion();
+ }
+
+ @Override
+ public String getMimeType(final String file) {
+ return this.context.getMimeType(file);
+ }
+
+ @Override
+ public Set<String> getResourcePaths(final String path) {
+ return this.context.getResourcePaths(path);
+ }
+
+ @Override
+ public URL getResource(final String path) throws MalformedURLException {
+ return this.context.getResource(path);
+ }
+
+ @Override
+ public InputStream getResourceAsStream(final String path) {
+ return this.context.getResourceAsStream(path);
+ }
+
+ @Override
+ public javax.servlet.RequestDispatcher getRequestDispatcher(final String path) {
+ final RequestDispatcher dispatcher = this.context.getRequestDispatcher(path);
+ if ( dispatcher != null ) {
+ return new RequestDispatcherWrapper(dispatcher);
+ }
+ return null;
+
+ }
+
+ @Override
+ public javax.servlet.RequestDispatcher getNamedDispatcher(final String name) {
+ final RequestDispatcher dispatcher = this.context.getNamedDispatcher(name);
+ if ( dispatcher != null ) {
+ return new RequestDispatcherWrapper(dispatcher);
+ }
+ return null;
+ }
+
+ @Override
+ public javax.servlet.Servlet getServlet(final String name) throws javax.servlet.ServletException {
+ return null;
+ }
+
+ @Override
+ public Enumeration<javax.servlet.Servlet> getServlets() {
+ return Collections.emptyEnumeration();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Enumeration<String> getServletNames() {
+ return this.context.getServletNames();
+ }
+
+ @Override
+ public void log(final String msg) {
+ this.context.log(msg);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void log(final Exception exception, final String msg) {
+ this.context.log(exception, msg);
+ }
+
+ @Override
+ public void log(final String message, final Throwable throwable) {
+ this.context.log(message, throwable);
+ }
+
+ @Override
+ public String getRealPath(final String path) {
+ return this.context.getRealPath(path);
+ }
+
+ @Override
+ public String getServerInfo() {
+ return this.context.getServerInfo();
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return this.context.getInitParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getInitParameterNames() {
+ return this.context.getInitParameterNames();
+ }
+
+ @Override
+ public boolean setInitParameter(final String name, final String value) {
+ return this.context.setInitParameter(name, value);
+ }
+
+ @Override
+ public Object getAttribute(final String name) {
+ return this.context.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return this.context.getAttributeNames();
+ }
+
+ @Override
+ public void setAttribute(final String name, final Object object) {
+ this.context.setAttribute(name, object);
+ }
+
+ @Override
+ public void removeAttribute(final String name) {
+ this.context.removeAttribute(name);
+ }
+
+ @Override
+ public String getServletContextName() {
+ return this.context.getServletContextName();
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addServlet(final String servletName, final String className) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addServlet(final String servletName, final javax.servlet.Servlet servlet) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addServlet(final String servletName, final Class<? extends javax.servlet.Servlet> servletClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends javax.servlet.Servlet> T createServlet(final Class<T> clazz) throws javax.servlet.ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration getServletRegistration(final String servletName) {
+ final ServletRegistration reg = this.context.getServletRegistration(servletName);
+ if ( reg != null ) {
+ return new ServletRegistrationWrapper(reg);
+ }
+ return null;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Map<String, ? extends javax.servlet.ServletRegistration> getServletRegistrations() {
+ final Map result = new HashMap<>();
+ for(final Map.Entry<String, ? extends ServletRegistration> e : this.context.getServletRegistrations().entrySet()) {
+ result.put(e.getKey(), new ServletRegistrationWrapper(e.getValue()));
+ }
+ return result;
+ }
+
+ @Override
+ public javax.servlet.FilterRegistration.Dynamic addFilter(final String filterName, final String className) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.FilterRegistration.Dynamic addFilter(final String filterName, final javax.servlet.Filter filter) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.FilterRegistration.Dynamic addFilter(final String filterName, final Class<? extends javax.servlet.Filter> filterClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends javax.servlet.Filter> T createFilter(final Class<T> clazz) throws javax.servlet.ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.FilterRegistration getFilterRegistration(final String filterName) {
+ final FilterRegistration reg = this.context.getFilterRegistration(filterName);
+ if ( reg != null ) {
+ return new FilterRegistrationWrapper(reg);
+ }
+ return null;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Map<String, ? extends javax.servlet.FilterRegistration> getFilterRegistrations() {
+ final Map result = new HashMap<>();
+ for(final Map.Entry<String, ? extends FilterRegistration> e : this.context.getFilterRegistrations().entrySet()) {
+ result.put(e.getKey(), new FilterRegistrationWrapper(e.getValue()));
+ }
+ return result;
+ }
+
+ @Override
+ public javax.servlet.SessionCookieConfig getSessionCookieConfig() {
+ return new SessionCookieConfigWrapper(this.context.getSessionCookieConfig());
+ }
+
+ @Override
+ public void setSessionTrackingModes(final Set<javax.servlet.SessionTrackingMode> sessionTrackingModes) {
+ if ( sessionTrackingModes == null ) {
+ this.context.setSessionTrackingModes(null);
+ } else {
+ final Set<SessionTrackingMode> modes = new HashSet<>();
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.COOKIE)) {
+ modes.add(SessionTrackingMode.COOKIE);
+ }
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.SSL)) {
+ modes.add(SessionTrackingMode.SSL);
+ }
+ if ( sessionTrackingModes.contains(javax.servlet.SessionTrackingMode.URL)) {
+ modes.add(SessionTrackingMode.URL);
+ }
+ this.context.setSessionTrackingModes(modes);
+ }
+ }
+
+ @Override
+ public Set<javax.servlet.SessionTrackingMode> getDefaultSessionTrackingModes() {
+ final Set<SessionTrackingMode> sessionTrackingModes = this.context.getDefaultSessionTrackingModes();
+ final Set<javax.servlet.SessionTrackingMode> modes = new HashSet<>();
+ if ( sessionTrackingModes.contains(SessionTrackingMode.COOKIE)) {
+ modes.add(javax.servlet.SessionTrackingMode.COOKIE);
+ }
+ if ( sessionTrackingModes.contains(SessionTrackingMode.SSL)) {
+ modes.add(javax.servlet.SessionTrackingMode.SSL);
+ }
+ if ( sessionTrackingModes.contains(SessionTrackingMode.URL)) {
+ modes.add(javax.servlet.SessionTrackingMode.URL);
+ }
+ return modes;
+ }
+
+ @Override
+ public Set<javax.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ final Set<SessionTrackingMode> sessionTrackingModes = this.context.getEffectiveSessionTrackingModes();
+ final Set<javax.servlet.SessionTrackingMode> modes = new HashSet<>();
+ if ( sessionTrackingModes.contains(SessionTrackingMode.COOKIE)) {
+ modes.add(javax.servlet.SessionTrackingMode.COOKIE);
+ }
+ if ( sessionTrackingModes.contains(SessionTrackingMode.SSL)) {
+ modes.add(javax.servlet.SessionTrackingMode.SSL);
+ }
+ if ( sessionTrackingModes.contains(SessionTrackingMode.URL)) {
+ modes.add(javax.servlet.SessionTrackingMode.URL);
+ }
+ return modes;
+ }
+
+ @Override
+ public void addListener(String className) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends EventListener> void addListener(final T t) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addListener(final Class<? extends EventListener> listenerClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends EventListener> T createListener(final Class<T> clazz) throws javax.servlet.ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public javax.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor() {
+ return null;
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return this.context.getClassLoader();
+ }
+
+ @Override
+ public void declareRoles(final String... roleNames) {
+ this.context.declareRoles(roleNames);
+ }
+
+ @Override
+ public String getVirtualServerName() {
+ return this.context.getVirtualServerName();
+ }
+
+ @Override
+ public javax.servlet.ServletRegistration.Dynamic addJspFile(final String servletName, final String jspFile) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getSessionTimeout() {
+ return this.context.getSessionTimeout();
+ }
+
+ @Override
+ public void setSessionTimeout(int sessionTimeout) {
+ this.context.setSessionTimeout(sessionTimeout);
+ }
+
+ @Override
+ public String getRequestCharacterEncoding() {
+ return this.context.getRequestCharacterEncoding();
+ }
+
+ @Override
+ public void setRequestCharacterEncoding(final String encoding) {
+ this.context.setRequestCharacterEncoding(encoding);
+ }
+
+ @Override
+ public String getResponseCharacterEncoding() {
+ return this.context.getResponseCharacterEncoding();
+ }
+
+ @Override
+ public void setResponseCharacterEncoding(final String encoding) {
+ this.context.setResponseCharacterEncoding(encoding);
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletExceptionUtil.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletExceptionUtil.java
new file mode 100644
index 0000000000..9b9e4604e4
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletExceptionUtil.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletException;
+
+/**
+ * Helper class to wrap servlet exceptions
+ */
+public class ServletExceptionUtil {
+
+ /**
+ * Get javax servlet exception
+ * @param e Jakarta exception
+ * @return The exception
+ */
+ public static javax.servlet.ServletException getServletException(@NotNull final ServletException e) {
+ if ( e instanceof org.apache.felix.http.jakartawrappers.ServletExceptionWrapper) {
+ return ((org.apache.felix.http.jakartawrappers.ServletExceptionWrapper)e).getException();
+ }
+ return new ServletExceptionWrapper(e);
+ }
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletExceptionWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletExceptionWrapper.java
new file mode 100644
index 0000000000..bf2478bc1f
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletExceptionWrapper.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletException;
+
+/**
+ * Wrapper for servlet exception
+ */
+public class ServletExceptionWrapper extends javax.servlet.ServletException {
+
+ private static final long serialVersionUID = 1L;
+
+ private final ServletException exception;
+
+ /**
+ * Create new wrapepr exception
+ * @param e Original exception
+ */
+ public ServletExceptionWrapper(@NotNull final ServletException e) {
+ this.exception = e;
+ }
+
+ /**
+ * Get the original exception
+ * @return The original exception
+ */
+ @NotNull public ServletException getException() {
+ return this.exception;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletInputStreamWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletInputStreamWrapper.java
new file mode 100644
index 0000000000..36de96bb10
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletInputStreamWrapper.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.felix.http.jakartawrappers.ReadListenerWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletInputStream;
+
+/**
+ * Servlet input stream wrapper
+ */
+public class ServletInputStreamWrapper extends javax.servlet.ServletInputStream {
+
+ private final ServletInputStream stream;
+
+ /**
+ * Create input stream
+ * @param stream Wrapped stream
+ */
+ public ServletInputStreamWrapper(@NotNull final ServletInputStream stream) {
+ this.stream = stream;
+ }
+
+ @Override
+ public int readLine(final byte[] b, final int off, final int len) throws IOException {
+ return this.stream.readLine(b, off, len);
+ }
+
+ @Override
+ public boolean isFinished() {
+ return this.stream.isFinished();
+ }
+
+ @Override
+ public boolean isReady() {
+ return this.stream.isReady();
+ }
+
+ @Override
+ public void setReadListener(final javax.servlet.ReadListener readListener) {
+ this.stream.setReadListener(new ReadListenerWrapper(readListener));
+ }
+
+ @Override
+ public int read() throws IOException {
+ return this.stream.read();
+ }
+
+ @Override
+ public int read(final byte[] b) throws IOException {
+ return this.stream.read(b);
+ }
+
+ @Override
+ public int read(final byte[] b, final int off, final int len) throws IOException {
+ return this.stream.read(b, off, len);
+ }
+
+ @Override
+ public byte[] readAllBytes() throws IOException {
+ return this.stream.readAllBytes();
+ }
+
+ @Override
+ public byte[] readNBytes(final int len) throws IOException {
+ return this.stream.readNBytes(len);
+ }
+
+ @Override
+ public int readNBytes(final byte[] b, final int off, final int len) throws IOException {
+ return this.stream.readNBytes(b, off, len);
+ }
+
+ @Override
+ public long skip(final long n) throws IOException {
+ return this.stream.skip(n);
+ }
+
+ @Override
+ public int available() throws IOException {
+ return this.stream.available();
+ }
+
+ @Override
+ public void close() throws IOException {
+ this.stream.close();
+ }
+
+ @Override
+ public synchronized void mark(final int readlimit) {
+ this.stream.mark(readlimit);
+ }
+
+ @Override
+ public synchronized void reset() throws IOException {
+ this.stream.reset();
+ }
+
+ @Override
+ public boolean markSupported() {
+ return this.stream.markSupported();
+ }
+
+ @Override
+ public long transferTo(final OutputStream out) throws IOException {
+ return this.stream.transferTo(out);
+ }
+
+
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletOutputStreamWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletOutputStreamWrapper.java
new file mode 100644
index 0000000000..0e91e34c8e
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletOutputStreamWrapper.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.apache.felix.http.jakartawrappers.WriteListenerWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletOutputStream;
+
+/**
+ * Servlet output stream
+ */
+public class ServletOutputStreamWrapper extends javax.servlet.ServletOutputStream {
+
+ private final ServletOutputStream stream;
+
+ /**
+ * Create new stream
+ * @param stream wrapped stream
+ */
+ public ServletOutputStreamWrapper(@NotNull final ServletOutputStream stream) {
+ this.stream = stream;
+ }
+
+ @Override
+ public void print(final String s) throws IOException {
+ this.stream.print(s);
+ }
+
+ @Override
+ public void print(final boolean b) throws IOException {
+ this.stream.print(b);
+ }
+
+ @Override
+ public void print(final char c) throws IOException {
+ this.stream.print(c);
+ }
+
+ @Override
+ public void print(final int i) throws IOException {
+ this.stream.print(i);
+ }
+
+ @Override
+ public void print(final long l) throws IOException {
+ this.stream.print(l);
+ }
+
+ @Override
+ public void print(final float f) throws IOException {
+ this.stream.print(f);
+ }
+
+ @Override
+ public void print(final double d) throws IOException {
+ this.stream.print(d);
+ }
+
+ @Override
+ public void println() throws IOException {
+ this.stream.println();
+ }
+
+ @Override
+ public void println(final String s) throws IOException {
+ this.stream.println(s);
+ }
+
+ @Override
+ public void println(final boolean b) throws IOException {
+ this.stream.println(b);
+ }
+
+ @Override
+ public void println(final char c) throws IOException {
+ this.stream.println(c);
+ }
+
+ @Override
+ public void println(final int i) throws IOException {
+ this.stream.println(i);
+ }
+
+ @Override
+ public void println(final long l) throws IOException {
+ this.stream.println(l);
+ }
+
+ @Override
+ public void println(final float f) throws IOException {
+ this.stream.println(f);
+ }
+
+ @Override
+ public void println(final double d) throws IOException {
+ this.stream.println(d);
+ }
+
+ @Override
+ public boolean isReady() {
+ return this.stream.isReady();
+ }
+
+ @Override
+ public void setWriteListener(final javax.servlet.WriteListener writeListener) {
+ this.stream.setWriteListener(new WriteListenerWrapper(writeListener));
+ }
+
+ @Override
+ public void write(final int b) throws IOException {
+ this.stream.write(b);
+ }
+
+ @Override
+ public void write(final byte[] b) throws IOException {
+ this.stream.write(b);
+ }
+
+ @Override
+ public void write(final byte[] b, final int off, final int len) throws IOException {
+ this.stream.write(b, off, len);
+ }
+
+ @Override
+ public void flush() throws IOException {
+ this.stream.flush();
+ }
+
+ @Override
+ public void close() throws IOException {
+ this.stream.close();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletRegistrationWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletRegistrationWrapper.java
new file mode 100644
index 0000000000..ff1496b8d0
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletRegistrationWrapper.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletRegistration;
+
+/**
+ * servlet registration wrapper
+ */
+public class ServletRegistrationWrapper implements javax.servlet.ServletRegistration {
+
+ private final ServletRegistration reg;
+
+ /**
+ * Create new wrapper
+ * @param c Wrapped registration
+ */
+ public ServletRegistrationWrapper(@NotNull final ServletRegistration c) {
+ this.reg = c;
+ }
+
+ @Override
+ public Set<String> addMapping(final String... urlPatterns) {
+ return reg.addMapping(urlPatterns);
+ }
+
+ @Override
+ public String getName() {
+ return reg.getName();
+ }
+
+ @Override
+ public Collection<String> getMappings() {
+ return reg.getMappings();
+ }
+
+ @Override
+ public String getClassName() {
+ return reg.getClassName();
+ }
+
+ @Override
+ public boolean setInitParameter(final String name, final String value) {
+ return reg.setInitParameter(name, value);
+ }
+
+ @Override
+ public String getRunAsRole() {
+ return reg.getRunAsRole();
+ }
+
+ @Override
+ public String getInitParameter(final String name) {
+ return reg.getInitParameter(name);
+ }
+
+ @Override
+ public Set<String> setInitParameters(final Map<String, String> initParameters) {
+ return reg.setInitParameters(initParameters);
+ }
+
+ @Override
+ public Map<String, String> getInitParameters() {
+ return reg.getInitParameters();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletRequestWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletRequestWrapper.java
new file mode 100644
index 0000000000..70030206bd
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletRequestWrapper.java
@@ -0,0 +1,417 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import static jakarta.servlet.AsyncContext.ASYNC_CONTEXT_PATH;
+import static jakarta.servlet.AsyncContext.ASYNC_MAPPING;
+import static jakarta.servlet.AsyncContext.ASYNC_PATH_INFO;
+import static jakarta.servlet.AsyncContext.ASYNC_QUERY_STRING;
+import static jakarta.servlet.AsyncContext.ASYNC_REQUEST_URI;
+import static jakarta.servlet.AsyncContext.ASYNC_SERVLET_PATH;
+import static jakarta.servlet.RequestDispatcher.ERROR_EXCEPTION;
+import static jakarta.servlet.RequestDispatcher.ERROR_EXCEPTION_TYPE;
+import static jakarta.servlet.RequestDispatcher.ERROR_MESSAGE;
+import static jakarta.servlet.RequestDispatcher.ERROR_REQUEST_URI;
+import static jakarta.servlet.RequestDispatcher.ERROR_SERVLET_NAME;
+import static jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE;
+import static jakarta.servlet.RequestDispatcher.FORWARD_CONTEXT_PATH;
+import static jakarta.servlet.RequestDispatcher.FORWARD_MAPPING;
+import static jakarta.servlet.RequestDispatcher.FORWARD_PATH_INFO;
+import static jakarta.servlet.RequestDispatcher.FORWARD_QUERY_STRING;
+import static jakarta.servlet.RequestDispatcher.FORWARD_REQUEST_URI;
+import static jakarta.servlet.RequestDispatcher.FORWARD_SERVLET_PATH;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_CONTEXT_PATH;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_MAPPING;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_PATH_INFO;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_QUERY_STRING;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_REQUEST_URI;
+import static jakarta.servlet.RequestDispatcher.INCLUDE_SERVLET_PATH;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.felix.http.jakartawrappers.ServletResponseWrapper;
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.http.HttpServletMapping;
+import jakarta.servlet.http.HttpServletRequest;
+
+/**
+ * Servlet request wrapper
+ */
+public class ServletRequestWrapper implements javax.servlet.ServletRequest {
+
+ private final ServletRequest request;
+
+ /**
+ * Get the wrapper
+ * @param r The request
+ * @return The wrapped request
+ */
+ public static javax.servlet.ServletRequest getWrapper(final ServletRequest r) {
+ if ( r instanceof org.apache.felix.http.jakartawrappers.ServletRequestWrapper) {
+ return ((org.apache.felix.http.jakartawrappers.ServletRequestWrapper)r).getRequest();
+ }
+ if ( r instanceof HttpServletRequest ) {
+ return new HttpServletRequestWrapper((HttpServletRequest)r);
+ }
+ return new ServletRequestWrapper(r);
+ }
+
+ /**
+ * Create a wrapper
+ * @param r The wrapped request
+ */
+ public ServletRequestWrapper(@NotNull final ServletRequest r) {
+ this.request = r;
+ }
+
+ /**
+ * Get the request
+ * @return The request
+ */
+ public ServletRequest getRequest() {
+ return this.request;
+ }
+
+ private Object wrapHttpServletMapping(final Object value) {
+ if ( value instanceof org.apache.felix.http.jakartawrappers.HttpServletMappingWrapper ) {
+ return ((org.apache.felix.http.jakartawrappers.HttpServletMappingWrapper)value).getMapping();
+ }
+ if ( value instanceof HttpServletMapping ) {
+ return new HttpServletMappingWrapper((HttpServletMapping)value);
+ }
+ return value;
+ }
+
+ public static String getTranslatedAttributeName(final String name) {
+ if ( javax.servlet.RequestDispatcher.FORWARD_CONTEXT_PATH.equals(name) ) {
+ return FORWARD_CONTEXT_PATH;
+
+ } else if ( javax.servlet.RequestDispatcher.FORWARD_MAPPING.equals(name) ) {
+ return FORWARD_MAPPING;
+
+ } else if ( javax.servlet.RequestDispatcher.FORWARD_PATH_INFO.equals(name) ) {
+ return FORWARD_PATH_INFO;
+
+ } else if ( javax.servlet.RequestDispatcher.FORWARD_QUERY_STRING.equals(name) ) {
+ return FORWARD_QUERY_STRING;
+
+ } else if ( javax.servlet.RequestDispatcher.FORWARD_REQUEST_URI.equals(name) ) {
+ return FORWARD_REQUEST_URI;
+
+ } else if ( javax.servlet.RequestDispatcher.FORWARD_SERVLET_PATH.equals(name) ) {
+ return FORWARD_SERVLET_PATH;
+
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_CONTEXT_PATH.equals(name) ) {
+ return INCLUDE_CONTEXT_PATH;
+
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_MAPPING.equals(name) ) {
+ return INCLUDE_MAPPING;
+
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_PATH_INFO.equals(name) ) {
+ return INCLUDE_PATH_INFO;
+
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_QUERY_STRING.equals(name) ) {
+ return INCLUDE_QUERY_STRING;
+
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_REQUEST_URI.equals(name) ) {
+ return INCLUDE_REQUEST_URI;
+
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_SERVLET_PATH.equals(name) ) {
+ return INCLUDE_SERVLET_PATH;
+
+ } else if ( javax.servlet.RequestDispatcher.ERROR_EXCEPTION.equals(name) ) {
+ return ERROR_EXCEPTION;
+
+ } else if ( javax.servlet.RequestDispatcher.ERROR_EXCEPTION_TYPE.equals(name) ) {
+ return ERROR_EXCEPTION_TYPE;
+
+ } else if ( javax.servlet.RequestDispatcher.ERROR_MESSAGE.equals(name) ) {
+ return ERROR_MESSAGE;
+
+ } else if ( javax.servlet.RequestDispatcher.ERROR_REQUEST_URI.equals(name) ) {
+ return ERROR_REQUEST_URI;
+
+ } else if ( javax.servlet.RequestDispatcher.ERROR_SERVLET_NAME.equals(name) ) {
+ return ERROR_SERVLET_NAME;
+
+ } else if ( javax.servlet.RequestDispatcher.ERROR_STATUS_CODE.equals(name) ) {
+ return ERROR_STATUS_CODE;
+
+ } else if ( javax.servlet.AsyncContext.ASYNC_CONTEXT_PATH.equals(name) ) {
+ return ASYNC_CONTEXT_PATH;
+
+ } else if ( javax.servlet.AsyncContext.ASYNC_MAPPING.equals(name) ) {
+ return ASYNC_MAPPING;
+
+ } else if ( javax.servlet.AsyncContext.ASYNC_PATH_INFO.equals(name) ) {
+ return ASYNC_PATH_INFO;
+
+ } else if ( javax.servlet.AsyncContext.ASYNC_QUERY_STRING.equals(name) ) {
+ return ASYNC_QUERY_STRING;
+
+ } else if ( javax.servlet.AsyncContext.ASYNC_REQUEST_URI.equals(name) ) {
+ return ASYNC_REQUEST_URI;
+
+ } else if ( javax.servlet.AsyncContext.ASYNC_SERVLET_PATH.equals(name) ) {
+ return ASYNC_SERVLET_PATH;
+ }
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(final String name) {
+ final String translatedName = getTranslatedAttributeName(name);
+ if ( translatedName != null ) {
+ final Object value = this.request.getAttribute(translatedName);
+ if ( javax.servlet.RequestDispatcher.FORWARD_MAPPING.equals(name) ) {
+ return wrapHttpServletMapping(value);
+ } else if ( javax.servlet.RequestDispatcher.INCLUDE_MAPPING.equals(name) ) {
+ return wrapHttpServletMapping(value);
+ } else if ( javax.servlet.AsyncContext.ASYNC_MAPPING.equals(name) ) {
+ return wrapHttpServletMapping(value);
+ }
+ return value;
+ }
+ return this.request.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ final List<String> names = Collections.list(this.request.getAttributeNames());
+ final List<String> translatedNames = new ArrayList<>();
+ for(final String name : names) {
+ final String translatedName = org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getTranslatedAttributeName(name);
+ if ( translatedName != null ) {
+ translatedNames.add(translatedName);
+ } else {
+ translatedNames.add(name);
+ }
+ }
+ return Collections.enumeration(translatedNames);
+
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return this.request.getCharacterEncoding();
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
+ this.request.setCharacterEncoding(env);
+ }
+
+ @Override
+ public int getContentLength() {
+ return this.request.getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong() {
+ return this.request.getContentLengthLong();
+ }
+
+ @Override
+ public String getContentType() {
+ return this.request.getContentType();
+ }
+
+ @Override
+ public javax.servlet.ServletInputStream getInputStream() throws IOException {
+ return new ServletInputStreamWrapper(this.request.getInputStream());
+ }
+
+ @Override
+ public String getParameter(String name) {
+ return this.request.getParameter(name);
+ }
+
+ @Override
+ public Enumeration<String> getParameterNames() {
+ return this.request.getParameterNames();
+ }
+
+ @Override
+ public String[] getParameterValues(final String name) {
+ return this.request.getParameterValues(name);
+ }
+
+ @Override
+ public Map<String, String[]> getParameterMap() {
+ return this.request.getParameterMap();
+ }
+
+ @Override
+ public String getProtocol() {
+ return this.request.getProtocol();
+ }
+
+ @Override
+ public String getScheme() {
+ return this.request.getScheme();
+ }
+
+ @Override
+ public String getServerName() {
+ return this.request.getServerName();
+ }
+
+ @Override
+ public int getServerPort() {
+ return this.request.getServerPort();
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException {
+ return this.request.getReader();
+ }
+
+ @Override
+ public String getRemoteAddr() {
+ return this.request.getRemoteAddr();
+ }
+
+ @Override
+ public String getRemoteHost() {
+ return this.request.getRemoteHost();
+ }
+
+ @Override
+ public void setAttribute(final String name, final Object o) {
+ final String translatedName = getTranslatedAttributeName(name);
+ if (translatedName != null) {
+ this.request.setAttribute(translatedName, o);
+ this.request.removeAttribute(name);
+ } else {
+ this.request.setAttribute(name, o);
+ }
+ }
+
+ @Override
+ public void removeAttribute(final String name) {
+ final String translatedName = getTranslatedAttributeName(name);
+ this.request.removeAttribute(name);
+ if (translatedName != null) {
+ this.request.removeAttribute(translatedName);
+ }
+ }
+
+ @Override
+ public Locale getLocale() {
+ return this.request.getLocale();
+ }
+
+ @Override
+ public Enumeration<Locale> getLocales() {
+ return this.request.getLocales();
+ }
+
+ @Override
+ public boolean isSecure() {
+ return this.request.isSecure();
+ }
+
+ @Override
+ public javax.servlet.RequestDispatcher getRequestDispatcher(final String path) {
+ final RequestDispatcher dispatcher = this.request.getRequestDispatcher(path);
+ if ( dispatcher != null ) {
+ return new RequestDispatcherWrapper(dispatcher);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public String getRealPath(final String path) {
+ return this.request.getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort() {
+ return this.request.getRemotePort();
+ }
+
+ @Override
+ public String getLocalName() {
+ return this.request.getLocalName();
+ }
+
+ @Override
+ public String getLocalAddr() {
+ return this.request.getLocalAddr();
+ }
+
+ @Override
+ public int getLocalPort() {
+ return this.request.getLocalPort();
+ }
+
+ @Override
+ public javax.servlet.ServletContext getServletContext() {
+ return new ServletContextWrapper(this.request.getServletContext());
+ }
+
+ @Override
+ public javax.servlet.AsyncContext startAsync() throws IllegalStateException {
+ return new AsyncContextWrapper(this.request.startAsync());
+ }
+
+ @Override
+ public javax.servlet.AsyncContext startAsync(final javax.servlet.ServletRequest servletRequest, final javax.servlet.ServletResponse servletResponse)
+ throws IllegalStateException {
+ return new AsyncContextWrapper(this.request.startAsync(org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getWrapper(servletRequest),
+ ServletResponseWrapper.getWrapper(servletResponse)));
+ }
+
+ @Override
+ public boolean isAsyncStarted() {
+ return this.request.isAsyncStarted();
+ }
+
+ @Override
+ public boolean isAsyncSupported() {
+ return this.request.isAsyncSupported();
+ }
+
+ @Override
+ public javax.servlet.AsyncContext getAsyncContext() {
+ return new AsyncContextWrapper(this.request.getAsyncContext());
+ }
+
+ @Override
+ public javax.servlet.DispatcherType getDispatcherType() {
+ switch (this.request.getDispatcherType()) {
+ case ASYNC : return javax.servlet.DispatcherType.ASYNC;
+ case ERROR : return javax.servlet.DispatcherType.ERROR;
+ case FORWARD : return javax.servlet.DispatcherType.FORWARD;
+ case INCLUDE : return javax.servlet.DispatcherType.INCLUDE;
+ case REQUEST : return javax.servlet.DispatcherType.REQUEST;
+ }
+ return null;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletResponseWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletResponseWrapper.java
new file mode 100644
index 0000000000..0caf362c0b
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletResponseWrapper.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet response wrapper
+ */
+public class ServletResponseWrapper implements javax.servlet.ServletResponse {
+
+ private final ServletResponse response;
+
+ /**
+ * Get a wrapper
+ * @param r Response
+ * @return Wrapped response
+ */
+ public static javax.servlet.ServletResponse getWrapper(final ServletResponse r) {
+ if ( r instanceof org.apache.felix.http.jakartawrappers.ServletResponseWrapper) {
+ return ((org.apache.felix.http.jakartawrappers.ServletResponseWrapper)r).getResponse();
+ }
+ if ( r instanceof HttpServletResponse ) {
+ return new HttpServletResponseWrapper((HttpServletResponse)r);
+ }
+ return new ServletResponseWrapper(r);
+ }
+
+ /**
+ * Create new response
+ * @param r Wrapped response
+ */
+ public ServletResponseWrapper(@NotNull final ServletResponse r) {
+ this.response = r;
+ }
+
+ /**
+ * Get the wrapped response
+ * @return The response
+ */
+ public ServletResponse getResponse() {
+ return this.response;
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return this.response.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType() {
+ return this.response.getContentType();
+ }
+
+ @Override
+ public javax.servlet.ServletOutputStream getOutputStream() throws IOException {
+ return new ServletOutputStreamWrapper(this.response.getOutputStream());
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException {
+ return this.response.getWriter();
+ }
+
+ @Override
+ public void setCharacterEncoding(final String charset) {
+ this.response.setCharacterEncoding(charset);
+ }
+
+ @Override
+ public void setContentLength(final int len) {
+ this.response.setContentLength(len);
+ }
+
+ @Override
+ public void setContentLengthLong(final long len) {
+ this.response.setContentLengthLong(len);
+ }
+
+ @Override
+ public void setContentType(final String type) {
+ this.response.setContentType(type);
+ }
+
+ @Override
+ public void setBufferSize(final int size) {
+ this.response.setBufferSize(size);
+ }
+
+ @Override
+ public int getBufferSize() {
+ return this.response.getBufferSize();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException {
+ this.response.flushBuffer();
+ }
+
+ @Override
+ public void resetBuffer() {
+ this.response.resetBuffer();
+ }
+
+ @Override
+ public boolean isCommitted() {
+ return this.response.isCommitted();
+ }
+
+ @Override
+ public void reset() {
+ this.response.reset();
+ }
+
+ @Override
+ public void setLocale(final Locale loc) {
+ this.response.setLocale(loc);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return this.response.getLocale();
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletWrapper.java
new file mode 100644
index 0000000000..f5f878e151
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/ServletWrapper.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletException;
+
+/**
+ * Servlet wrapper
+ */
+public class ServletWrapper implements javax.servlet.Servlet {
+
+ private final Servlet servlet;
+
+ /**
+ * Create new servlet
+ * @param servlet wrapped servlet
+ */
+ public ServletWrapper(@NotNull final Servlet servlet) {
+ this.servlet = servlet;
+ }
+
+ @Override
+ public void init(final javax.servlet.ServletConfig config) throws javax.servlet.ServletException {
+ try {
+ servlet.init(new org.apache.felix.http.jakartawrappers.ServletConfigWrapper(config));
+ } catch (final ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public javax.servlet.ServletConfig getServletConfig() {
+ return new ServletConfigWrapper(servlet.getServletConfig());
+ }
+
+ @Override
+ public void service(final javax.servlet.ServletRequest req, final javax.servlet.ServletResponse res)
+ throws javax.servlet.ServletException, IOException {
+ try {
+ servlet.service(org.apache.felix.http.jakartawrappers.ServletRequestWrapper.getWrapper(req),
+ org.apache.felix.http.jakartawrappers.ServletResponseWrapper.getWrapper(res));
+ } catch (final ServletException e) {
+ throw ServletExceptionUtil.getServletException(e);
+ }
+ }
+
+ @Override
+ public String getServletInfo() {
+ return servlet.getServletInfo();
+ }
+
+ @Override
+ public void destroy() {
+ servlet.destroy();
+ }
+
+ /**
+ * Get the wrapped servlet
+ * @return The servlet
+ */
+ public @NotNull Servlet getServlet() {
+ return this.servlet;
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/SessionCookieConfigWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/SessionCookieConfigWrapper.java
new file mode 100644
index 0000000000..e8a8ab3419
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/SessionCookieConfigWrapper.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.SessionCookieConfig;
+
+/**
+ * Session cookie config wrapper
+ */
+public class SessionCookieConfigWrapper implements javax.servlet.SessionCookieConfig {
+
+ private final SessionCookieConfig config;
+
+ /**
+ * Create new config
+ * @param c Wrapped config
+ */
+ public SessionCookieConfigWrapper(@NotNull final SessionCookieConfig c) {
+ this.config = c;
+ }
+
+ @Override
+ public void setName(final String name) {
+ config.setName(name);
+ }
+
+ @Override
+ public String getName() {
+ return config.getName();
+ }
+
+ @Override
+ public void setDomain(final String domain) {
+ config.setDomain(domain);
+ }
+
+ @Override
+ public String getDomain() {
+ return config.getDomain();
+ }
+
+ @Override
+ public void setPath(final String path) {
+ config.setPath(path);
+ }
+
+ @Override
+ public String getPath() {
+ return config.getPath();
+ }
+
+ @Override
+ public void setComment(final String comment) {
+ config.setComment(comment);
+ }
+
+ @Override
+ public String getComment() {
+ return config.getComment();
+ }
+
+ @Override
+ public void setHttpOnly(final boolean httpOnly) {
+ config.setHttpOnly(httpOnly);
+ }
+
+ @Override
+ public boolean isHttpOnly() {
+ return config.isHttpOnly();
+ }
+
+ @Override
+ public void setSecure(final boolean secure) {
+ config.setSecure(secure);
+ }
+
+ @Override
+ public boolean isSecure() {
+ return config.isSecure();
+ }
+
+ @Override
+ public void setMaxAge(final int maxAge) {
+ config.setMaxAge(maxAge);
+ }
+
+ @Override
+ public int getMaxAge() {
+ return config.getMaxAge();
+ }
+}
\ No newline at end of file
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/WriteListenerWrapper.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/WriteListenerWrapper.java
new file mode 100644
index 0000000000..a92fe04620
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/WriteListenerWrapper.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import java.io.IOException;
+
+import org.jetbrains.annotations.NotNull;
+
+import jakarta.servlet.WriteListener;
+
+/**
+ * Write listener
+ */
+public class WriteListenerWrapper implements javax.servlet.WriteListener {
+
+ private final WriteListener listener;
+
+ /**
+ * Create new lister
+ * @param listener Wrapped listener
+ */
+ public WriteListenerWrapper(@NotNull final WriteListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void onWritePossible() throws IOException {
+ listener.onWritePossible();
+ }
+
+ @Override
+ public void onError(final Throwable t) {
+ listener.onError(t);
+ }
+}
diff --git a/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/package-info.java b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/package-info.java
new file mode 100644
index 0000000000..a940469af4
--- /dev/null
+++ b/http/wrappers-1.0.x/src/main/java/org/apache/felix/http/javaxwrappers/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+@org.osgi.annotation.versioning.Version("1.0.2")
+package org.apache.felix.http.javaxwrappers;
+
diff --git a/http/wrappers-1.0.x/src/test/java/org/apache/felix/http/jakartawrappers/ServletRequestTest.java b/http/wrappers-1.0.x/src/test/java/org/apache/felix/http/jakartawrappers/ServletRequestTest.java
new file mode 100644
index 0000000000..322068352f
--- /dev/null
+++ b/http/wrappers-1.0.x/src/test/java/org/apache/felix/http/jakartawrappers/ServletRequestTest.java
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.jakartawrappers;
+
+import jakarta.servlet.ServletRequest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+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.ServletResponse;
+
+import org.junit.Test;
+
+public class ServletRequestTest {
+
+ private javax.servlet.ServletRequest createRequest() {
+ return new javax.servlet.ServletRequest() {
+
+ final private Map<String, Object> attributes = new HashMap<>();
+
+ @Override
+ public AsyncContext getAsyncContext() {
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return Collections.enumeration(attributes.keySet());
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return null;
+ }
+
+ @Override
+ public int getContentLength() {
+ return 0;
+ }
+
+ @Override
+ public long getContentLengthLong() {
+ return 0;
+ }
+
+ @Override
+ public String getContentType() {
+ return null;
+ }
+
+ @Override
+ public DispatcherType getDispatcherType() {
+ return null;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException {
+ return null;
+ }
+
+ @Override
+ public String getLocalAddr() {
+ return null;
+ }
+
+ @Override
+ public String getLocalName() {
+ return null;
+ }
+
+ @Override
+ public int getLocalPort() {
+ return 0;
+ }
+
+ @Override
+ public Locale getLocale() {
+ return null;
+ }
+
+ @Override
+ public Enumeration<Locale> getLocales() {
+ return null;
+ }
+
+ @Override
+ public String getParameter(String name) {
+ return null;
+ }
+
+ @Override
+ public Map<String, String[]> getParameterMap() {
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getParameterNames() {
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name) {
+ return null;
+ }
+
+ @Override
+ public String getProtocol() {
+ return null;
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException {
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path) {
+ return null;
+ }
+
+ @Override
+ public String getRemoteAddr() {
+ return null;
+ }
+
+ @Override
+ public String getRemoteHost() {
+ return null;
+ }
+
+ @Override
+ public int getRemotePort() {
+ return 0;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return null;
+ }
+
+ @Override
+ public String getScheme() {
+ return null;
+ }
+
+ @Override
+ public String getServerName() {
+ return null;
+ }
+
+ @Override
+ public int getServerPort() {
+ return 0;
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return null;
+ }
+
+ @Override
+ public boolean isAsyncStarted() {
+ return false;
+ }
+
+ @Override
+ public boolean isAsyncSupported() {
+ return false;
+ }
+
+ @Override
+ public boolean isSecure() {
+ return false;
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ attributes.remove(name);
+ }
+
+ @Override
+ public void setAttribute(String name, Object o) {
+ this.attributes.put(name, o);
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException {
+ return null;
+ }
+
+ @Override
+ public AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException {
+ return null;
+ }
+ };
+ }
+
+ @Test public void testAttributeGetterSetter() {
+ final javax.servlet.ServletRequest sr = createRequest();
+ final ServletRequest req = ServletRequestWrapper.getWrapper(sr);
+ req.setAttribute("foo", "bar");
+ assertEquals("bar", req.getAttribute("foo"));
+ req.setAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE, "500");
+ assertEquals("500", req.getAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ final List<String> names = Collections.list(req.getAttributeNames());
+ assertEquals(2, names.size());
+ assertTrue(names.contains("foo"));
+ assertTrue(names.contains(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ req.removeAttribute("foo");
+ assertNull(req.getAttribute("foo"));
+ req.removeAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE);
+ assertNull(req.getAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+ assertFalse(req.getAttributeNames().hasMoreElements());
+ }
+
+ @Test public void testProvidedAttributes() {
+ final javax.servlet.ServletRequest sr = createRequest();
+ sr.setAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE, "500");
+ sr.setAttribute("foo", "bar");
+
+ final ServletRequest req = ServletRequestWrapper.getWrapper(sr);
+ assertEquals("bar", req.getAttribute("foo"));
+ assertEquals("500", req.getAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ final List<String> names = Collections.list(req.getAttributeNames());
+ assertEquals(2, names.size());
+ assertTrue(names.contains("foo"));
+ assertTrue(names.contains(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ req.removeAttribute("foo");
+ assertNull(req.getAttribute("foo"));
+ req.removeAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE);
+ assertNull(req.getAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+ assertFalse(req.getAttributeNames().hasMoreElements());
+ }
+}
diff --git a/http/wrappers-1.0.x/src/test/java/org/apache/felix/http/javaxwrappers/ServletRequestTest.java b/http/wrappers-1.0.x/src/test/java/org/apache/felix/http/javaxwrappers/ServletRequestTest.java
new file mode 100644
index 0000000000..54bd7ecc95
--- /dev/null
+++ b/http/wrappers-1.0.x/src/test/java/org/apache/felix/http/javaxwrappers/ServletRequestTest.java
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.http.javaxwrappers;
+
+import javax.servlet.ServletRequest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.ServletResponse;
+
+import org.junit.Test;
+
+public class ServletRequestTest {
+
+ private jakarta.servlet.ServletRequest createRequest() {
+ return new jakarta.servlet.ServletRequest() {
+
+ final private Map<String, Object> attributes = new HashMap<>();
+
+ @Override
+ public AsyncContext getAsyncContext() {
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ @Override
+ public String getRealPath(String path) {
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return Collections.enumeration(attributes.keySet());
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return null;
+ }
+
+ @Override
+ public int getContentLength() {
+ return 0;
+ }
+
+ @Override
+ public long getContentLengthLong() {
+ return 0;
+ }
+
+ @Override
+ public String getContentType() {
+ return null;
+ }
+
+ @Override
+ public DispatcherType getDispatcherType() {
+ return null;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException {
+ return null;
+ }
+
+ @Override
+ public String getLocalAddr() {
+ return null;
+ }
+
+ @Override
+ public String getLocalName() {
+ return null;
+ }
+
+ @Override
+ public int getLocalPort() {
+ return 0;
+ }
+
+ @Override
+ public Locale getLocale() {
+ return null;
+ }
+
+ @Override
+ public Enumeration<Locale> getLocales() {
+ return null;
+ }
+
+ @Override
+ public String getParameter(String name) {
+ return null;
+ }
+
+ @Override
+ public Map<String, String[]> getParameterMap() {
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getParameterNames() {
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name) {
+ return null;
+ }
+
+ @Override
+ public String getProtocol() {
+ return null;
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException {
+ return null;
+ }
+
+ @Override
+ public String getRemoteAddr() {
+ return null;
+ }
+
+ @Override
+ public String getRemoteHost() {
+ return null;
+ }
+
+ @Override
+ public int getRemotePort() {
+ return 0;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return null;
+ }
+
+ @Override
+ public String getScheme() {
+ return null;
+ }
+
+ @Override
+ public String getServerName() {
+ return null;
+ }
+
+ @Override
+ public int getServerPort() {
+ return 0;
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return null;
+ }
+
+ @Override
+ public boolean isAsyncStarted() {
+ return false;
+ }
+
+ @Override
+ public boolean isAsyncSupported() {
+ return false;
+ }
+
+ @Override
+ public boolean isSecure() {
+ return false;
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ attributes.remove(name);
+ }
+
+ @Override
+ public void setAttribute(String name, Object o) {
+ this.attributes.put(name, o);
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
+ }
+
+ @Override
+ public AsyncContext startAsync() throws IllegalStateException {
+ return null;
+ }
+
+ @Override
+ public AsyncContext startAsync(jakarta.servlet.ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IllegalStateException {
+ return null;
+ }
+ };
+ }
+
+ @Test public void testAttributeGetterSetter() {
+ final jakarta.servlet.ServletRequest sr = createRequest();
+ final ServletRequest req = ServletRequestWrapper.getWrapper(sr);
+ req.setAttribute("foo", "bar");
+ assertEquals("bar", req.getAttribute("foo"));
+ req.setAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE, "500");
+ assertEquals("500", req.getAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ final List<String> names = Collections.list(req.getAttributeNames());
+ assertEquals(2, names.size());
+ assertTrue(names.contains("foo"));
+ assertTrue(names.contains(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ req.removeAttribute("foo");
+ assertNull(req.getAttribute("foo"));
+ req.removeAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE);
+ assertNull(req.getAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+ assertFalse(req.getAttributeNames().hasMoreElements());
+ }
+
+ @Test public void testProvidedAttributes() {
+ final jakarta.servlet.ServletRequest sr = createRequest();
+ sr.setAttribute(jakarta.servlet.RequestDispatcher.ERROR_STATUS_CODE, "500");
+ sr.setAttribute("foo", "bar");
+
+ final ServletRequest req = ServletRequestWrapper.getWrapper(sr);
+ assertEquals("bar", req.getAttribute("foo"));
+ assertEquals("500", req.getAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ final List<String> names = Collections.list(req.getAttributeNames());
+ assertEquals(2, names.size());
+ assertTrue(names.contains("foo"));
+ assertTrue(names.contains(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+
+ req.removeAttribute("foo");
+ assertNull(req.getAttribute("foo"));
+ req.removeAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE);
+ assertNull(req.getAttribute(javax.servlet.RequestDispatcher.ERROR_STATUS_CODE));
+ assertFalse(req.getAttributeNames().hasMoreElements());
+ }
+}