tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Modify HTTP status returned by stopped context
Date Tue, 19 Jun 2012 00:42:33 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kyle,

On 6/18/12 3:52 PM, kharper2@oreillyauto.com wrote:
> Thank you for the direction.  I created my own servlet which loads
> without error.  Here is how I've configured it:

Where did you configure this? Which webapp's web.xml?

> <servlet> <servlet-name>HttpResponseAdjuster</servlet-name> 
> <servlet-class>bla.bla.tomcat.ReturnNotAvailableServlet</servlet-class>
>
> 
<load-on-startup>1</load-on-startup>

You don't need to load this on startup if you don't want to: the
servlet will be initialized when necessary.

> </servlet>
> 
> <servlet-mapping> 
> <servlet-name>HttpResponseAdjuster</servlet-name> 
> <url-pattern>/foo/*</url-pattern> </servlet-mapping>
> 
> <servlet-mapping> 
> <servlet-name>HttpResponseAdjuster</servlet-name> 
> <url-pattern>/Testing/*</url-pattern> </servlet-mapping>
> 
> Unfortunately, when I stop the "foo" context, tomcat is still
> returning the default HTTP 404 page.  It doesn't appear to give any
> consideration to the servlet mapping in my ROOT context.  Unless
> I've configured something wrong, it appears the desired behavior
> (to look for /Context first, then a ROOT servlet with mapping of
> /Context/*) isn't happening.

Yes, the longest match should win.

> You'll notice I setup another servlet-mapping called /Testing/*.
> "Testing" is NOT a context.  When I go to myserver:8080/Testing my
> servlet handles the request and does what I desire (HTTP 503).  To
> reiterate, my version of tomcat is 6.0.24.  Perhaps the logic we're
> relying on wasn't introduced until later?  Or maybe I'm missing a
> configuration option at a higher level to send failed requests to
> search the ROOT context for mappings?

Assuming you have everything configured as described, then your
expected behavior is also what I'd expect.  Please test with latest
6.0 which is 6.0.35. If that doesn't work, please also test with
7.0.28 (freshly minted this weekend) and let us know if you have more
success.

If it does not work with 6.0.35 or it does not work with 7.0.28, can
you create a simple test case (ROOT.war + some other WAR w/overlapping
URI spaces) and create a Bugzilla ticket for it (or 2, if the bug
exists in both versions)?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/fyvkACgkQ9CaO5/Lv0PBkvwCgiZ9fDieTRdPSJTkrphxRn7Yi
CoUAoJy5RTwqSwSLCJe5hrnpmw747k4O
=5ESc
-----END PGP SIGNATURE-----

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


Mime
View raw message