Skip to content

Commit 30e9d5c

Browse files
authored
Merge pull request #1930 from fl4via/UNDERTOW-2536
[UNDERTOW-2536] Update test to work with Servlet spec version 6.1
2 parents 1732cdf + 92e9896 commit 30e9d5c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

servlet/src/test/java/io/undertow/servlet/test/dispatcher/attributes/DispatcherErrorForwardServletTestCase.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,23 @@ public void testSimpleForwardWithError() throws IOException, InterruptedExceptio
104104
expectedParams.put("jakarta.servlet.forward.context_path", "/servletContext");
105105
expectedParams.put("jakarta.servlet.forward.mapping",
106106
"match_value=forward,pattern=/forward,servlet_name=fwd,mapping_match=EXACT");
107-
//https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0#request-attributes
107+
//https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#request-attributes
108108
// jakarta.servlet.error.request_uri
109109
// jakarta.servlet.error.servlet_name
110110
// jakarta.servlet.error.exception_type
111111
// jakarta.servlet.error.exception
112112
// jakarta.servlet.error.message
113113
// jakarta.servlet.error.status_code
114+
// plus, we have the new jakarta.servlet.error.method as specified in
115+
// https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#changes-since-jakarta-servlet-6-0 issue
116+
// https://github.com/eclipse-ee4j/servlet-api/issues/544
114117
expectedParams.put("jakarta.servlet.error.request_uri", "/servletContext/forward");
115118
expectedParams.put("jakarta.servlet.error.servlet_name", "fwd");
116119
expectedParams.put("jakarta.servlet.error.exception_type", "class jakarta.servlet.ServletException");
117120
expectedParams.put("jakarta.servlet.error.exception", "jakarta.servlet.ServletException: HEY");
118121
expectedParams.put("jakarta.servlet.error.message", "HEY");
119122
expectedParams.put("jakarta.servlet.error.status_code", "500");
123+
expectedParams.put("jakarta.servlet.error.method", "GET");
120124
TestHttpClient client = new TestHttpClient();
121125
try {
122126
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/servletContext/forward");
@@ -135,7 +139,7 @@ public void testSimpleForwardWithError() throws IOException, InterruptedExceptio
135139
@Test
136140
public void testSimpleForwardWithNoError() throws IOException, InterruptedException {
137141
//Expected params:
138-
//https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0#forwarded-request-parameters
142+
//https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#forwarded-request-parameters
139143
//Some are missing, since null == omission.
140144
// jakarta.servlet.forward.mapping
141145
// jakarta.servlet.forward.request_uri

servlet/src/test/java/io/undertow/servlet/test/dispatcher/attributes/DispatcherErrorIncludeServletTestCase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void testSimpleIncludeWithError() throws IOException, InterruptedExceptio
105105
expectedParams.put("jakarta.servlet.forward.mapping",
106106
"match_value=include,pattern=/include,servlet_name=inc,mapping_match=EXACT");
107107
expectedParams.put("jakarta.servlet.forward.context_path", "/servletContext");
108-
//https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0#request-attributes
108+
//https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#request-attributes
109109
// jakarta.servlet.error.request_uri
110110
// jakarta.servlet.error.servlet_name
111111
// jakarta.servlet.error.exception_type
@@ -117,6 +117,7 @@ public void testSimpleIncludeWithError() throws IOException, InterruptedExceptio
117117
expectedParams.put("jakarta.servlet.error.exception", "jakarta.servlet.ServletException: HEY");
118118
expectedParams.put("jakarta.servlet.error.message", "HEY");
119119
expectedParams.put("jakarta.servlet.error.status_code", "500");
120+
expectedParams.put("jakarta.servlet.error.method", "GET");
120121
TestHttpClient client = new TestHttpClient();
121122
try {
122123
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/servletContext/include");
@@ -134,7 +135,7 @@ public void testSimpleIncludeWithError() throws IOException, InterruptedExceptio
134135

135136
@Test
136137
public void testSimpleIncludeWithNoError() throws IOException, InterruptedException {
137-
//https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0#included-request-parameters
138+
//https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#included-request-parameters
138139
// jakarta.servlet.include.request_uri
139140
// jakarta.servlet.include.context_path
140141
// jakarta.servlet.include.query_string

0 commit comments

Comments
 (0)