You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2023/02/22 07:56:15 UTC

[wicket] branch master updated (4affb7b184 -> 5d46ca58cc)

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


    from 4affb7b184 [WICKET-7025] package private methods are intercepted by ByteBuddy (#552)
     new 12a803c96e WICKET-7005: ByteBuddy IllegalStateException: Cannot inject already loaded type
     new 5d46ca58cc WICKET-7005: Update the cherry-picked commit to jakarta.**

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  10 +-
 .../protocol/http/BufferedHttpServletResponse.java |  35 -----
 .../protocol/http/mock/MockHttpServletRequest.java |  42 ++---
 .../http/mock/MockHttpServletResponse.java         |  43 -----
 .../wicket/protocol/http/mock/MockHttpSession.java |  72 ---------
 .../protocol/http/mock/MockServletContext.java     |  68 ++------
 .../proxy/bytebuddy/ByteBuddyProxyFactory.java     |   2 +-
 wicket-request/src/main/java/module-info.java      |   1 +
 wicket-spring/pom.xml                              |   4 +
 .../injection/bytebuddy/ParallelInjectionTest.java | 175 +++++++++++++++++++++
 .../main/java/javax/servlet/ServletContext.java    |  20 ---
 .../javax/servlet/http/HttpServletRequest.java     |  26 +--
 .../main/java/javax/servlet/http/HttpSession.java  |  26 ---
 13 files changed, 238 insertions(+), 286 deletions(-)
 create mode 100644 wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java


[wicket] 01/02: WICKET-7005: ByteBuddy IllegalStateException: Cannot inject already loaded type

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit 12a803c96e32cf82fb3acfe2928beaea5ef0c407
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Wed Feb 22 09:27:25 2023 +0200

    WICKET-7005: ByteBuddy IllegalStateException: Cannot inject already loaded type
    
    Configure ByteBuddy to not fail on already loaded classes
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 pom.xml                                            |   6 +
 .../proxy/bytebuddy/ByteBuddyProxyFactory.java     |   2 +-
 wicket-spring/pom.xml                              |   4 +
 .../injection/bytebuddy/ParallelInjectionTest.java | 175 +++++++++++++++++++++
 4 files changed, 186 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 52a8ee9bae..eca9685e11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -666,6 +666,12 @@
 				<version>${mockito.version}</version>
 				<scope>test</scope>
 			</dependency>
+			<dependency>
+				<groupId>org.springframework</groupId>
+				<artifactId>spring-test</artifactId>
+				<version>${spring.version}</version>
+				<scope>test</scope>
+			</dependency>
 		</dependencies>
 	</dependencyManagement>
 	<dependencies>
diff --git a/wicket-ioc/src/main/java/org/apache/wicket/proxy/bytebuddy/ByteBuddyProxyFactory.java b/wicket-ioc/src/main/java/org/apache/wicket/proxy/bytebuddy/ByteBuddyProxyFactory.java
index 9cc5cf419b..307786d9d4 100644
--- a/wicket-ioc/src/main/java/org/apache/wicket/proxy/bytebuddy/ByteBuddyProxyFactory.java
+++ b/wicket-ioc/src/main/java/org/apache/wicket/proxy/bytebuddy/ByteBuddyProxyFactory.java
@@ -116,7 +116,7 @@ public class ByteBuddyProxyFactory implements IProxyFactory
 						.implement(InterceptorMutator.class).intercept(FieldAccessor.ofBeanProperty())
 						.implement(Serializable.class, IWriteReplace.class, ILazyInitProxy.class).intercept(MethodDelegation.toField(INTERCEPTOR_FIELD_NAME))
 						.make()
-						.load(classLoader, ClassLoadingStrategy.Default.INJECTION)
+						.load(classLoader, ClassLoadingStrategy.Default.INJECTION.allowExistingTypes())
 						.getLoaded());
 	}
 
diff --git a/wicket-spring/pom.xml b/wicket-spring/pom.xml
index b3ec72e0df..8c28c2a238 100644
--- a/wicket-spring/pom.xml
+++ b/wicket-spring/pom.xml
@@ -50,5 +50,9 @@
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-context</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-test</artifactId>
+		</dependency>
 	</dependencies>
 </project>
