完整錯誤:
JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.
這會造成 FlashScope 不穩定甚而無法 keep 與 get,解決方法為掛 filter 設置 bufferSize 處理, 以下為程式碼:
@WebFilter("*.xhtml") public class ResponseBufferSizeFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponseWrapper wrapper = new HttpServletResponseWrapper((HttpServletResponse) response); wrapper.setBufferSize(10000000); chain.doFilter(request, wrapper); } @Override public void destroy() { } }