Repository: wicket
Updated Branches:
  refs/heads/master 99a042959 -> 584b7f6a2


WICKET-6570 escape component cookies only


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/584b7f6a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/584b7f6a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/584b7f6a

Branch: refs/heads/master
Commit: 584b7f6a20aa1ac2aaa3751c3e45283f481d1bcf
Parents: 99a0429
Author: Sven Meier <svenme...@apache.org>
Authored: Tue Sep 25 13:02:18 2018 +0200
Committer: xzr <x...@oerag.de>
Committed: Tue Sep 25 13:04:45 2018 +0200

----------------------------------------------------------------------
 .../apache/wicket/util/cookies/CookieUtils.java  | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/584b7f6a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java 
b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
index fb6cfc0..5bce94f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
@@ -105,7 +105,7 @@ public class CookieUtils
         */
        protected String getKey(final FormComponent<?> component)
        {
-               return component.getPageRelativePath();
+               return getSaveKey(component.getPageRelativePath());
        }
 
        /**
@@ -146,18 +146,17 @@ public class CookieUtils
        /**
         * Create a Cookie with key and value and save it in the browser with 
the next response
         *
-        * @param key
+        * @param name
         *          The cookie name
         * @param value
         *          The cookie value
         */
-       public final void save(String key, final String value)
+       public final void save(String name, final String value)
        {
-               key = getSaveKey(key);
-               Cookie cookie = getCookie(key);
+               Cookie cookie = getCookie(name);
                if (cookie == null)
                {
-                       cookie = new Cookie(key, value);
+                       cookie = new Cookie(name, value);
                }
                else
                {
@@ -231,22 +230,20 @@ public class CookieUtils
         */
        public Cookie getCookie(final String name)
        {
-               String key = getSaveKey(name);
-
                try
                {
                        WebRequest webRequest = getWebRequest();
-                       Cookie cookie = webRequest.getCookie(key);
+                       Cookie cookie = webRequest.getCookie(name);
                        if (log.isDebugEnabled())
                        {
                                if (cookie != null)
                                {
-                                       log.debug("Found Cookie with name=" + 
key + " and request URI=" +
+                                       log.debug("Found Cookie with name=" + 
name + " and request URI=" +
                                                        
webRequest.getUrl().toString());
                                }
                                else
                                {
-                                       log.debug("Unable to find Cookie with 
name=" + key + " and request URI=" +
+                                       log.debug("Unable to find Cookie with 
name=" + name + " and request URI=" +
                                                        
webRequest.getUrl().toString());
                                }
                        }

Reply via email to