Static resource mapping in Spring3


Static resource mapping in Spring3



My project is implemented in Spring3 and configuration is almost xml.
Configuration of static resource mapping is like below:


<mvc:resources mapping="/a/**" location="file:/data/a/"/>



There is no problem when accessing /a/xxx.jpg but 404 Error is occurred when accessing subdirectory like /a/b/yyy.jpg. There is no problem about access authority of filesystem. How can I solve this problem? Additional configuration is needed?



(Add) Project directory is fine, but filesystem directory does not work




1 Answer
1



Use something like below :


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



You can specify classpath also to location any particular folder like below.


<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>





Project directory is fine, but filesystem directory does not work
– firia2000
Jun 29 at 9:39





where is the directory actually?
– Alien
Jun 29 at 9:40





Web server's filesystem
– firia2000
Jun 29 at 9:51






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Possible Unhandled Promise Rejection (id: 0): ReferenceError: user is not defined ReferenceError: user is not defined