diff --git a/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java b/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java
new file mode 100644
index 0000000000..01ea047937
--- /dev/null
+++ b/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java
@@ -0,0 +1,175 @@
+/*
+ * 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.wicket.spring.injection.bytebuddy;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.ThreadContext;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
+import org.apache.wicket.util.tester.DummyHomePage;
+import org.apache.wicket.util.tester.WicketTester;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.mock.web.MockServletContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.web.context.WebApplicationContext;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.servlet.ServletContext;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/* WICKET-7005 */
+@WebAppConfiguration
+@ExtendWith(SpringExtension.class)
+@ContextConfiguration(classes = { ParallelInjectionTest.ServiceConfig.class })
+public class ParallelInjectionTest implements ApplicationContextAware {
+
+    @ComponentScan(basePackages = "org.apache.wicket.spring.injection.bytebuddy")
+    @Configuration
+    public static class ServiceConfig {
+    }
+
+    @Named
+    public static class ServiceA {
+        @Inject
+        private ServiceC serviceC;
+        @Inject
+        private ServiceD serviceD;
+    }
+
+    @Named
+    public static class ServiceB {
+    }
+
+    @Named
+    public static class ServiceC {
+    }
+
+    @Named
+    public static class ServiceD {
+    }
+
+    public static class DemoComponent {
+
+        @Inject
+        private ServiceB serviceB;
+        @Inject
+        private ServiceA serviceA;
+
+        public DemoComponent() {
+        }
+    }
+
+    private static final Logger LOG = LoggerFactory.getLogger(ParallelInjectionTest.class);
+
+    private ApplicationContext context;
+
+    @BeforeAll
+    static void beforeAll() {
+        System.setProperty("wicket.ioc.useByteBuddy", Boolean.TRUE.toString());
+    }
+
+    @Test
+    void parallel() throws Exception {
+        runInjection(10);
+    }
+
+    @Test
+    void notParallel() throws Exception {
+        runInjection(1);
+    }
+
+    void runInjection(int nThreads) throws InterruptedException {
+                // Arrange
+        var tester = new WicketTester(createPortalApplication());
+        ExecutorService executor = Executors.newFixedThreadPool(nThreads);
+
+        Callable<String> callableTask = () -> {
+            LOG.debug("Thread id: {}", Thread.currentThread().getId());
+            ThreadContext.setApplication(tester.getApplication());
+            var panel = new DemoComponent();
+            Injector.get().inject(panel);
+            return "Injected";
+        };
+
+        // Act
+        var tasks = IntStream.rangeClosed(1, 100)
+                .mapToObj(i -> callableTask)
+                .collect(Collectors.toList());
+
+        var futures = executor.invokeAll(tasks);
+
+        futures.forEach(f -> {
+            try {
+                LOG.debug("Returned {}", f.get());
+            } catch (Exception e) {
+                throw new RuntimeException("A problem occurred", e);
+            }
+        });
+    }
+
+    private WebApplication createPortalApplication() {
+        LOG.debug("Erstelle MockServletContext mit applicationContext");
+
+        MockServletContext mockServletContext = new MockServletContext();
+
+        mockServletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
+
+        LOG.debug("Erstelle PortalApplication ...");
+
+        return new WebApplication() {
+            @Override
+            public ServletContext getServletContext() {
+                return mockServletContext;
+            }
+
+            @Override
+            public Class<? extends Page> getHomePage() {
+                return DummyHomePage.class;
+            }
+
+            @Override
+            protected void init() {
+                super.init();
+
+                getComponentInstantiationListeners().add(new SpringComponentInjector(this));
+                getCspSettings().blocking().disabled();
+            }
+        };
+    }
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        this.context = applicationContext;
+    }
+}


[wicket] 02/02: WICKET-7005: Update the cherry-picked commit to jakarta.**

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit 5d46ca58cc835b2ac925c14190260c6253db2c3e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Wed Feb 22 09:53:56 2023 +0200

    WICKET-7005: Update the cherry-picked commit to jakarta.**
    
    Update Spring to 6.0.5 and jakarta.servlet-api to 6.0.0 (Spring requires
    this version).
    Remove Servlet APIs which were deprecated in 5.0.0 and removed in 6.0.0
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 pom.xml                                            |  4 +-
 .../protocol/http/BufferedHttpServletResponse.java | 35 -----------
 .../protocol/http/mock/MockHttpServletRequest.java | 42 +++++--------
 .../http/mock/MockHttpServletResponse.java         | 43 -------------
 .../wicket/protocol/http/mock/MockHttpSession.java | 72 ----------------------
 .../protocol/http/mock/MockServletContext.java     | 68 +++++---------------
 wicket-request/src/main/java/module-info.java      |  1 +
 .../injection/bytebuddy/ParallelInjectionTest.java |  6 +-
 .../main/java/javax/servlet/ServletContext.java    | 20 ------
 .../javax/servlet/http/HttpServletRequest.java     | 26 +++++---
 .../main/java/javax/servlet/http/HttpSession.java  | 26 --------
 11 files changed, 55 insertions(+), 288 deletions(-)

