I'm simply trying to set HTTP status code for the Http Servlet Response. And this works perfectly in development with TomCat 7. But on the customers server, which runs TomCat6 (6.0.36) the command is simply ignored.
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
I even tried to do a
response.flushBuffer();
to commit the setStatus, but with no luck.
What am I missing? According to the TomCat 6.0 docs the setStatus()
works just the same as in version 7.
Obviously one solution is to upgrade the clients TomCat server, but we want to avoid that.
-Thank you.
I usually use HttpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND); You may want to give this a try.