Examples of WebServer


Examples of ch.ethz.inf.net.WebServer


  public static void main(String[] args) {
    int exitCode=1; // assume there will be an error

    WebServer server=WebServer.allowRMIPeersToRetrieveByteCode();

    String insertId    = System.getProperty("insertId",null);
    String remoteProse = System.getProperty("prose.address","NONE");
    String aspectToInsert = System.getProperty("insert","NONE");
    String aspectToWithdraw=System.getProperty("withdraw","NONE");
    String transactionId=System.getProperty("txId",null);
    String finishTxAction=System.getProperty("finishtx","NONE");
    String list=System.getProperty("list","NONE");

    try {
      String host  = null;
      int port = -1;
      try  {
        host = remoteProse.substring(0,remoteProse.indexOf(':'));
        String portName = remoteProse.substring(remoteProse.indexOf(':') +1, remoteProse.length());
        port = Integer.parseInt(portName);
      }
      catch (java.lang.StringIndexOutOfBoundsException e)  {
        throw new java.net.MalformedURLException("Missing ':' separator");
      }
      catch (java.lang.NumberFormatException e) {
        throw new java.net.MalformedURLException("Illegal port number");
      }

      String instance = System.getProperty("prose.instance");

      RemoteAspectManager bothRams[] = RemoteProseComponent.doGetRemoteAspectManagers(host,port);
      RemoteAspectManager ram = null;

      if ("activeInstance".equals(instance))
        ram = bothRams[0];
      else if ("testInstance".equals(instance))
        ram = bothRams[1];
      else
        throw new Error("instance must be specified by script!");

      if ("NONE".equals(remoteProse))  {
        System.err.println("no host:port specified");
        usage();
        System.exit(1);
      }

      if ("commit".equals(finishTxAction)) {
        if (transactionId == null)
          throw new IllegalArgumentException("transaction id must be specified");

        ram.commit(transactionId);
      }

      if ("abort".equals(finishTxAction)) {
        if (transactionId == null)
          throw new IllegalArgumentException("transaction id must be specified");

        ram.abort(transactionId);
      }

      if ( !("NONE".equals(aspectToInsert))) {
        // we have to insert an aspect
        // assumption : no constructor
        Class cls = Class.forName(aspectToInsert);
        Aspect aspect = (Aspect)cls.newInstance();
        if (insertId != null)
          aspect.associateTo(insertId);

        // obtain remote prose reference
        if (transactionId == null)
          ram.insert(aspect);
        else
          ram.insert(aspect,transactionId);
      }

      if ( !("NONE".equals(aspectToWithdraw)) ) {
        Object[] array=ram.allAspects().toArray();
        int withdrawIdx = Integer.parseInt(aspectToWithdraw);
        if (transactionId == null)
          ram.withdraw((AspectSurrogate)array[withdrawIdx]);
        else
          ram.withdraw((AspectSurrogate)array[withdrawIdx],transactionId);
      }

      if ( !("NONE".equals(list)) ) {
        Object[] array=ram.allAspects().toArray();
        for (int i = 0; i < array.length; i++)
          System.err.println("Aspect[" + i + "]: " + array[i]);
      }
      server.stop();
      exitCode =0;
    }
    catch (java.lang.ClassNotFoundException cannotFoundClass) {
      System.err.println("prose: *Error* The class '" + aspectToInsert + "' could not be found in the classpath");
    }
    catch (java.lang.IllegalAccessException cannotCallConstructor) {
      System.err.println("prose: *Error* The class " + aspectToInsert + "' cannot be instantiated. Please check"+
      "               that the constructor (paramterless) has the correct access rights");
    }
    catch (java.net.UnknownHostException wrongHostName) {
      System.err.println("prose: *Error* The prose service you specified does not exist at " + remoteProse);
    }
    catch (java.rmi.ConnectException serverNotThere) {
      System.err.println("prose: *Error* The prose service you specified does not exist at " + remoteProse);
    }
    catch (java.lang.InstantiationException cannotCreateAspect) {
      System.err.println("prose: *Error* The aspect class you specified (" + aspectToInsert + ") " +
      " cannot be instantiated");
    }
    catch (java.rmi.RemoteException cannotConnect) {
      System.err.println("prose: *Error* The following exception occured while trying to connect to"+
          "               the service " + cannotConnect+ ":\n");
    }
    catch (java.net.MalformedURLException shitFromUser) {
      System.err.println("prose: *Error* The address you specified does not have the format <host>:<port>");
    }
    catch (java.lang.IllegalArgumentException missingArgs) {
      System.err.println("prose: *Error* " + missingArgs.getMessage());
    }
    catch (java.io.IOException cannotTalkToRemoteProse) {
      System.err.println("prose: *Error* " + cannotTalkToRemoteProse.getMessage());
    }
    finally {
      server.stop();
    }
    System.exit(exitCode);
  }
