Upgrade Servlet, JSP and WebSocket API versions

This commit updates the Spring Framework baseline for the Servlet, JSP
and WebSocket APIs.
This also removes the previously deprecated APIs in JSP `PageContext`
and guards against the deprecation of the `PushBuilder` API.

See gh-33918
This commit is contained in:
Brian Clozel
2024-11-19 18:04:29 +01:00
parent 1fb1801285
commit c28cbfd582
6 changed files with 10 additions and 42 deletions

View File

@@ -39,7 +39,6 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseCookie;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;
/**
* Adapt {@link ServerHttpResponse} to the Servlet {@link HttpServletResponse}.
@@ -50,8 +49,6 @@ import org.springframework.util.ReflectionUtils;
*/
class ServletServerHttpResponse extends AbstractListenerServerHttpResponse {
private static final boolean IS_SERVLET61 = ReflectionUtils.findField(HttpServletResponse.class, "SC_PERMANENT_REDIRECT") != null;
private final HttpServletResponse response;
private final ServletOutputStream outputStream;
@@ -186,12 +183,7 @@ class ServletServerHttpResponse extends AbstractListenerServerHttpResponse {
cookie.setSecure(httpCookie.isSecure());
cookie.setHttpOnly(httpCookie.isHttpOnly());
if (httpCookie.isPartitioned()) {
if (IS_SERVLET61) {
cookie.setAttribute("Partitioned", "");
}
else {
cookie.setAttribute("Partitioned", "true");
}
cookie.setAttribute("Partitioned", "");
}
this.response.addCookie(cookie);
}

View File

@@ -30,6 +30,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.AbstractHttpHandlerIntegrationTests;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.JettyHttpServer;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.UndertowHttpServer;
import static org.assertj.core.api.Assertions.assertThat;
@@ -80,6 +81,7 @@ class CookieIntegrationTests extends AbstractHttpHandlerIntegrationTests {
@ParameterizedHttpServerTest
public void partitionedAttributeTest(HttpServer httpServer) throws Exception {
assumeFalse(httpServer instanceof UndertowHttpServer, "Undertow does not support Partitioned cookies");
assumeFalse(httpServer instanceof JettyHttpServer, "Jetty does not support Servlet 6.1 yet");
startServer(httpServer);
URI url = URI.create("http://localhost:" + port);

View File

@@ -267,26 +267,12 @@ public class MockPageContext extends PageContext {
return this.out;
}
@Override
@Deprecated
@Nullable
public jakarta.servlet.jsp.el.ExpressionEvaluator getExpressionEvaluator() {
return null;
}
@Override
@Nullable
public ELContext getELContext() {
return null;
}
@Override
@Deprecated
@Nullable
public jakarta.servlet.jsp.el.VariableResolver getVariableResolver() {
return null;
}
@Override
public HttpSession getSession() {
return this.request.getSession();