spring-mvc - mvc :resources not picking up everything under resource folder

标签 spring-mvc resources

这个东西适用于 _res 下 5 个文件夹中的 4 个。

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

它没有在字体文件夹下拾取从样式表引用的任何内容,如下所示

src:    url('../fonts/proximanova-bold-webfont.eot');

_res 文件夹下的所有内容都会反射(reflect)在应用程序中。

_res
css
fonts
i
js
video 

最佳答案

我意识到这个答案晚了几个月,但我刚刚遇到了同样的问题,所以我认为我应该为遇到它的其他人添加一个答案。

Spring Resources Servlet 不会提供没有 mime 类型的内容,因此对于 .eot 文件,您需要添加

<mime-mapping>
    <extension>eot</extension>
    <mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>

到您的 web.xml 文件。

关于spring-mvc - mvc :resources not picking up everything under resource folder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7422471/

相关文章:

java - Spring 3.2 测试,com.jajway 不包含在依赖项中

Spring MVC : Optional vs Exceptions in Service Layer

java - 从 spring mvc Controller 操作中,如何访问请求/响应?

Spring MVC : Ambiguous mapping found

wpf - 将 URI 打包到嵌入 resx 文件中的图像

java - Spring MVC - 无法找到自定义标签的标签库

java - 使用 getResource() 获取资源

resources - 从 Wix 中的附属程序集读取字符串资源?

wpf - XAML Resx 本地化未按预期工作

Grails、Spring Security 和 Siteminder - 资源或用户详情问题