EJBServletpublic class EJBServlet extends HttpServlet
Fields Summary |
---|
private static final Logger | log |
Methods Summary |
---|
protected void | doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
processRequest(request, response);
| protected void | doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
processRequest(request, response);
| protected javax.naming.InitialContext | getInitialContext()
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 void | processRequest(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();
|
|