Quoting Oscar Picasso <[EMAIL PROTECTED]>:
> I have a problem using filter chain with Struts
>
> I have wrote a simple filter to use in a servlet
> filter chain for postprocessing JSP output.
>
> It works like this:
>
> 1. Receive request, wrap response with its own
> response wrapper, and then pass it to filter chain.
>
> 2. The filter own response wrapper stores content in
> its own buffer when any call is made to
> response.getOutputStream().write().
>
> 3. When request returns from filter chain - get
> content from buffer, apply an xslt transformation &
> then flush the transformed content to the original
> response.getOutputStream().
>
> This all works fine when I request directly a JSP
> page.
>
> However if the JSP page is request by a struts
> forward, when the request returns from the filter
> chain - the original
> response.getOutputStream().write() never prints
> anything to the browser.
>
In a Servlet 2.3 environment (i.e. Tomcat 4.x), filters are only applied based
on the *original* request URI (the one that selects your Action), not on the
one use to forward to a JSP page. In a Servlet 2.4 environment (i.e. Tomcat
5.x), you can also ask for the filter to be applied on request dispatcher
calls, but you have to make this explicit:
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>myjsppage.jsp</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
> Any idea?
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]