[英]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.