WICKET-5648 CookieUtils - add #loadValues(), make #getCookie() public, properly 
initialize from the defaults

Deprecate all multivalue related methods.
It is not possible to deprecate #save(Strng key, String... values) because most 
of the time it is used by the applications as #save(key, value)

(cherry picked from commit f7e66e61e3097d32b7767890208436b508747ef1)


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

Branch: refs/heads/master
Commit: b590d19bab446b2e8983b36d4f42c71e018d4bcd
Parents: 388b150
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Mon Aug 4 12:12:34 2014 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Mon Aug 4 12:21:20 2014 +0200

----------------------------------------------------------------------
 .../org/apache/wicket/util/cookies/CookieUtils.java    | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/b590d19b/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 0f1f315..1859d96 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
@@ -135,7 +135,7 @@ public class CookieUtils
                if (value != null)
                {
                        // Assign the retrieved/persisted value to the component
-                       formComponent.setModelValue(splitValue(value));
+                       formComponent.setModelValue(new String[] {value});
                }
                return value;
        }
@@ -145,7 +145,9 @@ public class CookieUtils
         * 
         * @param value
         * @return The cookie's value split into fragments
+        * @deprecated Cookies with multiple values are no more supported 
(WICKET-5648). This method will be removed in Wicket 7.x
         */
+       @Deprecated
        protected String[] splitValue(final String value)
        {
                return Strings.split(value, 
FormComponent.VALUE_SEPARATOR.charAt(0));
@@ -156,7 +158,9 @@ public class CookieUtils
         * 
         * @param values
         * @return The cookie's value split into its constituent parts
+        * @deprecated Cookies with multiple values are no more supported 
(WICKET-5648). This method will be removed in Wicket 7.x
         */
+       @Deprecated
        protected String joinValues(final String... values)
        {
                return Strings.join(FormComponent.VALUE_SEPARATOR, values);
@@ -255,18 +259,19 @@ public class CookieUtils
 
                try
                {
-                       Cookie cookie = getWebRequest().getCookie(key);
+                       WebRequest webRequest = getWebRequest();
+                       Cookie cookie = webRequest.getCookie(key);
                        if (log.isDebugEnabled())
                        {
                                if (cookie != null)
                                {
                                        log.debug("Found Cookie with name=" + 
key + " and request URI=" +
-                                               
getWebRequest().getUrl().toString());
+                                                       
webRequest.getUrl().toString());
                                }
                                else
                                {
                                        log.debug("Unable to find Cookie with 
name=" + key + " and request URI=" +
-                                               
getWebRequest().getUrl().toString());
+                                                       
webRequest.getUrl().toString());
                                }
                        }
 

Reply via email to