This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Page tree
Skip to end of metadata
Go to start of metadata

DVSL examples – at some point these might be added to the Velocity DVSL documentation.

Java Streams makes DVSL usable in any Java App:

PrintWriter out = resp.getWriter();
DVSL dvsl = new DVSL();
Reader in = new InputStreamReader(System.in);    
dvsl.setStylesheet("e:/xdocs/example1.dvsl");
in = new FileReader("e:/xdocs/example1.xml");
dvsl.transform(in, out);
out.flush();
String realPath = this.getServletContext().getRealPath( "/" );
DVSL dvsl = new DVSL();
String inFile = request.getParameter( "inFile" );
String styleFile = request.getParameter( "styleFile" );
dvsl.setStylesheet( realPath + styleFile );
Reader in = new FileReader( realPath + inFile );
Writer out = new BufferedWriter( response.getWriter() );
dvsl.transform( in, out );
out.flush();
String realPath = this.getServletContext().getRealPath( "/" );
DVSL dvsl = new DVSL();
URL inURL = new URL( "http://www.server.com/weather.xml" );
String styleFile = request.getParameter( "styleFile" );
dvsl.setStylesheet( realPath + styleFile );
URLConnection uConnection = inURL.openConnection();
uConnection.connect();
InputStream is = uConnection.getInputStream();
Writer out = new BufferedWriter( response.getWriter() );
dvsl.transform( is, out );
out.flush();
  • No labels