FileDocCategorySizeDatePackage
EJBServlet.javaAPI DocJBoss 4.2.13600Fri Jul 13 20:53:18 BST 2007org.jboss.ejb3.test.clusteredservice.servlets

EJBServlet

public class EJBServlet extends HttpServlet
version
$Revision: 60233 $
author
William DeCoste

Fields Summary
private static final Logger
log
Constructors Summary
Methods Summary
protected voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

      processRequest(request, response);
   
protected voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

      processRequest(request, response);
   
protected javax.naming.InitialContextgetInitialContext()

      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "localhost:1100"); 
      return new InitialContext(p);
   
protected voidprocessRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

   
        
           
   
      try
      {
         ServiceRemote test = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
         test.remoteMethod();
         
  /*       MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
         ObjectName testerName = new ObjectName("default:service=service");
         Object[] params = {};
         String[] sig = {};
         server.invoke(testerName, "", params, sig);*/
      }
      catch (Exception e)
      {
         e.printStackTrace();
        
         throw new ServletException("Failed to call ServiceBean through remote or local interfaces", e);
      }
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      out.println("<html>");
      out.println("<head><title>EJBServlet</title></head>");
      out.println("<body>Tests passed<br></body>");
      out.println("</html>");
      out.close();