MCPcopy Create free account
hub / github.com/diyhi/bbs / deleteCookie

Method deleteCookie

src/main/java/cms/utils/WebUtil.java:242–252  ·  view source on GitHub ↗

删除Cookie

(HttpServletResponse response, String name)

Source from the content-addressed store, hash-verified

240 * 删除Cookie
241 */
242 public static void deleteCookie(HttpServletResponse response, String name){
243 Cookie cookie = new Cookie(name, null);
244 //设置为0为立即删除该Cookie
245 cookie.setMaxAge(0);
246 //删除指定路径上的Cookie,不设置该路径,默认为删除当前路径Cookie
247 cookie.setPath("/");
248 response.addCookie(cookie);
249
250
251
252 }
253
254 protected static Map<String, Cookie> readCookieMap(HttpServletRequest request) {
255 Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();

Callers 2

loginMethod · 0.95
logoutMethod · 0.95

Calls 2

setPathMethod · 0.80
addCookieMethod · 0.80

Tested by

no test coverage detected