Added clearCookie().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1248 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: UserManager.java,v 1.19 2003/10/08 23:52:50 ray Exp $
|
||||
// $Id: UserManager.java,v 1.20 2003/10/09 00:48:37 ray Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -261,10 +261,7 @@ public class UserManager
|
||||
}
|
||||
|
||||
// set them up the bomb
|
||||
Cookie rmcookie = new Cookie(USERAUTH_COOKIE, authcode);
|
||||
rmcookie.setPath("/");
|
||||
rmcookie.setMaxAge(0);
|
||||
rsp.addCookie(rmcookie);
|
||||
CookieUtil.clearCookie(rsp, USERAUTH_COOKIE);
|
||||
}
|
||||
|
||||
/** The user repository. */
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
//
|
||||
// $Id: CookieUtil.java,v 1.1 2003/10/06 22:50:28 ray Exp $
|
||||
// $Id: CookieUtil.java,v 1.2 2003/10/09 00:48:37 ray Exp $
|
||||
|
||||
package com.samskivert.servlet.util;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Utility methods for dealing with cookies.
|
||||
@@ -37,4 +38,15 @@ public class CookieUtil
|
||||
Cookie c = getCookie(req, name);
|
||||
return (c == null) ? null : c.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cookie with the specified name.
|
||||
*/
|
||||
public static void clearCookie (HttpServletResponse rsp, String name)
|
||||
{
|
||||
Cookie c = new Cookie(name, "x");
|
||||
c.setPath("/");
|
||||
c.setMaxAge(0);
|
||||
rsp.addCookie(c);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user