User: jules_gosnell
  Date: 01/06/04 16:28:33

  Added:       jetty/src/main/org/jboss/jetty SetupHandler.java
  Log:
  from Scott - set up ClassLoader [and JAAS] just-in-time in a Handler - thanks Scott
  
  Revision  Changes    Path
  1.1                  contrib/jetty/src/main/org/jboss/jetty/SetupHandler.java
  
  Index: SetupHandler.java
  ===================================================================
  package org.jboss.jetty;
  
  import java.io.IOException;
  
  import org.w3c.dom.Element;
  
  import com.mortbay.HTTP.HandlerContext;
  import com.mortbay.HTTP.HttpException;
  import com.mortbay.HTTP.HttpRequest;
  import com.mortbay.HTTP.HttpResponse;
  import com.mortbay.HTTP.HttpServer;
  import com.mortbay.HTTP.Handler.NullHandler;
  
  import org.jboss.web.WebApplication;
  import org.jboss.web.AbstractWebContainer.WebDescriptorParser;
  
  /** An HttpHandler that simply hooks into the web application startup so that
  is sees the correct class loader and security realm name.
   *
   * @author  [EMAIL PROTECTED]
   * @version $Revision: 1.1 $
   */
  public class SetupHandler extends NullHandler
  {
      WebDescriptorParser descriptorParser;
      WebApplication webApp;
  
      /** Creates new SetupHandler */
      public SetupHandler(WebDescriptorParser descriptorParser, WebApplication webApp)
      {
          this.descriptorParser = descriptorParser;
          this.webApp = webApp;
      }
  
      /* ------------------------------------------------------------ */
      public void start() throws Exception
      {
          // Setup the JNDI environment
          ClassLoader loader = getHandlerContext().getClassLoader();
          Element webAppDD = webApp.getWebApp();
          Element jbossDD = webApp.getJbossWeb();
          webApp.setClassLoader(loader);
          descriptorParser.parseWebAppDescriptors(loader, webAppDD, jbossDD);
  
          // Add the JBoss security realm
          HttpServer server = getHandlerContext().getHttpServer();
        //        String realmName = getHandlerContext().getRealm();
        //        server.addRealm(new JBossUserRealm(realmName));
      }
  
      public void handle(String pathInContext, HttpRequest request, HttpResponse 
response)
          throws HttpException, IOException
      {
      }
  
  }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to