You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/06/15 16:00:43 UTC

svn commit: r1602698 - in /tomcat/tc7.0.x/trunk: ./ webapps/docs/changelog.xml webapps/examples/WEB-INF/classes/CookieExample.java

Author: kkolinko
Date: Sun Jun 15 14:00:42 2014
New Revision: 1602698

URL: http://svn.apache.org/r1602698
Log:
Followup to r1602522
Add "/" to the path like we do for session cookies.
Use request.getContextPath() as I think it makes a better example.

If I examples are named "/examples" then either code works. If I rename them to some Cyrillic name then the new code works while the old one does not. Tested with Firefox 30 on Windows 7 + for Tomcat 7 you have to configure Connector with URIEncoding="UTF-8".

Merged r1602694 from tomcat/trunk.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
    tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/CookieExample.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1602694

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1602698&r1=1602697&r2=1602698&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Jun 15 14:00:42 2014
@@ -176,7 +176,7 @@
         only returned to the examples application. This reduces the opportunity
         for using such cookies for malicious purposes should the advice to
         remove the examples web application from security sensitive systems be
-        ignored. (markt)
+        ignored. (markt/kkolinko)
       </fix>
     </changelog>
   </subsection>

Modified: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/CookieExample.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/CookieExample.java?rev=1602698&r1=1602697&r2=1602698&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/CookieExample.java (original)
+++ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/CookieExample.java Sun Jun 15 14:00:42 2014
@@ -50,7 +50,7 @@ public class CookieExample extends HttpS
         Cookie aCookie = null;
         if (cookieName != null && cookieValue != null) {
             aCookie = new Cookie(cookieName, cookieValue);
-            aCookie.setPath(request.getServletContext().getContextPath());
+            aCookie.setPath(request.getContextPath() + "/");
             response.addCookie(aCookie);
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org