diff --git a/api/src/main/java/jakarta/servlet/SessionCookieConfig.java b/api/src/main/java/jakarta/servlet/SessionCookieConfig.java index 2cf0194c4..26d706a33 100644 --- a/api/src/main/java/jakarta/servlet/SessionCookieConfig.java +++ b/api/src/main/java/jakarta/servlet/SessionCookieConfig.java @@ -108,36 +108,6 @@ public interface SessionCookieConfig { */ String getPath(); - /** - * With the adoption of support for RFC 6265, this method should no longer be used. - *
- * If called, this method has no effect. - * - * @param comment ignore - * - * @throws IllegalStateException if the ServletContext from which this SessionCookieConfig was - * acquired has already been initialized - * - * @see jakarta.servlet.http.Cookie#setComment(String) - * @see jakarta.servlet.http.Cookie#getVersion - * - * @deprecated This is no longer required with RFC 6265 - */ - @Deprecated(since = "Servlet 6.0", forRemoval = true) - void setComment(String comment); - - /** - * With the adoption of support for RFC 6265, this method should no longer be used. - * - * @return Always {@code null} - * - * @see jakarta.servlet.http.Cookie#getComment() - * - * @deprecated This is no longer required with RFC 6265 - */ - @Deprecated(since = "Servlet 6.0", forRemoval = true) - String getComment(); - /** * Marks or unmarks the session tracking cookies created on behalf of the application represented by the * ServletContext from which this SessionCookieConfig was acquired as HttpOnly. diff --git a/api/src/main/java/jakarta/servlet/http/Cookie.java b/api/src/main/java/jakarta/servlet/http/Cookie.java index 695de0384..1220beba0 100644 --- a/api/src/main/java/jakarta/servlet/http/Cookie.java +++ b/api/src/main/java/jakarta/servlet/http/Cookie.java @@ -132,36 +132,6 @@ public Cookie(String name, String value) { this.value = value; } - /** - * With the adoption of support for RFC 6265, this method should no longer be used. - *
- * If called, this method has no effect. - * - * @param purpose This parameter is ignored - * - * @see #getComment - * - * @deprecated This is no longer required with RFC 6265 - */ - @Deprecated(since = "Servlet 6.0", forRemoval = true) - public void setComment(String purpose) { - // NO-OP - } - - /** - * With the adoption of support for RFC 6265, this method should no longer be used. - * - * @return Always {@code null} - * - * @see #setComment - * - * @deprecated This is no longer required with RFC 6265 - */ - @Deprecated(since = "Servlet 6.0", forRemoval = true) - public String getComment() { - return null; - } - /** * * Specifies the domain within which this cookie should be presented. @@ -339,36 +309,6 @@ public String getValue() { return value; } - /** - * With the adoption of support for RFC 6265, this method should no longer be used. - * - * @return Always 0 - * - * @see #setVersion - * - * @deprecated This is no longer required with RFC 6265 - */ - @Deprecated(since = "Servlet 6.0", forRemoval = true) - public int getVersion() { - return 0; - } - - /** - * With the adoption of support for RFC 6265, this method should no longer be used. - *
- * If called, this method has no effect.
- *
- * @param v This parameter is ignored
- *
- * @see #getVersion
- *
- * @deprecated This is no longer required with RFC 6265
- */
- @Deprecated(since = "Servlet 6.0", forRemoval = true)
- public void setVersion(int v) {
- // NO-OP
- }
-
/*
* Tests a string and returns true if the string contains a reserved characters for the Set-Cookie header.
*
@@ -553,7 +493,6 @@ public boolean equals(Object obj) {
Cookie c = (Cookie) obj;
return Objects.equals(getName(), c.getName()) &&
Objects.equals(getValue(), c.getValue()) &&
- getVersion() == c.getVersion() &&
Objects.equals(getAttributes(), c.getAttributes());
}
return false;
diff --git a/api/src/main/java/jakarta/servlet/http/HttpServlet.java b/api/src/main/java/jakarta/servlet/http/HttpServlet.java
index e9810381b..f5da1864a 100644
--- a/api/src/main/java/jakarta/servlet/http/HttpServlet.java
+++ b/api/src/main/java/jakarta/servlet/http/HttpServlet.java
@@ -86,21 +86,9 @@ public abstract class HttpServlet extends GenericServlet {
// Add headers in lower case as HTTP headers are case insensitive
private static final List
- * The default implementation calls {@link #doGet(HttpServletRequest, HttpServletResponse)}. If the
- * {@link ServletConfig} init parameter {@link #LEGACY_DO_HEAD} is set to "TRUE", then the response instance is wrapped
- * so that the response body is discarded.
- *
+ * The default implementation calls {@link #doGet(HttpServletRequest, HttpServletResponse)}.
*
* If the HTTP HEAD request is incorrectly formatted,
diff --git a/api/src/test/java/ee/jakarta/servlet/http/CookieTest.java b/api/src/test/java/ee/jakarta/servlet/http/CookieTest.java
index 5aa02589b..c99db19c2 100644
--- a/api/src/test/java/ee/jakarta/servlet/http/CookieTest.java
+++ b/api/src/test/java/ee/jakarta/servlet/http/CookieTest.java
@@ -32,19 +32,16 @@
import org.junit.jupiter.params.provider.ValueSource;
public class CookieTest {
- @SuppressWarnings("removal")
@Test
public void testCookie() {
Cookie cookie = new Cookie("name", "value");
assertThat(cookie.getName(), is("name"));
assertThat(cookie.getValue(), is("value"));
- assertThat(cookie.getComment(), nullValue());
assertThat(cookie.getDomain(), nullValue());
assertThat(cookie.getMaxAge(), is(-1));
assertThat(cookie.getPath(), nullValue());
assertThat(cookie.getSecure(), is(false));
assertThat(cookie.isHttpOnly(), is(false));
- assertThat(cookie.getVersion(), is(0));
assertThat(cookie.getAttributes().size(), is(0));
}
@@ -60,22 +57,6 @@ public void testBadCookie(String name) {
assertThrows(IllegalArgumentException.class, () -> new Cookie(name, "value"));
}
- @SuppressWarnings("removal")
- @Test
- public void testComment() {
- Cookie cookie = new Cookie("name", "value");
- cookie.setComment("comment");
- assertThat(cookie.getComment(), nullValue());
- assertThat(cookie.getAttributes().size(), is(0));
- cookie.setAttribute("COMMENT", "Comment!");
- assertThat(cookie.getComment(), nullValue());
- assertThat(cookie.getAttributes().keySet(), contains("COMMENT"));
- assertThat(cookie.getAttributes().values(), contains("Comment!"));
- cookie.setAttribute("COMMENT", null);
- assertThat(cookie.getComment(), nullValue());
- assertThat(cookie.getAttributes().size(), is(0));
- }
-
@Test
public void testDomain() {
Cookie cookie = new Cookie("name", "value");
@@ -160,19 +141,6 @@ public void testValue() {
assertThat(cookie.getValue(), nullValue());
}
- @SuppressWarnings("removal")
- @Test
- public void testVersion() {
- Cookie cookie = new Cookie("name", "value");
- assertThat(cookie.getVersion(), is(0));
- cookie.setVersion(1);
- assertThat(cookie.getVersion(), is(0));
- assertThat(cookie.getAttributes().size(), is(0));
- cookie.setVersion(Integer.MAX_VALUE);
- assertThat(cookie.getVersion(), is(0));
- assertThat(cookie.getAttributes().size(), is(0));
- }
-
@Test
public void testHttpOnly() {
Cookie cookie = new Cookie("name", "value");
diff --git a/api/src/test/java/ee/jakarta/servlet/http/HttpServletTest.java b/api/src/test/java/ee/jakarta/servlet/http/HttpServletTest.java
index 2657d917a..f71562891 100644
--- a/api/src/test/java/ee/jakarta/servlet/http/HttpServletTest.java
+++ b/api/src/test/java/ee/jakarta/servlet/http/HttpServletTest.java
@@ -17,9 +17,7 @@
package ee.jakarta.servlet.http;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import ee.jakarta.servlet.MockServletConfig;
@@ -32,8 +30,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -45,59 +41,6 @@ public interface Handler {
void handle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;
}
- @ParameterizedTest
- @MethodSource("headTest")
- public void testLegacyHead(String test, Handler doGet, boolean expectedFlushed, long expectedContentLength)
- throws ServletException, IOException {
- HttpServlet servlet = new HttpServlet() {
- private static final long serialVersionUID = 20214996986006168L;
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- doGet.handle(request, response);
- }
- };
-
- MockServletConfig servletConfig = new MockServletConfig();
- servletConfig.setInitParameter("jakarta.servlet.http.legacyDoHead", "true");
- servlet.init(servletConfig);
-
- MockHttpServletRequest request = new MockHttpServletRequest(servletConfig.getServletContext()) {
- @Override
- public String getMethod() {
- return "HEAD";
- }
- };
-
- AtomicBoolean committed = new AtomicBoolean();
- AtomicLong contentLength = new AtomicLong(-1);
- MockHttpServletResponse response = new MockHttpServletResponse() {
- @Override
- public void flushBuffer() throws IOException {
- committed.set(true);
- }
-
- @Override
- public boolean isCommitted() {
- return committed.get();
- }
-
- @Override
- public void setContentLengthLong(long len) {
- contentLength.set(len);
- }
- };
-
- servlet.service(request, response);
- MockServletOutputStream out = response.getMockServletOutputStream();
- String actual = out == null ? null : out.takeOutputAsString();
-
- // Check if the output should have already been flushed
- assertThat(test, committed.get(), is(expectedFlushed));
- assertThat(test, contentLength.get(), is(expectedContentLength));
- assertThat(test, actual, anyOf(is(""), nullValue()));
- }
-
@ParameterizedTest
@MethodSource("traceHeadersTest")
public void testTraceHeaders(String testHeader, Handler doTrace)
@@ -152,97 +95,6 @@ private static StreamdoHead
returns an HTTP "Bad Request" message.
*
@@ -220,13 +204,7 @@ protected long getLastModified(HttpServletRequest req) {
* @throws ServletException if the request for the HEAD could not be handled
*/
protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- if (legacyHeadHandling) {
- NoBodyResponse response = new NoBodyResponse(resp);
- doGet(req, response);
- response.setContentLength();
- } else {
- doGet(req, resp);
- }
+ doGet(req, resp);
}
/**
diff --git a/api/src/main/java/jakarta/servlet/http/HttpServletRequest.java b/api/src/main/java/jakarta/servlet/http/HttpServletRequest.java
index 40e436e8d..31b814f5e 100644
--- a/api/src/main/java/jakarta/servlet/http/HttpServletRequest.java
+++ b/api/src/main/java/jakarta/servlet/http/HttpServletRequest.java
@@ -296,7 +296,7 @@ public String toString() {
*
* @deprecated In favor of 103 early hints
*/
- @Deprecated
+ @Deprecated(forRemoval = true)
default PushBuilder newPushBuilder() {
return null;
}
diff --git a/api/src/main/java/jakarta/servlet/http/HttpServletRequestWrapper.java b/api/src/main/java/jakarta/servlet/http/HttpServletRequestWrapper.java
index 40e9b1676..0ba399cef 100644
--- a/api/src/main/java/jakarta/servlet/http/HttpServletRequestWrapper.java
+++ b/api/src/main/java/jakarta/servlet/http/HttpServletRequestWrapper.java
@@ -334,7 +334,7 @@ public