Reputation: 177
I want to map my folder in resources folder from context for example, in context.xml (I want to map files from src/main/resources)
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="alwaysUseFullPath" value="true"/>
<property name="mappings">
<props>
<prop key="/resources/**">staticResources</prop>
</props>
</property>
</bean>
<bean id="staticResources" class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
<property name="locations">
<list>
<value>classpath:/resources/myFolder/</value>
<value>/resources/</value>
</list>
</property>
</bean>
In myFolder
there are many sub-folders with files and more sub-folders
but firebug says error 404 and that such resources cannot be found
Upvotes: 0
Views: 297
Reputation: 49935
It will be better to do this through mvc
namespace -
<mvc:resources location="/resources/,classpath:/resources/myFolder" mapping="/resources/**" />
then your static resources should be accessible from http://serverurl/contextpath/resources/*
Upvotes: 1