Exemple #1
0
        internal MiddlewareData(string Path, LanguageManager STR_LANG, WebHttpContextRaw ContextRaw)
        {
            this.Path       = Path;
            this.STR_LANG   = STR_LANG;
            this.ContextRaw = ContextRaw;

            Context = new WebHttpContext(ContextRaw);
        }
Exemple #2
0
 public WebHttpContext(WebHttpContextRaw Raw)
 {
     this.Request  = Raw.Request;
     this.Response = Raw.Response;
     this.Info     = Raw.Info;
     try { if (Raw.Session != null)
           {
               this.Session = new WebHttpSession(Raw.Session);
           }
     } catch { }
 }
Exemple #3
0
        public static async Task <ModuleResponseCode> RouteAsync(string Path, LanguageManager STR_LANG, WebHttpContextRaw ContextRaw)
        {
            string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            //Set HTTP Header to this
            ContextRaw.Response.SetHeader("X-Powered-By", $"HS Server Framework (Web)/{Version}");
            ContextRaw.Response.SetHeader("Server", $"HS Server (Web)/{Version}");

            MiddlewareData data = await Middleware.RouteAsync(new MiddlewareData(Path, STR_LANG, ContextRaw));

            ModuleResponseCode ResultCode = (ModuleResponseCode)data.StatusCode;

            if (!data.IsClose && ContextRaw.Response.IsWritable)
            {
                ResultCode = await Router.RouteAsync(data);
            }
            //MiddleWareData data_post = await MiddleWare_Post.RouteAsync(Path, Params, STR_LANG, ContextRaw);
            return(ResultCode);
        }