Minor clean-up. Merge methods.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 25 Aug 2010 11:24:42 +0000 (11:24 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 25 Aug 2010 11:24:42 +0000 (11:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@989015 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/Response.java

index e76ab4a..ae4bd1c 100644 (file)
@@ -948,11 +948,15 @@ public class Response
     public void addCookie(final Cookie cookie) {
 
         // Ignore any call from an included servlet
-        if (included)
+        if (included || isCommitted())
             return;
 
-        addCookieInternal(cookie);
-
+        final StringBuffer sb = generateCookieString(cookie);
+        //if we reached here, no exception, cookie is valid
+        // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
+        // RFC2965 is not supported by browsers and the Servlet spec
+        // asks for 2109.
+        addHeader("Set-Cookie", sb.toString());
     }
 
     /**
@@ -985,24 +989,6 @@ public class Response
         
         
     }
-    /**
-     * Add the specified Cookie to those that will be included with
-     * this Response.
-     *
-     * @param cookie    Cookie to be added
-     */
-    public void addCookieInternal(final Cookie cookie) {
-
-        if (isCommitted())
-            return;
-
-        final StringBuffer sb = generateCookieString(cookie);
-        //if we reached here, no exception, cookie is valid
-        // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
-        // RFC2965 is not supported by browsers and the Servlet spec
-        // asks for 2109.
-        addHeader("Set-Cookie", sb.toString());
-    }
 
     public StringBuffer generateCookieString(final Cookie cookie) {
         final StringBuffer sb = new StringBuffer();