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

sseifert pushed a commit to branch feature/SLING-13029-servlet61
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-integration-tests.git

commit db26d01cd860e84d9be457506f99b3b1a0deaccb
Author: Stefan Seifert <[email protected]>
AuthorDate: Thu Dec 11 09:59:50 2025 +0100

    SLING-13029 Validate new Servlet API 6.1 Features
---
 pom.xml                                            |  5 +++
 .../integrationtest/jakarta/Servlet61Test.java     | 52 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/pom.xml b/pom.xml
index 070bd7b..a46df76 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,6 +85,11 @@
             <version>1.5.19</version>
             <scope>runtime</scope>
         </dependency>
+        <dependency>
+            <groupId>jakarta.servlet</groupId>
+            <artifactId>jakarta.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
 
         <!--  for DavExIntegrationTest -->
         <dependency>
diff --git 
a/src/main/java/org/apache/sling/starter/webapp/integrationtest/jakarta/Servlet61Test.java
 
b/src/main/java/org/apache/sling/starter/webapp/integrationtest/jakarta/Servlet61Test.java
new file mode 100644
index 0000000..7808e3f
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/starter/webapp/integrationtest/jakarta/Servlet61Test.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sling.starter.webapp.integrationtest.jakarta;
+
+import java.io.IOException;
+import java.util.List;
+
+import jakarta.servlet.http.HttpServletResponse;
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+/**
+ * Verifies that Jakarta Servlet 6.1 API usage on the server is working
+ */
+public class Servlet61Test extends HttpTestBase {
+
+    public void testSetCharsetOverload() throws IOException {
+
+        String content = getContent(HTTP_BASE_URL + 
"/bin/jakarta-servlet61.txt", "text/plain;charset=utf-8");
+
+        assertThat("Text output", content, equalTo("Hello Servlet API 6.1"));
+    }
+
+    public void testNewRedirectOverload() throws IOException {
+
+        String content = getContent(
+                HTTP_BASE_URL + "/bin/jakarta-servlet61-redirect.txt",
+                "text/plain;charset=utf-8",
+                List.of(),
+                HttpServletResponse.SC_PERMANENT_REDIRECT);
+
+        assertThat("Text otput", content, equalTo("Custom body before 
redirect"));
+    }
+}

Reply via email to