Home » displaytag-1.1.1-src » org » displaytag » filter » [javadoc | source]
org.displaytag.filter
public class: ResponseOverrideFilter [javadoc | source]
java.lang.Object
   org.displaytag.filter.ResponseOverrideFilter

All Implemented Interfaces:
    Filter

Allow the author of an included JSP page to reset the content type to something else (like a binary stream), and then write the new info back as the exclusive response, clearing the buffers of all previously added content.

This filter allows TableTag users to perform exports from pages that are run as includes, such as from Struts or a jsp:include. If that is your intention, just add this Filter to your web.xml and map it to the appropriate requests, using something like:

<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

By default the filter buffers all the export content before writing it out. You can set an optional parameter buffer to false to make the filter write directly to the output stream. This could be faster and uses less memory, but the content length will not be set.

<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
<init-param>
<param-name>buffer</param-name>
<param-value>false</param-value>
</init-param>
</filter>
Method from org.displaytag.filter.ResponseOverrideFilter Summary:
destroy,   doFilter,   init
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.displaytag.filter.ResponseOverrideFilter Detail:
 public  void destroy() 
    {@inheritDoc}
 public  void doFilter(ServletRequest servletRequest,
    ServletResponse servletResponse,
    FilterChain filterChain) throws IOException, ServletException 
    {@inheritDoc}
 public  void init(FilterConfig filterConfig) 
    {@inheritDoc}