[英]Jhipster v2.20.0 : Static picture can't be loaded in production mode
我在生产模式下部署了Jhipster (v2.20.0)应用程序。 在angularjs代码中,我把:
img.src = assets/.../mypicture.png.
本地这幅画IL正确加载,但在生产模式我有错误:
[ERROR] org.springframework.boot.context.web.ErrorPageFilter - Cannot forward to error page for request [/assets/images/elements/teethschame/47.png]
as the response has already been committed. As a result, the response may have the wrong status code.
If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
这个问题你能帮我吗?
谢谢
在JHipster 2.x中,grunt / gulp构建过程会缩小图像并向其中添加修订哈希码,以便浏览器可以将其永久缓存。
因此,如果您在assets/images/mypicture.png
有一个图像,它将在dist/assets/images/mypicture-a1b2cde.png
。 然后在产品概要文件中, StaticResourcesProductionFilter
将/dist
放在对资产的任何请求之前,但它不知道修订代码。
因此,在您的情况下,您的代码必须引用版本化的映像名称,或者应通过将映像移到assets
文件夹之外来排除映像的修订。
感谢您的答复,但问题是我必须在resourrces目录中创建一个名为:static,public或resource的目录,并将其图像目录放入其中以在春季启动时为它们提供服务。 在Spring站点中指出了这一点: https : //spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.