Ejemplo n.º 1
0
 public HttpApiServer(HttpConfig serverConfig)
 {
     mActionFactory = new ActionHandlerFactory();
     if (serverConfig != null)
     {
         ServerConfig = serverConfig;
     }
     else
     {
         string configFile = "HttpConfig.json";
         if (System.IO.File.Exists(configFile))
         {
             using (System.IO.StreamReader reader = new StreamReader(configFile, Encoding.UTF8))
             {
                 string json = reader.ReadToEnd();
                 Newtonsoft.Json.Linq.JToken toke = (Newtonsoft.Json.Linq.JToken)Newtonsoft.Json.JsonConvert.DeserializeObject(json);
                 ServerConfig = toke["HttpConfig"].ToObject <HttpConfig>();
             }
         }
         else
         {
             ServerConfig = new HttpConfig();
         }
     }
     mResourceCenter = new StaticResurce.ResourceCenter(this);
 }
Ejemplo n.º 2
0
 public HttpApiServer(HttpOptions options)
 {
     mFileLog        = new FileLogWriter("BEETLEX_HTTP_SERVER");
     FrameSerializer = this;
     if (options != null)
     {
         Options = options;
     }
     else
     {
         Options = LoadOptions();
     }
     mActionFactory  = new ActionHandlerFactory(this);
     mResourceCenter = new StaticResurce.ResourceCenter(this);
     mUrlRewrite     = new RouteRewrite(this);
     mModuleManager  = new ModuleManager(this);
 }
Ejemplo n.º 3
0
 public HttpApiServer(HttpConfig serverConfig = null)
 {
     mActionFactory = new ActionHandlerFactory();
     if (serverConfig != null)
     {
         ServerConfig = serverConfig;
     }
     else
     {
         var builder = new ConfigurationBuilder()
                       .SetBasePath(Directory.GetCurrentDirectory())
                       .AddJsonFile("HttpConfig.json", false);
         var configuration = builder.Build();
         ServerConfig = configuration.GetSection("HttpConfig").Get <HttpConfig>();
     }
     mResourceCenter = new StaticResurce.ResourceCenter(this);
 }
Ejemplo n.º 4
0
 public HttpApiServer(HttpConfig serverConfig)
 {
     mFileLog        = new FileLogWriter("BEETLEX_HTTP_SERVER");
     FrameSerializer = this;
     if (serverConfig != null)
     {
         ServerConfig = serverConfig;
     }
     else
     {
         ServerConfig = LoadConfig();
     }
     mActionFactory  = new ActionHandlerFactory(this);
     mResourceCenter = new StaticResurce.ResourceCenter(this);
     mUrlRewrite     = new RouteRewrite(this);
     mModuleManage   = new ModuleManage(this);
 }