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 dd33015c8f FELIX-6762 : Support Jakarta Servlet 6.1
dd33015c8f is described below

commit dd33015c8f605dce2d49abd2c2362c3284c83f78
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Apr 4 07:34:18 2025 +0200

    FELIX-6762 : Support Jakarta Servlet 6.1
---
 http/base/pom.xml                                             |  2 +-
 .../http/base/internal/dispatch/ServletResponseWrapper.java   | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/http/base/pom.xml b/http/base/pom.xml
index fca00caf1b..98cbcb79a3 100644
--- a/http/base/pom.xml
+++ b/http/base/pom.xml
@@ -99,7 +99,7 @@
         <dependency>
             <groupId>jakarta.servlet</groupId>
             <artifactId>jakarta.servlet-api</artifactId>
-            <version>6.1.0</version>
+            <version>6.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git 
a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletResponseWrapper.java
 
b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletResponseWrapper.java
index 8309d845ac..21fe8c4159 100644
--- 
a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletResponseWrapper.java
+++ 
b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletResponseWrapper.java
@@ -35,6 +35,9 @@ import 
org.apache.felix.http.base.internal.registry.PerContextHandlerRegistry;
 
 final class ServletResponseWrapper extends HttpServletResponseWrapper
 {
+    // Attributes from servlet API 6.1 - added here to avoid dependency to 6.1
+    private static final String ERROR_METHOD = "jakarta.servlet.error.method";
+    private static final String ERROR_QUERY_STRING = 
"jakarta.servlet.error.query_string";
 
     private final HttpServletRequest request;
 
@@ -96,9 +99,9 @@ final class ServletResponseWrapper extends 
HttpServletResponseWrapper
                         {
                             
request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME, this.servletName);
                         }
-                        request.setAttribute(RequestDispatcher.ERROR_METHOD, 
this.request.getMethod());
+                        request.setAttribute(ERROR_METHOD, 
this.request.getMethod());
                         if (this.request.getQueryString() != null) {
-                            
request.setAttribute(RequestDispatcher.ERROR_QUERY_STRING, 
this.request.getQueryString());
+                            request.setAttribute(ERROR_QUERY_STRING, 
this.request.getQueryString());
                         }
 
                         final String servletPath = null;
@@ -136,8 +139,8 @@ final class ServletResponseWrapper extends 
HttpServletResponseWrapper
                         
request.removeAttribute(RequestDispatcher.ERROR_SERVLET_NAME);
                         
request.removeAttribute(RequestDispatcher.ERROR_EXCEPTION);
                         
request.removeAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE);
-                        
request.removeAttribute(RequestDispatcher.ERROR_METHOD);
-                        
request.removeAttribute(RequestDispatcher.ERROR_QUERY_STRING);
+                        request.removeAttribute(ERROR_METHOD);
+                        request.removeAttribute(ERROR_QUERY_STRING);
                     }
                 }
             }

Reply via email to