public virtual void ProcessRequest(UMC.Net.NetContext context) { if (Authorization(context)) { string Prefix = UMC.Data.Utility.GetPrefix(context.Url); if (String.IsNullOrEmpty(Prefix)) { Process(context, string.Empty, string.Empty); } else { UMC.Net.INetHandler handler = UMC.Data.Reflection.CreateObject(UMC.Data.Reflection.Configuration("payment"), Prefix) as UMC.Net.INetHandler; handler.ProcessRequest(context); } } else { Data.JSON.Serialize(Mapping(), context.Output); } }
public virtual void ProcessRequest(UMC.Net.NetContext context) { var path = context.Url.LocalPath; var staticFile = Utility.MapPath("App_Data/Static" + path); var paths = new List <string>(context.Url.LocalPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)); if (paths.Count == 0) { paths.Add("index"); staticFile += "index.html"; } switch (context.HttpMethod) { case "GET": if (System.IO.File.Exists(staticFile)) { TransmitFile(context, staticFile); return; } break; } var lastPath = paths[paths.Count - 1]; switch (paths[0]) { case "Click": case "Page": IndexResource(context, "Page.js", "page"); return; case "TEMP": Temp(context); return; case "js": if (lastPath.EndsWith(".js")) { context.ContentType = "text/javascript"; var key = lastPath.Substring(0, lastPath.LastIndexOf('.')); switch (key) { case "Page": key = "UMC"; break; case "UMC.Conf": { var ks = ResourceKeys; for (var i = ks.Count - 1; i > -1; i--) { var initer = Reflection.CreateInstance(ks[i].Type) as Data.Sql.Initializer; if (String.IsNullOrEmpty(initer.ResourceJS) == false) { using (System.IO.Stream stream = initer.GetType().GetProperty("ResourceJS").DeclaringType.Assembly .GetManifestResourceStream(initer.ResourceJS)) { context.Output.WriteLine("/****{0} Conf****/", initer.Name); context.Output.WriteLine(new System.IO.StreamReader(stream).ReadToEnd()); } } } } return; } var rKey = GetResourceKey(key); if (rKey != null) { var initer = Reflection.CreateInstance(rKey.Type) as Data.Sql.Initializer; initer.Resource(context, path); return; } } break; case "UMC": if (paths.Count == 1) { IndexResource(context, "index"); return; } break; default: { if (CheckUMC(context)) { Process(context); return; } if (lastPath.IndexOf('.') > 0) { var names = lastPath.Split('.'); var configs = UMC.Data.Reflection.Configuration(names[0]); if (configs != null) { UMC.Net.INetHandler handler = UMC.Data.Reflection.CreateObject(configs, names[1]) as UMC.Net.INetHandler; if (handler != null) { handler.ProcessRequest(context); return; } } } switch (context.HttpMethod) { case "GET": var file = Utility.MapPath("App_Data/Static/" + String.Join("/", paths.ToArray()) + ".html"); if (System.IO.File.Exists(file)) { File(context, file); return; } if (paths.Count < 4) { var database = Reflection.Configuration("database") ?? new UMC.Configuration.ProviderConfiguration(); foreach (var key in ResourceKeys) { var initer = Reflection.CreateInstance(key.Type) as Data.Sql.Initializer; if (database.Providers.ContainsKey(initer.ProviderName)) { if (initer.Resource(context, path)) { return; } } } if (paths.Count < 2) { IndexResource(context, "index"); return; } } break; default: Process(context); return; } } break; } Process(context); }