* {@inheritDoc}
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
TaggedResponseWrapper wrappedResponse = new TaggedResponseWrapper((HttpServletResponse)response);
chain.doFilter(request, wrappedResponse);
byte[] bytes = wrappedResponse.getByteArray();
if (wrappedResponse.getContentType() != null && wrappedResponse.getContentType().contains("text/html")) {
for (TagParser parser : parsers) {
bytes = parser.replaceTagByContent(wrappedResponse);
wrappedResponse.setByteArray(bytes);
}
response.setContentLength(bytes.length);
}
response.getOutputStream().write(bytes);
}