1

I need to expose some static content (xsd files that are required by the wsdl). I cannot use the mvn:resources since it is not available in Spring 3.0.0

I don't have an idea as to where the static content should go. Hope someone can help me.

In my web.xml i have

    <servlet>
        <servlet-name>Resources</servlet-name>
        <servlet-class>org.springframework.web.servlet.ResourceServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Resources</servlet-name>
        <url-pattern>/resources/*</url-pattern>
    </servlet-mapping>

then in the webapp dir I added a resources dir with the static files.

% ls webapp 
index.jsp  META-INF  resources  WEB-INF

can someone tell me where the static content should go.

thanks much.

user290870
  • 1,591
  • 3
  • 19
  • 27
  • Based on the following threads http://stackoverflow.com/questions/3829369/spring-serving-static-content-with-mvcresources-invalid-xsd and http://stackoverflow.com/questions/9085964/why-does-this-spring-config-file-not-resolve-the-mvcresources-element that doesn't seem to be the case. I get the following error. How do I resolve in 3.0.0. org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources'. – user290870 Sep 18 '12 at 08:31

2 Answers2

1

Dont forget this one aswell:

<!-- Allows for mapping the DispatcherServlet to "/" by forwarding static resource 
requests to the container's default Servlet -->
<mvc:default-servlet-handler/>
Solubris
  • 3,603
  • 2
  • 22
  • 37
0

You wrote

I cannot use the mvn:resources since it is not available in Spring 3.0.0

This is complete wrong!

mvn:resources is avaiable in Spring mvc namespace for version 3.0.0 3.0.4

See the xsd: http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

Ralph
  • 118,862
  • 56
  • 287
  • 383
  • Based on the following threads http://stackoverflow.com/questions/3829369/spring-serving-static-content-with-mvcresources-invalid-xsd and http://stackoverflow.com/questions/9085964/why-does-this-spring-config-file-not-resolve-the-mvcresources-element that doesn't seem to be the case. I get the following error. How do I resolve in 3.0.0. org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources'. Thanks much for replying. – user290870 Sep 18 '12 at 08:28
  • Seams you are right, I did not noticed that is was introduced in a minor update. – Ralph Sep 18 '12 at 09:09