据我所知,当您对响应调用 sendError() 方法时,它将关闭响应,但是,如果您使用错误代码(例如 404)调用 setStatus() ,是否也会关闭响应?
最佳答案
No :
If this method is used to set an error code, then the container's error page mechanism will not be triggered. If there is an error and the caller wishes to invoke an error page defined in the web application, then sendError(int, java.lang.String) must be used instead.
关于java - JBoss 如何实现 HttpServletResponse setStatus() 与 sendError(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34998331/