【问题标题】:Spring mvc resocures mapping in google appengine谷歌应用引擎中的Spring mvc重新定位映射
【发布时间】:2013-02-01 05:26:54
【问题描述】:

我在使用 Google Appengine 和 Spring mvc 资源映射时遇到了一个奇怪的问题

这是我的spring mvc资源映射xml内容

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />

<mvc:resources mapping="/images/**" location="/META-INF/static/images/" />
<mvc:resources mapping="/css/**" location="/META-INF/static/css/" />

在我的模板文件中,我将我的 css 文件引用为

<link href="/css/mystyle.css" type="text/css" rel="stylesheet" />

mystyle.css 位于 war 文件夹中的 /META-INF/static/css/mystyle.css 中。

现在的问题是在运行应用程序时,我收到带有警告的 NumberFormatException

警告:/css/mystyle.css

并且 css 无法加载,但奇怪的是当我再次刷新时,它有时会正常工作而没有异常和警告,有时却不会。

当我在 GAE 之外运行应用程序时,这个问题不存在,即我在 tomcat 服务器上运行,它很好。

【问题讨论】:

    标签: google-app-engine spring-mvc


    【解决方案1】:

    Google App Engine 有自己的静态文件映射,您可以在 appengine-web.xml 文件中使用。

    https://developers.google.com/appengine/docs/java/config/appconfig#Static_Files_and_Resource_Files

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-24
      • 2013-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-06
      相关资源
      最近更新 更多