Hom*_*mer 24 resources spring static
在Web应用程序中,我需要提供位于应用程序上下文目录之外的静态内容(图像).整个应用程序架构要求我使用Tomcat来执行此操作.我想我可以从Spring中受益<mvc:resources>,配置应用程序URL和目录内容之间的映射.但是AFAIK它的mapping属性只处理上下文相关或类路径映射.因此,我想用什么:
<mvc:resources location="/images/**" mapping="/absolute/path/to/image/dir"/>
Run Code Online (Sandbox Code Playgroud)
不起作用.因为我宁愿避免编写一个简单的文件传输servlet,如果有人能给我一些关于现有的基于Spring的解决方案/解决方法的指示,我会很高兴.
非常感谢.
荷马
axt*_*avt 34
<mvc:resources>可以从外部提供资源,您需要使用通常的Spring资源路径语法:
<mvc:resources mapping="/images/**" location="file:/absolute/path/to/image/dir/"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22377 次 |
| 最近记录: |