You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Scott Edward Skinner <ss...@cloud9.net> on 2005/10/10 20:37:58 UTC
Spring and JTidy
Is anyone using Velocity with Spring? What is the best way to incorporate
JTidy? Looking over the VelocityView source, I see several places where I
can intercept the Velocity output and send it to JTidy before passing it
off to the response. Another possibility is to perhaps write a JTidy
resolver and chain it to my VelocityViewResolver?
-S
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Spring and JTidy
Posted by Carfield Yim <ca...@carfield.com.hk>.
I've a simple method to get the output from velocity and press to
jtidy and do some validation, see if it useful to you:
public static String getHtml(final File location, final Body body,
final Context context) throws Exception {
final StringWriter writer = new StringWriter();
context.templateMan.getTemplate(context).merge(context.templateMan.getContext(context,
body, location, new TestRequest()), writer);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
final Tidy tidy = new Tidy();
tidy.setXHTML(true);
tidy.parse(new ByteArrayInputStream(writer.toString().getBytes()), out);
// System.out.println(out);
return out.toString();
}
On 10/11/05, Scott Edward Skinner <ss...@cloud9.net> wrote:
> Is anyone using Velocity with Spring? What is the best way to incorporate
> JTidy? Looking over the VelocityView source, I see several places where I
> can intercept the Velocity output and send it to JTidy before passing it
> off to the response. Another possibility is to perhaps write a JTidy
> resolver and chain it to my VelocityViewResolver?
>
> -S
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org