Hello,
I'm not a tomcat configuration expert, but I'm pretty sure that this is
container related thing and it is configurable.
See:
http://stackoverflow.com/questions/3856145/empty-page-instead-of-custom-tomcat-error-page
or look into tomcat documentation.
Regards,
Pavel
On 8/30/12 10:13 PM, Vinicius Carvalho wrote:
> Hello there! This is bugging me for a couple of hours now.
>
> We are running jersey 1.1.13 inside tomcat.
>
> We don't want to have tomcat exposing those error pages as content
> body whenever an error happens. Even using ExceptionMappers I found
> out that jersey uses response.sendError instead of response.setStatus
> at the WebComponent class:
>
> if (cResponse.getStatus() >= 400) {
>
> if (useSetStatusOn404 && cResponse.getStatus() == 404) {
>
> response.setStatus(cResponse.getStatus());
>
> } else {
>
> final String reason = cResponse.getStatusType().getReasonPhrase();
>
> if (reason == null || reason.isEmpty()) {
>
> response.sendError(cResponse.getStatus());
>
> } else {
>
> response.sendError(cResponse.getStatus(), reason);
>
> }
>
> }
>
> } else {
>
> response.setStatus(cResponse.getStatus());
>
> }
>
>
> I really would like to avoid having to configure empty html pages at
> <error> section of my web.xml. Isn't there a way to just force the
> Response to be empty?
>
>
> I "fixed" this by making this call inside my Mapper:
>
>
> return
> Response.status(Status.NOT_FOUND).type(MediaType.TEXT_PLAIN).entity("
> ").build();
>
>
> But it feels so ugly to me, I really would love if:
>
> return Response.status(Status.NOT_FOUND).build();
>
> Could just work with empty response bodies and not default to
> container specific error pages.
>
>
> Any way to fix this?
>
>
> Regards
>
>