Better handling of requests that have no cookies

WW-1920


git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/branches/STRUTS_2_0_X@540560 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald J. Brown
2007-05-22 12:31:49 +00:00
parent 0a70a1e477
commit 6b9175c510
@@ -202,17 +202,19 @@ public class CookieInterceptor extends AbstractInterceptor {
Map cookiesMap = new LinkedHashMap();
Cookie cookies[] = request.getCookies();
for (int a=0; a< cookies.length; a++) {
String name = cookies[a].getName();
String value = cookies[a].getValue();
if (cookies != null) {
for (int a=0; a< cookies.length; a++) {
String name = cookies[a].getName();
String value = cookies[a].getValue();
if (cookiesNameSet.contains("*")) {
if (LOG.isDebugEnabled())
LOG.debug("contains cookie name [*] in configured cookies name set, cookie with name ["+name+"] with value ["+value+"] will be injected");
populateCookieValueIntoStack(name, value, cookiesMap, stack);
}
else if (cookiesNameSet.contains(cookies[a].getName())) {
populateCookieValueIntoStack(name, value, cookiesMap, stack);
if (cookiesNameSet.contains("*")) {
if (LOG.isDebugEnabled())
LOG.debug("contains cookie name [*] in configured cookies name set, cookie with name ["+name+"] with value ["+value+"] will be injected");
populateCookieValueIntoStack(name, value, cookiesMap, stack);
}
else if (cookiesNameSet.contains(cookies[a].getName())) {
populateCookieValueIntoStack(name, value, cookiesMap, stack);
}
}
}