|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -37,7 +37,7 @@ import org.springframework.web.util.WebUtils; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ServletCookieValueMethodArgumentResolver extends AbstractCookieValueMethodArgumentResolver { |
|
|
|
public class ServletCookieValueMethodArgumentResolver extends AbstractCookieValueMethodArgumentResolver { |
|
|
|
|
|
|
|
|
|
|
|
private UrlPathHelper urlPathHelper = UrlPathHelper.defaultInstance; |
|
|
|
private UrlPathHelper urlPathHelper = new UrlPathHelper(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ServletCookieValueMethodArgumentResolver(@Nullable ConfigurableBeanFactory beanFactory) { |
|
|
|
public ServletCookieValueMethodArgumentResolver(@Nullable ConfigurableBeanFactory beanFactory) { |
|
|
|
@ -45,6 +45,23 @@ public class ServletCookieValueMethodArgumentResolver extends AbstractCookieValu |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Whether to apply URL decoding to cookie values via |
|
|
|
|
|
|
|
* {@link UrlPathHelper#decodeRequestString(HttpServletRequest, String)}. |
|
|
|
|
|
|
|
* A shortcut for doing the same by setting a {@link UrlPathHelper} with |
|
|
|
|
|
|
|
* its {@code urlDecode} property set accordingly. |
|
|
|
|
|
|
|
* <p>By default set to "true" in which case cookie values are decoded. |
|
|
|
|
|
|
|
* @since 6.1.2 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setUrlDecode(boolean urlDecode) { |
|
|
|
|
|
|
|
this.urlPathHelper.setUrlDecode(urlDecode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set the {@code UrlPathHelper} to use to decode cookie values with via |
|
|
|
|
|
|
|
* {@link UrlPathHelper#decodeRequestString(HttpServletRequest, String)}. |
|
|
|
|
|
|
|
* For most cases you can use {@link #setUrlDecode(boolean)} instead. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void setUrlPathHelper(UrlPathHelper urlPathHelper) { |
|
|
|
public void setUrlPathHelper(UrlPathHelper urlPathHelper) { |
|
|
|
this.urlPathHelper = urlPathHelper; |
|
|
|
this.urlPathHelper = urlPathHelper; |
|
|
|
} |
|
|
|
} |
|
|
|
|