Thanks to the pointers from David Karlsen, John Prince and James
Carmen, I was able to get done what I needed to get done.

In my Main method, I do the following:

            Registry registry = RegistryBuilder.constructDefaultRegistry();
            // start jetty...
            Server server = new Server();
            WebApplicationContext wac =
server.addWebApplication("/myApp", "./context/");
            wac.setAttribute("registry", registry); // set the
registry in the servlet context
            SocketListener listener = new SocketListener();
            listener.setName("ReceptorListener");
            listener.setPort(8081); 
            listener.setMinThreads(5);
            listener.setMaxThreads(250);
            server.addListener(listener);
            server.start();


I created a subclass of org.apache.tapestry.ApplicationServlet and
override the init() method:

    public void init() {
        try {
            super.init();
        }
        catch (ServletException e) {
            e.printStackTrace();
        }
        Registry registry =
(Registry)this.getServletContext().getAttribute("registry");
        RegistryManager.getRegistryManager().setRegistry(registry);
// get my service
        MyService ms = (MyService)registry.getService(MyService.class);
// ...and message it
        ms.doMyInitialization();
    }

Finally, there is a singleton lurking around where I stash the
registry I created in the main method, which is picked up in the
org.apache.tapestry.ApplicationServlet subclass.

Finally finally, make sure that the subclass of
org.apache.tapestry.ApplicationServlet is set as the servlet-class in
the servlet definition in web.xml.

Thanks again for the help. Onwards and upwards!

geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to