Re: [Simpleweb-Support] is there a simple template velocity howto ???
Brought to you by:
niallg
From: Saxon F. <ts...@ya...> - 2004-06-22 09:34:30
|
> import simple.http.serve.*; > import simple.http.*; > > import simple.template.BasicService; > > public class VelocityService extends BasicService { > > public VelocityService(Context context){ > this.context = context; > } > > public void process(Request req, Response resp) > throws Exception { > OutputStream out = resp.getOutputStream(); > String target = req.getURI(); system is an Environment object? its not in BasicService > Document doc = system.resolve(target); // can > be test.vm or whatever > > doc.("book", "Simpleweb Guide"); > doc.write(out); > > out.close(); > } > } > > // get every thing working > public static void main(String list[]) throws > Exception { > Context context = new FileContext(); > Container container = new VelocityContainer(); > TemplateEngine engine = new > TemplateEngine(context, container); > > Connection connection = > ConnectionFactory.getConnection(engine); > > conneciton.connect(new ServerSocket(8080)); > } I can't use LoaderEngine if I use TemplateEngine? > > To see this as a working implementation see > http://mambaweb.sf.net. The source is in the > mamba.jar JAR archive. __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail |