Mark,

Very slick.  I wasn't aware of the longest-matching logic.  I'll give this
a whirl and report back.

Thanks,
Kyle Harper




From:   Mark Thomas <ma...@apache.org>
To:     Tomcat Users List <users@tomcat.apache.org>
Date:   06/14/2012 03:19 PM
Subject:        Re: Modify HTTP status returned by stopped context



On 14/06/2012 20:37, kharp...@oreillyauto.com 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.

HTH,

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



This communication and any attachments are confidential, protected by 
Communications Privacy Act 18 USCS ยง 2510, solely for the use of the intended 
recipient, and may contain legally privileged material. If you are not the 
intended recipient, please return or destroy it immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to