tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: Modify HTTP status returned by stopped context
Date Thu, 14 Jun 2012 20:11:48 GMT
On 14/06/2012 20:37, wrote:
> Hello,
> I am running multiple web applications on a tomcat server.  When a request
> to a context in the stopped state is made, tomcat is returning 404 "not
> found" rather than 503 "unavailable".  Is it possible to change this
> behavior in any way?  Obviously I can't just modify _all_ HTTP 404
> responses to 503.  Just those which are coming from a context in the
> stopped state.

Assume the context in question is /foo

In the ROOT web application add a servlet with a mapping of /foo/*

The servlet should just return a 503 (or any other error code)

This works because the mapping rules require the longest match to the
context be considered first. While /foo is running, requests will be
mapped to the /foo context and the servlet in the ROOT web application
is ignored. When /foo is not running, the request is mapped to the
servlet in the ROOT web app.

This obviously won't work for stopping the ROOT web app.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message