[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/servlet/web ...

Tom Elrod tom.elrod at jboss.com
Sat Jul 15 00:40:11 EDT 2006


  User: telrod  
  Date: 06/07/15 00:40:11

  Modified:    src/main/org/jboss/remoting/transport/servlet/web 
                        ServerInvokerServlet.java
  Log:
  JBREM-543 & JBREM-542 & JBREM-539 - fixed servlet invoker and added sslservlet invoker.
  
  Revision  Changes    Path
  1.6       +34 -29    JBossRemoting/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ServerInvokerServlet.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- ServerInvokerServlet.java	5 Jul 2006 17:01:48 -0000	1.5
  +++ ServerInvokerServlet.java	15 Jul 2006 04:40:11 -0000	1.6
  @@ -23,13 +23,11 @@
   package org.jboss.remoting.transport.servlet.web;
   
   import org.jboss.logging.Logger;
  -import org.jboss.mx.util.MBeanServerLocator;
  +import org.jboss.remoting.InvokerLocator;
  +import org.jboss.remoting.InvokerRegistry;
  +import org.jboss.remoting.ServerInvoker;
   import org.jboss.remoting.transport.servlet.ServletServerInvokerMBean;
   
  -import javax.management.MBeanServer;
  -import javax.management.MBeanServerInvocationHandler;
  -import javax.management.MalformedObjectNameException;
  -import javax.management.ObjectName;
   import javax.servlet.ServletConfig;
   import javax.servlet.ServletException;
   import javax.servlet.ServletInputStream;
  @@ -57,37 +55,44 @@
      public void init(ServletConfig config) throws ServletException
      {
         super.init(config);
  -      ObjectName localInvokerName = null;
  -      try
  +
  +      // Get the locator url from config so can use to
  +      // find serlvet invoker to pass calls onto.
  +      String locatorUrl = config.getInitParameter("locatorUrl");
  +      if(locatorUrl != null)
  +      {
  +         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
  +         if(serverInvokers != null && serverInvokers.length > 0)
  +         {
  +            for(int x = 0; x < serverInvokers.length; x++)
         {
  -         // See if the servlet is bound to a particular invoker
  -         String name = config.getInitParameter("invokerName");
  -         if(name != null)
  +               ServerInvoker svrInvoker = serverInvokers[x];
  +               InvokerLocator locator = svrInvoker.getLocator();
  +               if(locatorUrl.equalsIgnoreCase(locator.getOriginalURI()))
            {
  -            localInvokerName = new ObjectName(name);
  -            log.debug("localInvokerName=" + localInvokerName);
  +                  servletInvoker = (ServletServerInvokerMBean)svrInvoker;
  +                  break;
            }
         }
  -      catch(MalformedObjectNameException e)
  +
  +            // was the servlet invoker found
  +            if(servletInvoker == null)
         {
  -         throw new ServletException("Failed to build invokerName", e);
  +               throw new ServletException("Can not find servlet server invoker with same locator as specified (" + locatorUrl +")");
         }
  -
  -      // Lookup the MBeanServer
  -      MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
  -      if(mbeanServer == null)
  +         }
  +         else
         {
  -         throw new ServletException("Failed to locate the MBeanServer");
  +            throw new ServletException("Can not find any server invokers registered.  " +
  +                                       "Could be that servlet server invoker not registered or " +
  +                                       "has been created using different classloader.");
  +         }
         }
         else
         {
  -         servletInvoker = (ServletServerInvokerMBean)
  -               MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
  -                                                             localInvokerName,
  -                                                             ServletServerInvokerMBean.class,
  -                                                             false);
  -
  +         throw new ServletException("Could not find init parameter for 'locatorUrl' which must be supplied for ServerInvokerServlet to function.");
         }
  +
      }
   
      /**
  
  
  



More information about the jboss-cvs-commits mailing list