From: remm Date: Tue, 4 Apr 2006 00:01:51 +0000 (+0000) Subject: - Slightly updated behavior for setCharEnc, and allow setting a session cookie from... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3968b3d0e452735bcd00916ad14d1fd9fe3cf0b7;p=tomcat7.0 - Slightly updated behavior for setCharEnc, and allow setting a session cookie from an included resource in some cases. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@391183 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index faf0d421a..94140c47e 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -1421,6 +1421,9 @@ public class Request public void setCharacterEncoding(String enc) throws UnsupportedEncodingException { + if (usingReader) + return; + // Ensure that the specified encoding is valid byte buffer[] = new byte[1]; buffer[0] = (byte) 'a'; @@ -2231,7 +2234,7 @@ public class Request Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME, session.getIdInternal()); configureSessionCookie(cookie); - response.addCookie(cookie); + response.addCookieInternal(cookie); } if (session != null) { diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java index c71d2ee3b..167ef0d94 100644 --- a/java/org/apache/catalina/connector/Response.java +++ b/java/org/apache/catalina/connector/Response.java @@ -908,13 +908,26 @@ public class Response */ public void addCookie(final Cookie cookie) { - if (isCommitted()) - return; - // Ignore any call from an included servlet if (included) return; + addCookieInternal(cookie); + + } + + + /** + * 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; + cookies.add(cookie); final StringBuffer sb = new StringBuffer();