[tomcat] branch master updated: Remove deprecated items marked for Tomcat 10 removal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch master updated: Remove deprecated items marked for Tomcat 10 removal

Rémy Maucherat
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new c180b3e  Remove deprecated items marked for Tomcat 10 removal
c180b3e is described below

commit c180b3e160aff5e2374fcf987bac9c0e589b0b94
Author: remm <[hidden email]>
AuthorDate: Wed Jul 8 09:57:11 2020 +0200

    Remove deprecated items marked for Tomcat 10 removal
   
    Noticed while I was looking at CookieProcessor.
---
 .../apache/tomcat/util/http/CookieProcessor.java   | 25 +--------------
 .../tomcat/util/http/LegacyCookieProcessor.java    |  6 ----
 .../tomcat/util/http/Rfc6265CookieProcessor.java   |  6 ----
 .../util/http/TestCookieProcessorGeneration.java   | 36 +++++++++++-----------
 webapps/docs/changelog.xml                         |  8 +++++
 5 files changed, 27 insertions(+), 54 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/CookieProcessor.java b/java/org/apache/tomcat/util/http/CookieProcessor.java
index c230d4f..6ea0fe9 100644
--- a/java/org/apache/tomcat/util/http/CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/CookieProcessor.java
@@ -34,21 +34,6 @@ public interface CookieProcessor {
 
     /**
      * Generate the {@code Set-Cookie} HTTP header value for the given Cookie.
-     *
-     * @param cookie The cookie for which the header will be generated
-     *
-     * @return The header value in a form that can be added directly to the
-     *         response
-     *
-     * @deprecated This method has been replaced with
-     *             {@link #generateHeader(Cookie, HttpServletRequest)} and will
-     *             be removed from Tomcat 10 onwards.
-     */
-    @Deprecated
-    String generateHeader(Cookie cookie);
-
-    /**
-     * Generate the {@code Set-Cookie} HTTP header value for the given Cookie.
      * This method receives as parameter the servlet request so that it can make
      * decisions based on request properties. One such use-case is decide if the
      * SameSite attribute should be added to the cookie based on the User-Agent
@@ -56,12 +41,6 @@ public interface CookieProcessor {
      * with the SameSite attribute. This is described by <a
      * href="https://www.chromium.org/updates/same-site/incompatible-clients">the
      * Chromium project</a>.
-     * <p>
-     * The default implementation calls the deprecated
-     * {@link #generateHeader(Cookie)} method. Implementors should not rely on
-     * this default method as it is present only for transitional compatibility
-     * and will be removed in Tomcat 10 at the same time as the
-     * {@link #generateHeader(Cookie)} method.
      *
      * @param request The servlet request
      *
@@ -70,9 +49,7 @@ public interface CookieProcessor {
      * @return The header value in a form that can be added directly to the
      *         response
      */
-    default String generateHeader(Cookie cookie, HttpServletRequest request) {
-        return generateHeader(cookie);
-    }
+    String generateHeader(Cookie cookie, HttpServletRequest request);
 
     /**
      * Obtain the character set that will be used when converting between bytes
diff --git a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
index a3fc73b..9a5078e 100644
--- a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
@@ -234,12 +234,6 @@ public final class LegacyCookieProcessor extends CookieProcessorBase {
 
 
     @Override
-    public String generateHeader(Cookie cookie) {
-        return generateHeader(cookie, null);
-    }
-
-
-    @Override
     public String generateHeader(Cookie cookie, HttpServletRequest request) {
 
         /*
diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
index d747880..0864750 100644
--- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
@@ -100,12 +100,6 @@ public class Rfc6265CookieProcessor extends CookieProcessorBase {
 
 
     @Override
-    public String generateHeader(jakarta.servlet.http.Cookie cookie) {
-        return generateHeader(cookie, null);
-    }
-
-
-    @Override
     public String generateHeader(jakarta.servlet.http.Cookie cookie, HttpServletRequest request) {
 
         // Can't use StringBuilder due to DateFormat
diff --git a/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java b/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
index dfbd794..166be60 100644
--- a/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
+++ b/test/org/apache/tomcat/util/http/TestCookieProcessorGeneration.java
@@ -261,32 +261,32 @@ public class TestCookieProcessorGeneration {
 
         Cookie cookie = new Cookie("foo", "bar");
 
-        Assert.assertEquals("foo=bar", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("unset");
         rfc6265.setSameSiteCookies("unset");
 
-        Assert.assertEquals("foo=bar", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("none");
         rfc6265.setSameSiteCookies("none");
 
-        Assert.assertEquals("foo=bar; SameSite=None", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; SameSite=None", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; SameSite=None", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; SameSite=None", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("lax");
         rfc6265.setSameSiteCookies("lax");
 
-        Assert.assertEquals("foo=bar; SameSite=Lax", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; SameSite=Lax", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; SameSite=Lax", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; SameSite=Lax", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("strict");
         rfc6265.setSameSiteCookies("strict");
 
-        Assert.assertEquals("foo=bar; SameSite=Strict", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; SameSite=Strict", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; SameSite=Strict", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; SameSite=Strict", rfc6265.generateHeader(cookie, null));
 
         cookie.setSecure(true);
         cookie.setHttpOnly(true);
@@ -294,26 +294,26 @@ public class TestCookieProcessorGeneration {
         legacy.setSameSiteCookies("unset");
         rfc6265.setSameSiteCookies("unset");
 
-        Assert.assertEquals("foo=bar; Secure; HttpOnly", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; Secure; HttpOnly", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("none");
         rfc6265.setSameSiteCookies("none");
 
-        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=None", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=None", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=None", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=None", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("lax");
         rfc6265.setSameSiteCookies("lax");
 
-        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Lax", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Lax", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Lax", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Lax", rfc6265.generateHeader(cookie, null));
 
         legacy.setSameSiteCookies("strict");
         rfc6265.setSameSiteCookies("strict");
 
-        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Strict", legacy.generateHeader(cookie));
-        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Strict", rfc6265.generateHeader(cookie));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Strict", legacy.generateHeader(cookie, null));
+        Assert.assertEquals("foo=bar; Secure; HttpOnly; SameSite=Strict", rfc6265.generateHeader(cookie, null));
     }
 
     private void doTest(Cookie cookie, String expected) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5f4f46e..9c28f1a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,6 +45,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 10.0.0-M8 (markt)" rtext="in development">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        Remove deprecated <code>CookieProcessor.generateHeader</code> method.
+        (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="WebSocket">
     <changelog>
       <fix>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]