类 Exchange


  • public class Exchange
    extends Object
    • 字段详细资料

      • req

        public final jakarta.servlet.http.HttpServletRequest req
      • res

        public final jakarta.servlet.http.HttpServletResponse res
      • statusCode

        protected int statusCode
      • maxRequestBodySize

        protected int maxRequestBodySize
      • cachedBody

        protected byte[] cachedBody
      • DEFAULT_BUFFER_SIZE

        protected static final int DEFAULT_BUFFER_SIZE
        另请参阅:
        常量字段值
      • headersCommitted

        protected boolean headersCommitted
      • closed

        protected boolean closed
    • 构造器详细资料

      • Exchange

        public Exchange​(jakarta.servlet.http.HttpServletRequest req,
                        jakarta.servlet.http.HttpServletResponse res)
    • 方法详细资料

      • method

        public String method()
      • headers

        public Map<String,​List<String>> headers()
        读取所有请求头(只读视图)
      • status

        public Exchange status​(int code)
      • redirect

        public void redirect​(String location)
      • download

        public void download​(File file,
                             String filename)
      • html

        public void html​(String htmlContent)
      • json

        public void json​(Object obj)
        可插拔 JSON 输出(需要先设置 JsonAdapter)
      • attr

        public <T> T attr​(String name)
      • bytes

        public byte[] bytes()
      • maxRequestBodySize

        public void maxRequestBodySize​(int size)
      • result

        public void result​(Object obj)
      • result

        public void result​(byte[] bytes)
      • checkedParam

        public <T> T checkedParam​(Class<T> targetClass)
      • checkedParam

        public <T> T checkedParam​(Class<T> targetClass,
                                  Class<?>... groups)
      • checkedBody

        public <T> T checkedBody​(Class<T> targetClass)
      • checkedBody

        public <T> T checkedBody​(Class<T> targetClass,
                                 Class<?>... groups)
      • check

        public <T> T check​(T bean,
                           Class<T> targetClass,
                           Class<?>... groups)