Sending 100 Continue using Java Servlet API

后端 未结 4 1546
小蘑菇
小蘑菇 2021-01-14 15:46

Is it possible to send \"100 Continue\" HTTP status code, and then later some other status code after processing entire request using Java Servlet API (HttpServletResponse)?

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 16:48

    I assume you mean "100 Continue".

    The answer is: no, you can't (at least not the way it's intended, as provisional response). In general, the servlet engine will do it automatically, when the request requires it. Of course this makes it impossibe for the servlet to prevent sending the 100 status -- this issue is a known problem in the Servlet API, and has been known for what feels like eons now.

提交回复
热议问题