From bb11d3d54d1501f14dc1c4bdaf49dbfa66395e2c Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 25 Aug 2010 11:24:42 +0000 Subject: [PATCH] Minor clean-up. Merge methods. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@989015 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/connector/Response.java | 28 ++++++------------------ 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java index e76ab4aa0..ae4bd1c08 100644 --- a/java/org/apache/catalina/connector/Response.java +++ b/java/org/apache/catalina/connector/Response.java @@ -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(); -- 2.11.0