2017-08-07 33 views
0

我有一個實現過濾器自定義過濾器和我換這樣包裝的響應不渲染JSP內容

HttpServletResponse responseWrapper = new ContentCachingResponseWrapper((HttpServletResponse) response); 
chain.doFilter(request, responseWrapper); 
後,我打開本地主機,我什麼也看不見,只有白色屏幕

與ContentCachingResponseWrapper的響應。

<html> 
<head><head> 
<body></body> 
</html> 

如果我評論的ContentCachingResponseWrapper和使用不應對它環繞

chain.doFilter(request, response); 

那麼我的JSP頁面正確呈現。

任何人都可以解釋發生了什麼?

+0

user7294900,謝謝!我已將此添加到攔截器中,但我忘了將其添加到我的過濾器中 – John

回答

0

加入((ContentCachingResponseWrapper) responseWrapper).copyBodyToResponse();chain.doFilter(requestToCache, responseWrapper);問題後,解決了