public class WebUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_MAX_AGE |
| 构造器和说明 |
|---|
WebUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
clearCookie(javax.servlet.http.HttpServletResponse response,
String key) |
static void |
clearCookie(String key) |
static String |
getCookieVal(javax.servlet.http.HttpServletRequest request,
String name) |
static String |
getCookieVal(String name) |
static javax.servlet.http.HttpServletRequest |
getRequest() |
static org.springframework.web.context.request.RequestAttributes |
getRequestAttributes() |
static String |
getRequestIP() |
static String |
getRequestIP(javax.servlet.http.HttpServletRequest request) |
static String |
getRequestToken(javax.servlet.http.HttpServletRequest httpRequest,
String tokenName) |
static String |
getRequestToken(javax.servlet.http.HttpServletRequest httpRequest,
String tokenName,
boolean isHeader,
boolean isParameter) |
static javax.servlet.http.HttpServletResponse |
getResponse() |
static org.springframework.http.HttpHeaders |
getResponseHeaders(org.springframework.http.MediaType mediaType) |
static javax.servlet.http.HttpSession |
getSession() |
static org.springframework.web.servlet.view.RedirectView |
redirect(String uri) |
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
String name,
String value) |
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
String name,
String value,
int maxAgeInSeconds) |
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
String domain,
String name,
String value,
int maxAgeInSeconds) |
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
String domain,
String path,
String name,
String value,
int maxAgeInSeconds) |
static void |
setCookie(String name,
String value) |
static void |
setCookie(String name,
String value,
int maxAgeInSeconds) |
static void |
setCookie(String domain,
String name,
String value,
int maxAgeInSeconds) |
static void |
setCookie(String domain,
String path,
String name,
String value,
int maxAgeInSeconds) |
static org.springframework.web.servlet.ModelAndView |
toView(String viewPath) |
static org.springframework.web.servlet.ModelAndView |
toView(String viewPath,
Map context) |
static void |
writeAttach(javax.servlet.http.HttpServletResponse response,
String filename,
byte[] content)
返回附件
|
static void |
writeJSON(javax.servlet.http.HttpServletResponse response,
Object object)
返回JSON字符串
|
public static final int DEFAULT_MAX_AGE
@Nullable public static javax.servlet.http.HttpServletRequest getRequest()
@Nullable public static javax.servlet.http.HttpServletResponse getResponse()
@Nullable public static org.springframework.web.context.request.RequestAttributes getRequestAttributes()
@Nullable public static org.springframework.http.HttpHeaders getResponseHeaders(org.springframework.http.MediaType mediaType)
@Nullable public static String getCookieVal(javax.servlet.http.HttpServletRequest request, String name)
public static void setCookie(String domain, String name, @Nullable String value, int maxAgeInSeconds)
public static void setCookie(String domain, String path, String name, @Nullable String value, int maxAgeInSeconds)
public static void setCookie(javax.servlet.http.HttpServletResponse response,
String name,
@Nullable
String value)
public static void setCookie(javax.servlet.http.HttpServletResponse response,
String name,
@Nullable
String value,
int maxAgeInSeconds)
public static void setCookie(javax.servlet.http.HttpServletResponse response,
String domain,
String name,
@Nullable
String value,
int maxAgeInSeconds)
public static void setCookie(javax.servlet.http.HttpServletResponse response,
String domain,
String path,
String name,
@Nullable
String value,
int maxAgeInSeconds)
public static void clearCookie(String key)
public static void clearCookie(javax.servlet.http.HttpServletResponse response,
String key)
public static javax.servlet.http.HttpSession getSession()
public static org.springframework.web.servlet.ModelAndView toView(String viewPath)
public static org.springframework.web.servlet.ModelAndView toView(String viewPath, Map context)
public static org.springframework.web.servlet.view.RedirectView redirect(String uri)
public static String getRequestIP()
public static String getRequestToken(javax.servlet.http.HttpServletRequest httpRequest, String tokenName)
public static String getRequestToken(javax.servlet.http.HttpServletRequest httpRequest, String tokenName, boolean isHeader, boolean isParameter)
public static String getRequestIP(javax.servlet.http.HttpServletRequest request)
public static void writeAttach(javax.servlet.http.HttpServletResponse response,
String filename,
byte[] content)
throws IOException,
IOException
response - 响应filename - 文件名content - 附件内容IOExceptionpublic static void writeJSON(javax.servlet.http.HttpServletResponse response,
Object object)
response - 响应object - 对象,会序列化成 JSON 字符串Copyright © 2023 wuyushuo. All rights reserved.