I was initially pretty excited about the URL redirect idea, but after some 
testing, it has led me back to the same result.

I can make it work with redirects on either version of tomcat.  Pre and Post 
that patch...
I just can't make the same configuration work for both versions.

As an example: 
Pre-Patch Tomcat 6.0.29.2
The request:
http://localhost:8080/cms/resources/css/gopublish.css

P Status 404 - /cms/resources/css/gopublish.css
type Status report
message /cms/resources/css/gopublish.css
description The requested resource (/cms/resources/css/gopublish.css) is not 
available.

I know I can just move that css folder down to the base of the webapp and the 
above link works great.


Post-Patch Tomcat 6.0.35.1 
The request:
http://localhost:7080/cms/resources/css/gopublish.css
P Status 200's across the board

File structure on both webapps is the same:
webapps/cms/resources/css/gopublish.css

I can re-direct all around and that works great, but if one URL doesn't work to 
address the same asset across versions I am sunk without having code that 
somehow changes the addressing behavior based on the version of Tomcat.

This whole issue was caused (in my reading) by changing the logic from:
getPathInfo()   To ...
getServletPath() + getPathInfo()

So the handling on the backend has change so even if you re-direct something , 
it will be interpreted differently by each container.

Thanks again for the responses, I certainly need all the help I can get.

Russel Morgan



-----Original Message-----
From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] 
Sent: Tuesday, June 05, 2012 1:05 PM
To: Tomcat Users List
Subject: Re: Help Linking Static Content In a WebApp before and after (6.0.30.x)

2012/6/5 Morgan, Russel <russel.mor...@disney.com>:
> Thanks yes that is the change that caused this issue with how we use static 
> content.
>
> I am not sure how I mangled my formatting but I went through and cleaned it 
> up, I hope that helps readability.
>
> Russ
>
>
> Issue formatting recap below:
> =========================
> Tomcat Users:
>
> Has anyone found a graceful way to handle static content linking that works 
> both pre and post the the following change?
> https://issues.apache.org/bugzilla/show_bug.cgi?id=50026
>
> We have quite a few customers on earlier versions of Tomcat 6 as well as new 
> customers picking up later versions that are post this patch.  I am looking 
> for some kind of work around that works in both generations.
>
> Here is an example of what we are doing as far as static linking in our 
> webapp.
>
> So on older tomcat's (prior to 6.0.30) 
> http://localhost:8080/cms/default/css/gopublish.css
> http://localhost:8080/cms/static/css/gopublish.css
> both work to hit items in the root of the webapp so .../cms(as 
> webapp)/css/gopublish.css
>
> (...)
>
> I don't see that this problem can be worked around by servlet mapping or 
> filters, since the core behavior has changed.

Have you looked at UrlRewriteFilter, that I mentioned in my response to the 
first e-mail? A link to it can be found here:

http://wiki.apache.org/tomcat/AddOns

Your configuration could be something like this:
[[[
<urlrewrite>
        <rule>
                <from casesensitive="true">^/static/(.+)</from>
                <to>/$1</to>
        </rule>
        <rule>
                <from casesensitive="true">^/default/(.+)</from>
                <to>/$1</to>
        </rule>
</urlrewrite>
]]]

Best regards,
Konstantin Kolinko

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


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

Reply via email to