java.lang.Object
io.github.mangocrisp.spring.taybct.tool.core.util.ServletUtil

public class ServletUtil extends Object
servlet 工具类
从以下版本开始:
1.0.0
  • 构造器详细资料

    • ServletUtil

      public ServletUtil()
  • 方法详细资料

    • getIpAddr

      public static String getIpAddr()
      获取请求的 ip 地址
      返回:
      String
      从以下版本开始:
      1.0.0
    • getIpAddr

      public static String getIpAddr(jakarta.servlet.http.HttpServletRequest request)
      获取请求的 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

      public static Map<String,String> getHeaders(jakarta.servlet.http.HttpServletRequest request)
      获取请求头
      参数:
      request - 请求对象
      返回:
      Map<String>
      从以下版本开始:
      1.0.0
    • urlEncode

      public static String urlEncode(String str)
      编码内容
      参数:
      str - 编码前的内容
      返回:
      String
      从以下版本开始:
      1.0.0
    • urlDecode

      public static String urlDecode(String str)
      内容解码
      参数:
      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