views:

136

answers:

2

Hello all, I'm building a Spring MVC application, and the frontController servlet is mapped in "/" intercepting all requests, I'd to be able to serve the static contents (.js,.css,.png...) from tomcat and not by Spring. My app structure is

-webapp/
   styles/
   images/
   WEB-INF/
          views/

By default, because the frontController is mapped on the context root of my app its handles all requests but don't serve any static resource. The mvc configurarion for static resources is follow.

<mvc:resources mapping="/resources/**" location="/"/>

And the page's code is:

<img src="resources/images/logo.png" />

I need to configure Tomcat to serve the static resources with no spring interaction.

Any suggestion?

A: 

Have a look at this mailing list thread and see if that does what you're looking for.

Chris Thompson
Tanks, I've found the solution, only map the static resources extensions to defaultServlet.
Rigoni
A: 

You can remap tomcats default servlet (which handles static content), e.g.

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/images/*</url-pattern>
</servlet-mapping>
nos