类 ServletUtil
java.lang.Object
io.github.mangocrisp.spring.taybct.tool.core.util.ServletUtil
servlet 工具类
- 从以下版本开始:
- 1.0.0
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static void
genResponse
(jakarta.servlet.http.HttpServletResponse response, org.springframework.http.HttpStatus status, String json) 获取响应getHeaders
(jakarta.servlet.http.HttpServletRequest request) 获取请求头static String
获取请求的 ip 地址static String
getIpAddr
(jakarta.servlet.http.HttpServletRequest request) 获取请求的 ip 地址static jakarta.servlet.http.HttpServletRequest
获取 requeststatic org.springframework.web.context.request.ServletRequestAttributes
static jakarta.servlet.http.HttpServletResponse
获取 responsestatic String
内容解码static String
编码内容
-
构造器详细资料
-
ServletUtil
public ServletUtil()
-
-
方法详细资料
-
getIpAddr
获取请求的 ip 地址- 返回:
- String
- 从以下版本开始:
- 1.0.0
-
getIpAddr
获取请求的 ip 地址- 参数:
request
- 请求对象- 返回:
- String
- 从以下版本开始:
- 1.0.0
-
getRequest
public static jakarta.servlet.http.HttpServletRequest getRequest()获取 request- 返回:
- HttpServletRequest
- 从以下版本开始:
- 1.0.0
-
getResponse
public static jakarta.servlet.http.HttpServletResponse getResponse()获取 response- 返回:
- HttpServletResponse
- 从以下版本开始:
- 1.0.0
-
getRequestAttributes
public static org.springframework.web.context.request.ServletRequestAttributes getRequestAttributes() -
getHeaders
获取请求头- 参数:
request
- 请求对象- 返回:
- Map<String>
- 从以下版本开始:
- 1.0.0
-
urlEncode
编码内容- 参数:
str
- 编码前的内容- 返回:
- String
- 从以下版本开始:
- 1.0.0
-
urlDecode
内容解码- 参数:
str
- 解码的内容- 返回:
- String
- 从以下版本开始:
- 1.0.0
-
genResponse
public static void genResponse(jakarta.servlet.http.HttpServletResponse response, org.springframework.http.HttpStatus status, String json) throws IOException 获取响应- 参数:
response
- response 对象status
- 状态json
- 需要输出的 json- 抛出:
IOException
- 从以下版本开始:
- 1.0.0
-