diff --git a/pom.xml b/pom.xml
index eca9685e11..9fc510c541 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,7 +159,7 @@
 		<jakarta.servlet.jsp-api.version>3.0.0</jakarta.servlet.jsp-api.version>
 		<jakarta.validation-api.version>3.0.0</jakarta.validation-api.version>
 		<jakarta.websocket-api.version>2.0.0</jakarta.websocket-api.version>
-		<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
+		<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>
 		<japicmp.skip>true</japicmp.skip> <!-- TODO Wicket 10 Remove this once 10.0.0 is released -->
 		<jdk-serializable-functional.version>1.9.0</jdk-serializable-functional.version>
 		<jetty.version>11.0.10</jetty.version>
@@ -174,7 +174,7 @@
 		<objenesis.version>3.2</objenesis.version>
 		<openjson.version>1.0.12</openjson.version>
 		<slf4j.version>2.0.3</slf4j.version>
-		<spring.version>6.0.0</spring.version>
+		<spring.version>6.0.5</spring.version>
 		<wagon-ssh-external.version>3.4.3</wagon-ssh-external.version>
 		<weld.version>4.0.2.Final</weld.version>
 		<velocity-engine-core.version>2.3</velocity-engine-core.version>
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
index 076aa46508..a7a971b496 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
@@ -128,30 +128,6 @@ class BufferedHttpServletResponse implements HttpServletResponse
 		return realResponse.encodeRedirectURL(url);
 	}
 
-	/**
-	 * @see jakarta.servlet.http.HttpServletResponse#encodeUrl(java.lang.String)
-	 * @deprecated
-	 */
-	@Override
-	@Deprecated
-	public String encodeUrl(String url)
-	{
-		isOpen();
-		return realResponse.encodeURL(url);
-	}
-
-	/**
-	 * @see jakarta.servlet.http.HttpServletResponse#encodeRedirectUrl(java.lang.String)
-	 * @deprecated
-	 */
-	@Override
-	@Deprecated
-	public String encodeRedirectUrl(String url)
-	{
-		isOpen();
-		return realResponse.encodeRedirectURL(url);
-	}
-
 	/**
 	 * @see jakarta.servlet.http.HttpServletResponse#sendError(int, java.lang.String)
 	 */
@@ -278,17 +254,6 @@ class BufferedHttpServletResponse implements HttpServletResponse
 		status = statusCode;
 	}
 
-	/**
-	 * @see jakarta.servlet.http.HttpServletResponse#setStatus(int, java.lang.String)
-	 * @deprecated use setStatus(int) instead
-	 */
-	@Override
-	@Deprecated
-	public void setStatus(int sc, String sm)
-	{
-		setStatus(sc);
-	}
-
 	/**
 	 * @see jakarta.servlet.ServletResponse#getCharacterEncoding()
 	 */
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
index 8d315e379d..05684f26bd 100755
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletRequest.java
@@ -45,6 +45,7 @@ import jakarta.servlet.AsyncContext;
 import jakarta.servlet.DispatcherType;
 import jakarta.servlet.ReadListener;
 import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
 import jakarta.servlet.ServletContext;
 import jakarta.servlet.ServletException;
 import jakarta.servlet.ServletInputStream;
@@ -887,21 +888,6 @@ public class MockHttpServletRequest implements HttpServletRequest
 		return new BufferedReader(new InputStreamReader(getInputStream()));
 	}
 
-	/**
-	 * Deprecated method - should not be used.
-	 * 
-	 * @param name
-	 *            The name
-	 * @return The path
-	 * @deprecated Use ServletContext.getRealPath(String) instead.
-	 */
-	@Override
-	@Deprecated
-	public String getRealPath(String name)
-	{
-		return context.getRealPath(name);
-	}
-
 	/**
 	 * @return the remote address of the client
 	 */
@@ -1217,17 +1203,6 @@ public class MockHttpServletRequest implements HttpServletRequest
 		return true;
 	}
 
