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); }
internal ActionContext(ActionHandler handler, IHttpContext context, ActionHandlerFactory actionHandlerFactory) { Handler = handler; mFilters = handler.Filters; HttpContext = context; ActionHandlerFactory = actionHandlerFactory; Parameters = handler.GetParameters(context); }
public object Invoke(IHttpContext context, ActionHandlerFactory actionHandlerFactory, object[] parameters) { var controller = Controller; if (!SingleInstance) { controller = actionHandlerFactory.GetController(ControllerType); if (controller == null) { controller = this.Controller; } } return(mMethodHandler.Execute(controller, parameters)); }
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>(); } }
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); }
internal ActionContext(ActionHandler handler, IHttpContext context, ActionHandlerFactory actionHandlerFactory) { Handler = handler; mFilters = handler.Filters; HttpContext = context; ActionHandlerFactory = actionHandlerFactory; Parameters = handler.GetParameters(context); Controller = handler.Controller; if (!handler.SingleInstance) { Controller = actionHandlerFactory.GetController(handler.ControllerType); if (Controller == null) { Controller = this.Controller; } } }
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); }
internal ActionContext(ActionHandler handler, IHttpContext context, ActionHandlerFactory actionHandlerFactory) { Handler = handler; mFilters = handler.Filters; HttpContext = context; ActionHandlerFactory = actionHandlerFactory; Parameters = handler.GetParameters(context); Controller = handler.Controller; if (handler.InstanceType != InstanceType.Single) { if (handler.InstanceType == InstanceType.Session) { var factory = SessionControllerFactory.GetFactory(context.Session); Controller = factory[handler.ControllerUID]; if (Controller == null) { Controller = actionHandlerFactory.GetController(handler.ControllerType, context); if (Controller == null) { Controller = Activator.CreateInstance(handler.ControllerType); } factory[handler.ControllerUID] = Controller; } } else { Controller = actionHandlerFactory.GetController(handler.ControllerType, context); if (Controller == null) { Controller = Activator.CreateInstance(handler.ControllerType); } } } if (Controller == null) { Controller = handler.Controller; } }
public object Invoke(object controller, IHttpContext context, ActionHandlerFactory actionHandlerFactory, object[] parameters) { return(mMethodHandler.Execute(controller, parameters)); }
public ParamterEventBinder(ActionHandlerFactory actionHandlerFactory) { ActionHandlerFactory = actionHandlerFactory; }