yemista
yemista

Reputation: 433

How does JBoss implement HttpServletResponse setStatus() vs sendError()

I understand that when you call the sendError() method on the response, it will close the response, however, if you call setStatus() with an error code, such as 404, does that also close the response?

Upvotes: 0

Views: 152

Answers (1)

Andy Turner
Andy Turner

Reputation: 140534

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.

Upvotes: 1

Related Questions