-	/**
-	 * Check whether session id is from a url rewrite. Always returns false.
-	 * 
-	 * @return Always false
-	 */
-	@Override
-	public boolean isRequestedSessionIdFromUrl()
-	{
-		return false;
-	}
-
 	@Override
 	public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
 	{
@@ -1772,4 +1747,19 @@ public class MockHttpServletRequest implements HttpServletRequest
 		return null;
 	}
 
+	@Override
+	public String getRequestId() {
+		return null;
+	}
+
+	@Override
+	public String getProtocolRequestId() {
+		return null;
+	}
+
+	@Override
+	public ServletConnection getServletConnection() {
+		return null;
+	}
+
 }
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletResponse.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletResponse.java
index 7e7f44c60a..684dde00a8 100755
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletResponse.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpServletResponse.java
@@ -177,20 +177,6 @@ public class MockHttpServletResponse implements HttpServletResponse, IMetaDataBu
 		return headers.containsKey(name);
 	}
 
-	/**
-	 * Encode the redirectLocation URL. Does no changes as this test implementation uses cookie
-	 * based url tracking.
-	 * 
-	 * @param url
-	 *            The url to encode
-	 * @return The encoded url
-	 */
-	@Override
-	public String encodeRedirectUrl(final String url)
-	{
-		return url;
-	}
-
 	/**
 	 * Encode the redirectLocation URL. Does no changes as this test implementation uses cookie
 	 * based url tracking.
@@ -205,19 +191,6 @@ public class MockHttpServletResponse implements HttpServletResponse, IMetaDataBu
 		return url;
 	}
 
-	/**
-	 * Encode the URL. Does no changes as this test implementation uses cookie based url tracking.
-	 * 
-	 * @param url
-	 *            The url to encode
-	 * @return The encoded url
-	 */
-	@Override
-	public String encodeUrl(final String url)
-	{
-		return url;
-	}
-
 	/**
 	 * Encode the URL. Does no changes as this test implementation uses cookie based url tracking.
 	 * 
@@ -799,22 +772,6 @@ public class MockHttpServletResponse implements HttpServletResponse, IMetaDataBu
 		this.status = status;
 	}
 
-	/**
-	 * Set the status for this response.
-	 * 
-	 * @param status
-	 *            The status
-	 * @param msg
-	 *            The message
-	 * @deprecated
-	 */
-	@Override
-	@Deprecated
-	public void setStatus(final int status, final String msg)
-	{
-		setStatus(status);
-	}
-
 	/**
 	 * @return binary response
 	 */
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpSession.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpSession.java
index 19ac70b9fd..14b08a5533 100755
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpSession.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockHttpSession.java
@@ -140,48 +140,6 @@ public class MockHttpSession implements HttpSession, Serializable
 		return context;
 	}
 
-	/**
-	 * NOT USED.
-	 * 
-	 * @return Always null
-	 * @deprecated
-	 */
-	@Override
-	@Deprecated
-	public jakarta.servlet.http.HttpSessionContext getSessionContext()
-	{
-		return null;
-	}
-
-	/**
-	 * Get the value for the given name.
-	 * 
-	 * @param name
-	 *            The name
-	 * @return The value or null
-	 * @deprecated use getAttribute(String) instead
-	 */
-	@Override
-	@Deprecated
-	public Object getValue(final String name)
-	{
-		return getAttribute(name);
-	}
-
-	/**
-	 * Get the names of the values in the session.
-	 * 
-	 * @return The names of the attributes
-	 * @deprecated use getAttributeNames() instead
-	 */
-	@Override
-	@Deprecated
-	public String[] getValueNames()
-	{
-		String[] result = new String[attributes.size()];
-		return attributes.keySet().toArray(result);
-	}
-
 	/**
 	 * Invalidate the session.
 	 */
@@ -208,22 +166,6 @@ public class MockHttpSession implements HttpSession, Serializable
 		return false;
 	}
 
