Skip to content
30 changes: 0 additions & 30 deletions api/src/main/java/jakarta/servlet/SessionCookieConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,36 +108,6 @@ public interface SessionCookieConfig {
*/
String getPath();

/**
* With the adoption of support for RFC 6265, this method should no longer be used.
* <p>
* If called, this method has no effect.
*
* @param comment ignore
*
* @throws IllegalStateException if the <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt> 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
* <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt> was acquired as <i>HttpOnly</i>.
Expand Down
61 changes: 0 additions & 61 deletions api/src/main/java/jakarta/servlet/http/Cookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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.
Expand Down Expand Up @@ -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.
* <p>
* 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.
*
Expand Down Expand Up @@ -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;
Expand Down
26 changes: 2 additions & 24 deletions api/src/main/java/jakarta/servlet/http/HttpServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> SENSITIVE_HTTP_HEADERS = Arrays.asList("authorization", "cookie", "x-forwarded", "forwarded", "proxy-authorization");

/**
* The parameter obtained {@link ServletConfig#getInitParameter(String)} to determine if legacy processing of
* {@link #doHead(HttpServletRequest, HttpServletResponse)} is provided.
*
* @deprecated may be removed in future releases
* @since Servlet 6.0
*/
@Deprecated(forRemoval = true, since = "Servlet 6.0")
public static final String LEGACY_DO_HEAD = "jakarta.servlet.http.legacyDoHead";

private static final String LSTRING_FILE = "jakarta.servlet.http.LocalStrings";
private static final ResourceBundle lStrings = ResourceBundle.getBundle(LSTRING_FILE);

private boolean legacyHeadHandling;

/**
* Does nothing, because this is an abstract class.
*
Expand All @@ -112,7 +100,6 @@ public HttpServlet() {
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
legacyHeadHandling = Boolean.parseBoolean(config.getInitParameter(LEGACY_DO_HEAD));
}

/**
Expand Down Expand Up @@ -204,10 +191,7 @@ protected long getLastModified(HttpServletRequest req) {
* protects itself from being called multiple times for one HTTP HEAD request).
*
* <p>
* 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)}.
* <p>
* If the HTTP HEAD request is incorrectly formatted, <code>doHead</code> returns an HTTP "Bad Request" message.
*
Expand All @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public String toString() {
*
* @deprecated In favor of 103 early hints
*/
@Deprecated
@Deprecated(forRemoval = true)
default PushBuilder newPushBuilder() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IO
*
* @deprecated In favor of 103 early hints
*/
@Deprecated
@Deprecated(forRemoval = true)
@Override
public PushBuilder newPushBuilder() {
return this._getHttpServletRequest().newPushBuilder();
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/servlet/http/PushBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
*
* @deprecated In favor of 103 early hints
*/
@Deprecated
@Deprecated(forRemoval = true)
public interface PushBuilder {
/**
* <p>
Expand Down
32 changes: 0 additions & 32 deletions api/src/test/java/ee/jakarta/servlet/http/CookieTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Loading