Re: [Simpleweb-Support] is there a simple template velocity howto ???
Brought to you by:
niallg
From: Niall G. <nia...@an...> - 2004-06-22 14:59:58
|
Hi > still not able to get it to work... > when prepare is call by MyService, the container is > null. The reason the container is null is because you are using the LoaderEngine.load method to load the service. The MapperEngine auto loads services and uses the object parameter to initialize the service. So instead of using > engine.link("*", "default"); > engine.load("my", "MyService"); > engine.link("/service/my*", "my"); Try using the following import simple.http.serve.*; import simple.http.*; import simple.http.connect.*; import simple.http.load.*; import simple.template.velocity.*; import simple.template.*; import java.net.*; public class Main { public static void main(String[] args) throws Exception { Container container = new VelocityContainer(); LoaderEngine engine = new MapperEngine(); engine.link("*", "default"); engine.load("my", "MyService", container); engine.link("/service/my*", "my"); ProtocolHandler handler = HandlerFactory.getInstance(engine); Connection connection = ConnectionFactory.getConnection(handler); connection.connect(new ServerSocket(8282)); } } |