permaculture playing cards*
The moose likes Servlets and the fly likes XSLT Filter or Tomcat Valve? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "XSLT Filter or Tomcat Valve?" Watch "XSLT Filter or Tomcat Valve?" New topic
Author

XSLT Filter or Tomcat Valve?

Andreas Schildbach
Ranch Hand

Joined: Jan 22, 2003
Posts: 34
Hi everyone,

Does anyone know of a Servlet Filter or Tomcat Valve that transparently executes any client side stylesheet transformation for those clients that are not capable of XSLT?

Thanks for any pointer.

Regards,

Andreas
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Sounds nifty ... um, but how would you know if a client is able to do transformations client-side? I'm not aware of any HTTP header (or use thereof) that would allow you to determine this.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Andreas Schildbach
Ranch Hand

Joined: Jan 22, 2003
Posts: 34
Well, you can determine it from the user-agent header: IE6 and Firefox are capable of client-side-transformation. Sure enough, the logic would need maintenance from time to time.

Regards,

Andreas
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
IE6 can always do transformations? I was under the impression that you could only do it after you downloaded the MSXML stuff. Either way, it doesn't sound too complicated ... 10 lines of code maybe? I'm not aware of any filters floating around that already attempt to do this, but I may be wrong -- it happens.
Andreas Schildbach
Ranch Hand

Joined: Jan 22, 2003
Posts: 34
Well I can't remember that I ever installed MSXML, and it works.
Ajith Anand
Ranch Hand

Joined: Aug 30, 2004
Posts: 40
I donot know of any Servlet Filter or Tomcat Valve which comes bundled.


But, I dont think it would be hard to write a filter yourself. Maybe something on these lines....









public class XSLTFilter implements javax.servlet.Filter
{


.......


public void doFilter( request, response, filterchain )
{

/* Logic to check whether xslt transformation would be required goes here */

if ( XSLTFormattingRequired )

{
/* javax.xml.transform.* */

transformer.transform( transformSource, result ) ;
}


filterChain.doFilter( req, resp ) ;


}

}








}


LXI Technologies P Ltd
[url]www.lxisoft.com[/url]
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Originally posted by Ajith And Ajith And:
But, I dont think it would be hard to write a filter yourself. Maybe something on these lines....

Priceless. Would you care to suggest an implementation for XSLTFormattingRequired (a method, presumably?) or if not (then a boolean) for the method that sets its value?

Jules
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSLT Filter or Tomcat Valve?
 
Similar Threads
Reg Tom cat valve
Tomcat - stop POST response being sent to calls
about Valve in the context file
Global Filter for All Web Applications
problem writing tomcat valve