public final class ServletUtil extends Object
Modifier and Type | Method and Description |
---|---|
static javax.servlet.http.Cookie |
getCookie(javax.servlet.http.HttpServletRequest request,
String cookieName)
Gets a cookie from the current request.
|
static void |
putCookie(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.Cookie cookie)
Puts a cookie in the current response.
|
public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String cookieName)
request
- Request to get the cookie from.cookieName
- The name of the cookie.NullPointerException
- When either the supplied request or
cookieName is null.IllegalArgumentException
- When the supplied cookieName is empty.public static void putCookie(javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie cookie)
response
- Response to add the cookie to.cookie
- The cookie to put in the current response.NullPointerException
- When either the supplied response or cookie
is null.Copyright © 2008–2018. All rights reserved.