View Full Code Here

Examples of com.flaptor.util.remote.WebServer

            xmlRpcServer.start();
        }
        if (openSearch || web || xml) {
            Config config = Config.getConfig("searcher.properties");
            int httpServerPort = PortUtil.getPort("searcher.http");
            httpServer = new WebServer(httpServerPort);

            if (openSearch) {
                String context = config.getString("opensearch.context");
                logger.info("MultipleRpcSearcher constructor: starting OpenSearch searcher on port " + httpServerPort + " context "+context);
                httpServer.addHandler(context, new OpenSearchHandler(baseSearcher));
View Full Code Here

Examples of com.luxoft.dnepr.courses.unit3.web.WebServer


public class BlackJack {

  public static void main(String[] args) throws IOException {
    new WebServer(8081).start();
  }
View Full Code Here

Examples of com.ramforth.webserver.WebServer

*/
public class WebServerCGIExample {

    public WebServerCGIExample() {
        // instantiate a new web server
        WebServer webServer = new WebServer();

        // add a cgi module using perl as backend for files ending with .pl (adjust path to perl executable as needed)
        HttpCgiModule httpCgiModule = new HttpCgiModule("/usr/bin/perl", ".pl");
       
        // instantiate a single file resource
        HttpFileResource perlFile = new HttpFileResource();
        // set the path we can use to open the file e.g. with a web browser
        perlFile.setRelativePath("/index.pl");
        // set the path where the file is located on disk
        perlFile.setServerPath(WebServerCGIExample.class.getResource("/examples/perlCgiTest.pl").getPath());
        // add the newly created resource to the module
        httpCgiModule.getResources().addResource(perlFile);
       
        // add the module to the server
        webServer.addModule(httpCgiModule);

        // create an http listener for InetAddress.getLocalhost() on port 11111
        IHttpListener httpListener = new HttpListener(11111);
       
        // add the listener to the server
        webServer.addHttpListener(httpListener);
       
        // start the web server
        webServer.start();
    }
View Full Code Here

Examples of com.vtence.molecule.WebServer

    }

    public static void main(String[] args) throws IOException {
        RoutingExample example = new RoutingExample();
        // Run the default web server
        WebServer webServer = WebServer.create();
        example.run(webServer);
        System.out.println("Access at " + webServer.uri());
    }
View Full Code Here

Examples of helma.xmlrpc.WebServer

                    webserver = new SecureWebServer(port);
                }
                else
                {
                    webserver = new WebServer(port);
                }
            }

            // Set the XML driver to the correct SAX parser class
            String saxParserClass = getConfiguration().getString("parser",
View Full Code Here

Examples of main.webapp.WebServer

            throws ServletException, IOException {
        resp.getWriter().print("Hello from Java!\n");
    }
 
  public static void main(String[] args) throws Exception {
    WebServer webServer = WebServer.getInstance();
    webServer.setPort(System.getenv("PORT"));
    String webappDirLocation = "src/main/java/com/mycompany";
    webServer.setWebAppDirectoryLocation(webappDirLocation);

    //servlets for sms service
    webServer.addServlet("HelloWorld", "com.mycompany.HelloWorld");
    webServer.addServletMapping("/helloworld", "HelloWorld");
    webServer.start();
   
   
}
View Full Code Here

Examples of net.sourceforge.kitteh.WebServer

  public WebSocketTest() throws Exception
  {
    FileProducer f = new FileProducer("www");
        f.setDefaultFile("websocket.html");
    WebServer w = new WebServer(f,8080);
    w.setWebSocketListener(this);
    w.runAsThread();
    System.out.println("Server started!");
    System.out.println("Press ENTER to quit.");
   
    BufferedReader r = new BufferedReader(new InputStreamReader( System.in ));
    r.readLine();
    w.close();
    System.out.println("Quitting");
  }
View Full Code Here

Examples of net.sourceforge.processdash.net.http.WebServer

        EVTaskDependencyResolver.getInstance().setDynamic(false);
       
        if (createWebServer) {
            DashboardURLStreamHandlerFactory.disable();
            try {
                webServer = new WebServer();
                webServer.setDashboardContext(this);
                webServer.setData(data);
                webServer.setProps(hierarchy);
                webServer.setRoots(TemplateLoader.getTemplateURLs());
                WebServer.setOutputCharset(getWebCharset());
View Full Code Here

Examples of org.apache.hadoop.yarn.server.nodemanager.webapp.WebServer

  }

  protected WebServer createWebServer(Context nmContext,
      ResourceView resourceView, ApplicationACLsManager aclsManager,
      LocalDirsHandlerService dirsHandler) {
    return new WebServer(nmContext, resourceView, aclsManager, dirsHandler);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.