[jetty-user] Installing Weld / Seam-Wicket programatically

Ondrej Zizka <[email protected]> Sun, 10 Apr 2011 03:16:09 +0200
Newsgroups gmane.comp.java.jetty.support
Organization Red Hat
Message-ID <1302398169.16265.39.camel@ondra-doma>
Hi all,


I have a standalone application which uses embedded Jetty 6.1.26 to run
Wicket 1.4.16 app.

Now I'd like to try CDI,  so I found about weld-wicket, which was
moved/renamed (?) to seam-wicket.
Here's the relevant doc:
http://docs.jboss.org/seam/3/wicket/latest/reference/en-US/html/wicket.installation.html
which refers to 
http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#d0e5286
which only contains instructions for descriptors approach.

How do I do the same programatically?
See below for what I have so far.
The project is at
http://ondrazizka.googlecode.com/svn/trunk/bots/JawaBot/branches/2.0/


Thanks,
Ondra

---------------------------------------------------

      Server server = new Server( 8080 );
      Context ctx = new Context( server, "/", Context.NO_SECURITY |
Context.SESSIONS );

      // ... static content handling

      // Wicket.
      final ServletHolder wicketSH = new ServletHolder( new
MyReloadingWicketServlet() );
      wicketSH.setInitParameter( "applicationClassName",
WicketApplication.class.getName() );
      ctx.addServlet( wicketSH, "/*" );


      try {
         //BeanManager
         new
org.mortbay.jetty.plus.naming.Resource( ctx, /*"BeanManager"*/
BeanManagerLookup.getBeanManagerJndiName(), 
            new javax.naming.Reference(
               "javax.enterprise.inject.spi.BeanManager",
               "org.jboss.weld.resources.ManagerObjectFactory", null )
         );
      } catch ( NamingException ex ) {
         log.error( ex );
      }


PS: Sorry for cross-posting, I'm not sure which list is the right one
now.