I found a fix :) Thanks again for all the replies, the thought that if a resource wasn't mapped it would drop to the default servlet got me thinking.
I did some looking and it was actually my spring dispatcher picking up /* and causing calls to static resources to fail as the dispatcher picked them up. <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> Sure enough if I commented that out, then my static paths worked great. Obviously this killed my application though, as the dispatcher wasn't handling requests. I did a bunch of searching around and reading on Spring and found that adding the following entries to my spring config allowed me to control routing on the 5 versions of tomcat I tested perfectly. What I added to my appicationContext.xml xmlns:mvc="http://www.springframework.org/schema/mvc" Then to go with that the following schema locations: http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd <mvc:resources mapping="/resources/**" location="/"/> <mvc:default-servlet-handler/> (info on that last little gem, which still "feels" hacky) 16.14.6 mvc:default-servlet-handler This tag allows for mapping the DispatcherServlet to "/" (thus overriding the mapping of the container's default Servlet), while still allowing static resource requests to be handled by the container's default Servlet. It configures a DefaultServletHttpRequestHandler with a URL mapping of "/**" and the lowest priority relative to other URL mappings. This handler will forward all requests to the default Servlet. Therefore it is important that it remains last in the order of all other URL HandlerMappings. That will be the case if you use <mvc:annotation-driven> or alternatively if you are setting up your own customized HandlerMapping instance be sure to set its order property to a value lower than that of the DefaultServletHttpRequestHandler, which is Integer.MAX_VALUE. Thanks again everyone! Russ -----Original Message----- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Wednesday, June 06, 2012 6:30 AM To: Tomcat Users List Subject: Re: Help Linking Static Content In a WebApp before and after (6.0.30.x) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Russel, On 6/6/12 8:45 AM, Morgan, Russel wrote: > So if I bundle the default servlet with my application and then > configure it to run as a different named servlet, and map static > resources to it within the webapp that should work? (I will certainly > try that) > > Also, all "tricks" aside, what is the proper way to address static > assets deployed within a webapplication, if pathing them to the > default servlet is inappropriate? What's wrong with letting the DefaultServlet continue to do its normal job by serving every resource that isn't otherwise mapped? > Forgive my ignorance but couldn't I just set this in my webapp xml > descriptor, and "rename" it, and then path to it? Why bother? If /resources/css/gopublish.css isn't mapped explicitly, then the DefaultServlet will look in your webapp's /resources/css/ directory for gopublish.css and serve the bytes no problem. > Perhaps the fact that the code is loaded by the webapp class loader > makes a difference , I am not sure. (just ruling out this > possibility) It does not matter. I think I've gotten lost... what are you actually trying to accomplish, here? Do you have a bunch of static content that is outside of the webapp's docBase that you want to serve from within its URL space? Any possibility that you could upgrade to Tomcat 7 which has "aliases" which can do this? - -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/PW0sACgkQ9CaO5/Lv0PBAkgCcD8hn/ZtuZal8QQNyFOCNepJc 5+gAnjzbuNER8okInm+w2qXvXkvfSvr3 =v2ck -----END PGP SIGNATURE----- --------------------------------------------------------------------- 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