|
@@ -368,7 +368,7 @@ public final class WebContext {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
// 单位:秒
|
|
|
- if(time > 0) {
|
|
|
+ if(time >= 0) {
|
|
|
cookie.setMaxAge(time);
|
|
|
}
|
|
|
// 将Cookie添加到Response中,使之生效
|
|
@@ -376,6 +376,18 @@ public final class WebContext {
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
+ public static HttpServletResponse expiryCookie(
|
|
|
+ HttpServletResponse response, String domain ,String name, String value) {
|
|
|
+ WebContext.setCookie(response,domain,name, value,0);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static HttpServletResponse setCookie(
|
|
|
+ HttpServletResponse response, String domain ,String name, String value) {
|
|
|
+ WebContext.setCookie(response,domain,name, value,-1);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* get Current Date,eg 2012-07-10.
|
|
|
*
|