|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package ${basePackage}.frame.utils;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.Cookie;
|
|
|
|
|
import ${basePackage}.frame.auth.LocalData;
|
|
|
|
|
import javax.servlet.http.Cookie;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* CookieUtil
|
|
|
|
@ -31,4 +33,18 @@ public class CookieUtil {
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成一个默认的Cookie
|
|
|
|
|
*
|
|
|
|
|
* @param cookies Cookies
|
|
|
|
|
* @return passportID
|
|
|
|
|
*/
|
|
|
|
|
public static Cookie newCookie(String key, String value) {
|
|
|
|
|
HttpServletRequest request = LocalData.getRequest();
|
|
|
|
|
Cookie cookie = new Cookie(key, value);
|
|
|
|
|
cookie.setDomain(request.getServerName());
|
|
|
|
|
cookie.setPath(request.getContextPath());
|
|
|
|
|
return cookie;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|