Package Acme.Serve

Examples of Acme.Serve.Serve$AcmeSession


      }
    return context;
  }

  private SimpleContext exposeContext(SimpleContext context, String host, int port) {
    final Serve srv = new Acme.Serve.Serve();
    Properties properties = new java.util.Properties();
    properties.put(Serve.ARG_PORT, port);
    properties.put(Serve.ARG_NOHUP, Serve.ARG_NOHUP);
    if (host != null && host.length() > 0 && "localhost".equals(host) == false)
      properties.put(Serve.ARG_BINDADDRESS, host);
    srv.arguments = properties;
    srv.addServlet("/getRootContext", new HttpServlet() {
      protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
          java.io.IOException {
        if (mainContext != null) {
          try {
            resp.setContentType("text/plain");
            resp.getWriter().write(orb.object_to_string(rootPoa.servant_to_reference(mainContext)));
          } catch (org.omg.CORBA.UserException ce) {
            ce.printStackTrace();
            resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
          }
        } else
          resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
      }
    });
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
      public void run() {
        srv.notifyStop();
        srv.destroyAllServlets();
      }
    }));
    Thread exposerThread = new Thread("ContextExposer") {
      public void run() {
        srv.serve();
      }
    };
    exposerThread.setDaemon(true);
    exposerThread.setPriority(Thread.MIN_PRIORITY);
    exposerThread.start();
View Full Code Here

TOP

Related Classes of Acme.Serve.Serve$AcmeSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.