Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,13 +22,15 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Helper class for cookie generation, carrying cookie descriptor settings
|
||||
* as bean properties and being able to add and remove cookie to/from a
|
||||
* given response.
|
||||
*
|
||||
* <p>Can serve as base class for components that generate specific cookies,
|
||||
* like CookieLocaleResolcer and CookieThemeResolver.
|
||||
* such as CookieLocaleResolver and CookieThemeResolver.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1.4
|
||||
@@ -177,6 +179,7 @@ public class CookieGenerator {
|
||||
* @see #setCookieMaxAge
|
||||
*/
|
||||
public void addCookie(HttpServletResponse response, String cookieValue) {
|
||||
Assert.notNull(response, "HttpServletResponse must not be null");
|
||||
Cookie cookie = createCookie(cookieValue);
|
||||
Integer maxAge = getCookieMaxAge();
|
||||
if (maxAge != null) {
|
||||
@@ -204,6 +207,7 @@ public class CookieGenerator {
|
||||
* @see #setCookiePath
|
||||
*/
|
||||
public void removeCookie(HttpServletResponse response) {
|
||||
Assert.notNull(response, "HttpServletResponse must not be null");
|
||||
Cookie cookie = createCookie("");
|
||||
cookie.setMaxAge(0);
|
||||
response.addCookie(cookie);
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletRequestWrapper;
|
||||
@@ -199,7 +198,6 @@ public abstract class WebUtils {
|
||||
if (servletContext == null) {
|
||||
return null;
|
||||
}
|
||||
Assert.notNull(servletContext, "ServletContext must not be null");
|
||||
String param = servletContext.getInitParameter(HTML_ESCAPE_CONTEXT_PARAM);
|
||||
return (StringUtils.hasText(param)? Boolean.valueOf(param) : null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user