-	/**
-	 * Set a value.
-	 * 
-	 * @param name
-	 *            The name of the value
-	 * @param o
-	 *            The value
-	 * @deprecated Use setAttribute(String, Object) instead
-	 */
-	@Override
-	@Deprecated
-	public void putValue(final String name, final Object o)
-	{
-		setAttribute(name, o);
-	}
-
 	/**
 	 * Remove an attribute.
 	 * 
@@ -236,20 +178,6 @@ public class MockHttpSession implements HttpSession, Serializable
 		attributes.remove(name);
 	}
 
-	/**
-	 * Remove a value.
-	 * 
-	 * @param name
-	 *            The name of the value
-	 * @deprecated Use removeAttribute(String) instead
-	 */
-	@Override
-	@Deprecated
-	public void removeValue(String name)
-	{
-		removeAttribute(name);
-	}
-
 	/**
 	 * Set an attribute.
 	 * 
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
index 5ab831dc38..4b06755bb7 100755
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/MockServletContext.java
@@ -102,6 +102,8 @@ public class MockServletContext implements ServletContext
 		private String domain;
 		private String comment;
 
+		private final Map<String, String> attributes = new HashMap<>();
+
 		@Override
 		public void setSecure(boolean secure)
 		{
@@ -174,6 +176,21 @@ public class MockServletContext implements ServletContext
 			return maxAge;
 		}
 
+		@Override
+		public void setAttribute(String s, String s1) {
+			attributes.put(s, s1);
+		}
+
+		@Override
+		public String getAttribute(String s) {
+			return attributes.get(s);
+		}
+
+		@Override
+		public Map<String, String> getAttributes() {
+			return Map.copyOf(attributes);
+		}
+
 		@Override
 		public String getDomain()
 		{
@@ -589,21 +606,6 @@ public class MockServletContext implements ServletContext
 		return "Wicket Mock Test Environment v1.0";
 	}
 
-	/**
-	 * NOT USED - Servlet Spec requires that this always returns null.
-	 *
-	 * @param name
-	 *            Not used
-	 * @return null
-	 * @throws ServletException
-	 *             Not used
-	 */
-	@Override
-	public Servlet getServlet(String name) throws ServletException
-	{
-		return null;
-	}
-
 	/**
 	 * Return the name of the servlet context.
 	 *
@@ -822,42 +824,6 @@ public class MockServletContext implements ServletContext
 		this.responseCharacterEncoding = Charset.forName(responseCharacterEncoding);
 	}
 
-	/**
-	 * NOT USED - Servlet spec requires that this always returns null.
-	 *
-	 * @return null
-	 */
-	@Override
-	public Enumeration<String> getServletNames()
-	{
-		return null;
-	}
-
-	/**
-	 * NOT USED - Servlet spec requires that this always returns null.
-	 *
-	 * @return null
-	 */
-	@Override
-	public Enumeration<Servlet> getServlets()
-	{
-		return null;
-	}
-
-	/**
-	 * As part of testing we always log to the console.
-	 *
-	 * @param e
-	 *            The exception to log
-	 * @param msg
-	 *            The message to log
-	 */
-	@Override
-	public void log(Exception e, String msg)
-	{
-		log.error(msg, e);
-	}
-
 	/**
 	 * As part of testing we always log to the console.
 	 *
diff --git a/wicket-request/src/main/java/module-info.java b/wicket-request/src/main/java/module-info.java
index 9ea32b08f6..90f87d5d03 100644
--- a/wicket-request/src/main/java/module-info.java
+++ b/wicket-request/src/main/java/module-info.java
@@ -17,6 +17,7 @@
 
 module org.apache.wicket.request {
     requires java.sql;
+    requires org.apache.commons.collections4;
     requires org.apache.wicket.util;
     requires org.slf4j;
     requires static jakarta.servlet;
diff --git a/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java b/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java
index 01ea047937..9cb7eff5ce 100644
--- a/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java
+++ b/wicket-spring/src/test/java/org/apache/wicket/spring/injection/bytebuddy/ParallelInjectionTest.java
@@ -39,9 +39,9 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
 import org.springframework.test.context.web.WebAppConfiguration;
 import org.springframework.web.context.WebApplicationContext;
 
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.servlet.ServletContext;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import jakarta.servlet.ServletContext;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
diff --git a/wicket-util/src/main/java/javax/servlet/ServletContext.java b/wicket-util/src/main/java/javax/servlet/ServletContext.java
index ad755b2e60..9b855edaf1 100644
--- a/wicket-util/src/main/java/javax/servlet/ServletContext.java
+++ b/wicket-util/src/main/java/javax/servlet/ServletContext.java
@@ -116,31 +116,11 @@ public interface ServletContext extends jakarta.servlet.ServletContext {
         return getDelegate().getNamedDispatcher(name);
     }
 
-    @Override
-    default Servlet getServlet(String name) throws ServletException {
-        return getDelegate().getServlet(name);
-    }
-
-    @Override
-    default Enumeration<Servlet> getServlets() {
-        return getDelegate().getServlets();
-    }
-
-    @Override
-    default Enumeration<String> getServletNames() {
-        return getDelegate().getServletNames();
-    }
-
     @Override
     default void log(String msg) {
         getDelegate().log(msg);
     }
 
-    @Override
-    default void log(Exception exception, String msg) {
-        getDelegate().log(exception, msg);
-    }
-
     @Override
     default void log(String message, Throwable throwable) {
         getDelegate().log(message, throwable);
diff --git a/wicket-util/src/main/java/javax/servlet/http/HttpServletRequest.java b/wicket-util/src/main/java/javax/servlet/http/HttpServletRequest.java
index 58e8a13cd6..c5155e62d6 100644
--- a/wicket-util/src/main/java/javax/servlet/http/HttpServletRequest.java
+++ b/wicket-util/src/main/java/javax/servlet/http/HttpServletRequest.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import jakarta.servlet.AsyncContext;
 import jakarta.servlet.DispatcherType;
 import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
 import jakarta.servlet.ServletContext;
 import jakarta.servlet.ServletException;
 import jakarta.servlet.ServletInputStream;
@@ -57,6 +58,21 @@ public interface HttpServletRequest extends jakarta.servlet.http.HttpServletRequ
         public jakarta.servlet.http.HttpServletRequest getDelegate() {
             return delegate;
         }
+
+        @Override
+        public String getRequestId() {
+            return delegate.getRequestId();
+        }
+
+        @Override
+        public String getProtocolRequestId() {
+            return delegate.getProtocolRequestId();
+        }
+
+        @Override
+        public ServletConnection getServletConnection() {
+            return delegate.getServletConnection();
+        }
     }
 
     jakarta.servlet.http.HttpServletRequest getDelegate();
@@ -186,11 +202,6 @@ public interface HttpServletRequest extends jakarta.servlet.http.HttpServletRequ
         return getDelegate().isRequestedSessionIdFromURL();
     }
 
-    @Override
-    default boolean isRequestedSessionIdFromUrl() {
-        return getDelegate().isRequestedSessionIdFromURL();
-    }
-
     @Override
     default boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
         return getDelegate().authenticate(response);
@@ -346,11 +357,6 @@ public interface HttpServletRequest extends jakarta.servlet.http.HttpServletRequ
         return getDelegate().getRequestDispatcher(path);
     }
 
-    @Override
-    default String getRealPath(String path) {
-        return getDelegate().getRealPath(path);
-    }
-
     @Override
     default int getRemotePort() {
         return getDelegate().getRemotePort();
diff --git a/wicket-util/src/main/java/javax/servlet/http/HttpSession.java b/wicket-util/src/main/java/javax/servlet/http/HttpSession.java
index ea220251e6..b1be018af8 100644
--- a/wicket-util/src/main/java/javax/servlet/http/HttpSession.java
+++ b/wicket-util/src/main/java/javax/servlet/http/HttpSession.java
@@ -19,7 +19,6 @@ package javax.servlet.http;
 import java.util.Enumeration;
 
 import jakarta.servlet.ServletContext;
-import jakarta.servlet.http.HttpSessionContext;
 
 /**
  * A temporary class used until all dependencies provide releases based on jakarta.** APIs
@@ -73,51 +72,26 @@ public interface HttpSession extends jakarta.servlet.http.HttpSession {
         return getDelegate().getMaxInactiveInterval();
     }
 
-    @Override
-    default HttpSessionContext getSessionContext() {
-        return getDelegate().getSessionContext();
-    }
-
     @Override
     default Object getAttribute(String name) {
         return getDelegate().getAttribute(name);
     }
 
-    @Override
-    default Object getValue(String name) {
-        return getDelegate().getValue(name);
-    }
-
     @Override
     default Enumeration<String> getAttributeNames() {
         return getDelegate().getAttributeNames();
     }
 
-    @Override
-    default String[] getValueNames() {
-        return getDelegate().getValueNames();
-    }
-
     @Override
     default void setAttribute(String name, Object value) {
         getDelegate().setAttribute(name, value);
     }
 
-    @Override
-    default void putValue(String name, Object value) {
-        getDelegate().putValue(name, value);
-    }
-
     @Override
     default void removeAttribute(String name) {
         getDelegate().removeAttribute(name);
     }
 
-    @Override
-    default void removeValue(String name) {
-        getDelegate().removeValue(name);
-    }
-
     @Override
     default void invalidate() {
         getDelegate().invalidate();