tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: DefaultServlet subclass behavior change TC6 to 8
Date Wed, 25 Apr 2018 21:07:46 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Daryl,

On 4/25/18 4:08 PM, Daryl Stultz wrote:
> We are upgrading from Tomcat 6 to Tomcat 8.5. We have a servlet
> that extends org.apache.catalina.servlets.DefaultServlet. We
> override getRelativePath(HttpServletRequest request), that's all.
> 
> 
> The purpose of this servlet is to do a sort of redirect, the
> browser asks for a spreadsheet "my-site.css" which is mapped to our
> servlet. In getRelativePath we return "my-site-prod.css" or
> "my-site-test.css" for example depending on the environment the
> application is running in.
> 
> 
> If I override doGet (calling super) I can see that doGet is called
> but getRelativePath is never called and the browser gets a 404
> error for "my-site.css".
> 
> 
> Anyone know what I need to change to restore the behavior as it was
> in Tomcat 6? I'm afraid I inherited this code so it's hard to say
> why it was done this way.

This would be MUCH easier using url-rewriting than subclassing
DefaultServlet and changing the way it behaves.

I *highly* recommend that you check this out:

https://tomcat.apache.org/tomcat-8.5-doc/rewrite.html
or
http://tuckey.org/urlrewrite/

and ditch the DefaultServlet subclass.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrg7iIACgkQHPApP6U8
pFgwlBAArR/EYd3uz9BTzATFJyP9OeJhj1g10SZU715lzJnP0grGR7YzuWDHYUcr
yFVVHCGdj3xZIXj3APFjbXMT1IhhSblBm0pr8lK8S6TDHW9z9em0xGF8KtKZapYd
qvzrN/xB0BSspG6zprgU2vrnQOTEVOFaEAjTOCDzULc5Y9GSjGbD3HRlF8bUbryo
i5f3aoinazrbF2gjIUCKBqh/ngB5ILy2i4pzey0uqyQ6E0are4sRgbqA9cwvpQxp
27F9JD9EZ51TYlNLys7kjtxisSZX9HR2v95YnwJWDjd//ZcpwOAytr+ZSpDBXw55
5qvvBzNXi/wwQMhNcKRvwI9yhThl8b3nCsayQtkDvUn+zrbOBxGJXQluKL//TCGf
oI4OW2v4Pjs1RP4eqKKmehI52aGcAeUNNVu4u54FfQwKS8+18ssDe5qJaYS5oW0T
sFXT6rzZN2kahcMaVBT1jzl8+UR5qdP+hO6xH92PcEUY/AHCHErPq/1WNzrkiV0e
6qHo2TToKdl7ZEGcX60y/h2B5ZrP9rtH4zFV5z0GhIZsj0AI3sU+1ehZZX3wV/Tv
AA4RjqAVbeHaU3IbvaZ5Z/m5Nben08HE5YSpG+A63jUiCbSapxV1EU9bQCyG5HQU
UzeNZ5ZKWLPYGx4lgAVjUogkNautSQmGLMnv04+8JZmWOFO5n3Q=
=zsh4
-----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