Anoop K Achuthan wrote:
> Hi John,
>    You can write a Response Filter  which  sets the Content type of your 
> choise.
> The filter could be added as the last filter in the chain to make sure 
> that no other
> filter is changing it's content type.
>
>   
Thanks - I get it. However, it didn't do what was expected (this is the 
first filter I wrote though).
I see the comment, so I know its being called, and its defined after the 
xslt one in web.xml.
Should this work?

public class ContentTypeFilter implements Filter {

  private FilterConfig filterConfig;

  public void doFilter (ServletRequest request,
             ServletResponse response,
             FilterChain chain)
  {
    try
    {
      System.out.println ("Within ContentType filter ... ");

      chain.doFilter (request, response);
      response.setContentType("text/html");

    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
  } 
 
  public void destroy() {
    this.filterConfig = null;
  } 

}
> -Anoop
>
> John Steel wrote:
>
>   
>> test.jsp here http://www.caucho.com/resin-3.1/doc/xslt-filter.xtp shows 
>> you need to add this and the filter to the web-app in order for it to 
>> trigger resin to performing the transformation. I'm having an issue 
>> based on that example where basically I need to also control the 
>> contentType for real, i.e. "text/html", "text/xml" etc.
>>
>> How can I do this whilst still using the xsl filter please?
>> The problem is in the stylesheet, if I change method="xml" to 
>> method="html" below the contentType in the HTTP response toggles between
>> "Content-Type: text/xml; charset=UTF-8" and "Content-Type: text/html; 
>> charset=UTF-8"
>>
>>   <xsl:output
>>       method="xml"
>>       
>> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
>>       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
>>
>> I want to retain the method="xml" line but have it served as html so the 
>> browser doesn't complain about missing stylesheets. But of course, as 
>> soon as I try to set the contentType in the JSP I find I must leave it 
>> at 'x-application/xslt' or the filter won't be applied.
>>
>>  
>>
>>     
>
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>
>   


-- 
--------------------------
http://www.phonewebcam.com
[EMAIL PROTECTED]



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to