- Slightly updated behavior for setCharEnc, and allow setting a session cookie from...
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 4 Apr 2006 00:01:51 +0000 (00:01 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 4 Apr 2006 00:01:51 +0000 (00:01 +0000)
  resource in some cases.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@391183 13f79535-47bb-0310-9956-ffa450edef68

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

index faf0d42..94140c4 100644 (file)
@@ -1421,6 +1421,9 @@ public class Request
     public void setCharacterEncoding(String enc)\r
         throws UnsupportedEncodingException {\r
 \r
+        if (usingReader)\r
+            return;\r
+        \r
         // Ensure that the specified encoding is valid\r
         byte buffer[] = new byte[1];\r
         buffer[0] = (byte) 'a';\r
@@ -2231,7 +2234,7 @@ public class Request
             Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,\r
                                        session.getIdInternal());\r
             configureSessionCookie(cookie);\r
-            response.addCookie(cookie);\r
+            response.addCookieInternal(cookie);\r
         }\r
 \r
         if (session != null) {\r
index c71d2ee..167ef0d 100644 (file)
@@ -908,13 +908,26 @@ public class Response
      */\r
     public void addCookie(final Cookie cookie) {\r
 \r
-        if (isCommitted())\r
-            return;\r
-\r
         // Ignore any call from an included servlet\r
         if (included)\r
             return;\r
 \r
+        addCookieInternal(cookie);\r
+\r
+    }\r
+\r
+\r
+    /**\r
+     * Add the specified Cookie to those that will be included with\r
+     * this Response.\r
+     *\r
+     * @param cookie Cookie to be added\r
+     */\r
+    public void addCookieInternal(final Cookie cookie) {\r
+\r
+        if (isCommitted())\r
+            return;\r
+\r
         cookies.add(cookie);\r
 \r
         final StringBuffer sb = new StringBuffer();\r