Disable all default HTTP error response content in Tomcat

后端 未结 8 1385
感情败类
感情败类 2020-11-30 22:20

By default, Tomcat sends some HTML content back to the client if it encounters something like an HTTP 404. I know that via web.xml an

8条回答
  •  温柔的废话
    2020-11-30 22:42

    Though this question is a bit old, I ran into this problem too. First of all, Tomcat's behavior is absolutely correct. This is per Servlet Spec. One should not alter Tomcat's behavior against the spec. As Heikki Vesalainen and mrCoder mentioned, use setStatus and setStatus only.

    To whom it may concern, I have raised a ticket with Tomcat to improve the docs of sendError.

提交回复
热议问题