Package org.one.stone.soup.server.http

Examples of org.one.stone.soup.server.http.HttpServer


    stopHttpServer(xServer);
    String name = xServer.getAttributeValueByName("name");
    String address = xServer.getAttributeValueByName("address");
    int port = Integer.parseInt(xServer.getAttributeValueByName("port"));
   
    HttpServer server = buildServer(xServer);
    if(server!=null)
    {
      server.setLogger( this );
      servers.put(name,server);
      server.start( name,address,port,100,1000 );
     
      xServer.setAttributeValue("status","Running");
      openForm(getXmlData(),xServer);
     
      log("Server "+name+" started at "+address+" on port "+port);
View Full Code Here


    if(servers==null)
    {
      return;
    }
   
    HttpServer server = (HttpServer)servers.get( name );
   
    if(server!=null)
    {
      server.stop();
      servers.remove(name);

      xServer.setAttributeValue("status","Stopped");
      openForm(getXmlData(),xServer);
View Full Code Here

  private HttpServer buildServer(XmlElement xServer)
  {
    String name = xServer.getAttributeValueByName("name");
    String root = xServer.getAttributeValueByName("root");
   
    HttpServer server = new HttpServer(XappDB.findElement("xpath.model:xapp-server/mime-types"),name,root);
   
    Vector services = xServer.getElementsByName("http-service");
    for(int loop=0;loop<services.size();loop++)
    {
      XmlElement xService = (XmlElement)services.elementAt(loop);
      String serviceAlias = xService.getAttributeValueByName("name");
      String serviceName = xService.getAttributeValueByName("service");
      XmlElement authentication = xService.getElementByName("authentication-server");
     
      XmlElement xServiceDefinition = XappDB.findElement("xpath.model:xapp-server/services/node()[@name=\""+serviceName+"\"]");
      HttpRouter service = buildService( server,name,xServiceDefinition );
     
      if(authentication!=null)
      {
        String address = authentication.getAttributeValueByName("address");
        int port = Integer.parseInt(authentication.getAttributeValueByName("port"));
        String domain = authentication.getAttributeValueByName("domain");
        String subDomain = authentication.getAttributeValueByName("subdomain");
       
        try{
          HttpAuthenticator authenticator = new HttpAuthenticator(server.getFileServer(),address,port,domain,subDomain);
          service.setAuthenticator(authenticator);
        }
        catch(Exception e)
        {
          XappRootApplication.displayException(e);
          XappRootApplication.displayMessage("Server "+name+" not built as HttpAuthenticator failed");
          return null;
        }
      }
     
      server.addRoute(serviceAlias,service,xService.getElementByName("condition"));
    }
   
    return server;
  }
View Full Code Here

TOP

Related Classes of org.one.stone.soup.server.http.HttpServer

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.