/// <summary> /// Initializes a new instance of the <see cref="AjaxProcHelper"/> class. /// </summary> /// <param name="p">The p.</param> /// <param name="token">The token.</param> internal AjaxProcHelper(AjaxProcessor p, IntPtr token) : this(p) { this.token = token; }
internal AjaxSyncHttpHandlerSessionReadOnly(AjaxProcessor p) : base(p) { }
/// <summary> /// Initializes a new instance of the <see cref="AjaxProcHelper"/> class. /// </summary> /// <param name="p">The p.</param> internal AjaxProcHelper(AjaxProcessor p) { this.p = p; }
internal AjaxAsyncHttpHandlerSession(AjaxProcessor p) : base(p) { }
/// <summary> /// Initializes a new instance of the <see cref="AjaxSyncHttpHandler"/> class. /// </summary> /// <param name="p">The p.</param> internal AjaxSyncHttpHandler(AjaxProcessor p) : base() { this.p = p; }
/// <summary> /// Initializes a new instance of the <see cref="AjaxAsyncHttpHandler"/> class. /// </summary> /// <param name="p">The p.</param> internal AjaxAsyncHttpHandler(AjaxProcessor p) : base() { this.p = p; }
private IHttpHandler GetHandler(HttpContext context, string filename) { Type t = null; Exception typeException = null; string className = filename; if (Utility.Settings != null && Utility.Settings.UrlClassMappings.ContainsKey(filename)) { className = Utility.Settings.UrlClassMappings[filename] as string; if (context.Trace.IsEnabled) context.Trace.Write(Constant.AjaxID, "Url match to Type: " + className); } try { t = Type.GetType(className, true); } catch (Exception ex) { if (context.Trace.IsEnabled) context.Trace.Write(Constant.AjaxID, "Type not found: " + className); typeException = ex; } AjaxProcessor[] p = new AjaxProcessor[3]; p[0] = new XmlHttpRequestProcessor(context, t); p[1] = new IFrameProcessor(context, t); p[2] = new ExtJSProcessor(context, t); for (int i = 0; i < p.Length; i++) { if (!p[i].CanHandleRequest) continue; if (typeException != null) { #if(WEBEVENT) string errorText = string.Format(Constant.AjaxID + " Error", context.User.Identity.Name); Management.WebAjaxErrorEvent ev = new Management.WebAjaxErrorEvent(errorText, WebEventCodes.WebExtendedBase + 200, typeException); ev.Raise(); #endif p[i].SerializeObject(new NotSupportedException("This method is either not marked with an AjaxMethod or is not available.")); return null; } AjaxMethodAttribute[] ma = (AjaxMethodAttribute[])p[i].AjaxMethod.GetCustomAttributes(typeof(AjaxMethodAttribute), true); bool useAsync = false; HttpSessionStateRequirement sessionReq = HttpSessionStateRequirement.ReadWrite; if (ma.Length > 0) { useAsync = ma[0].UseAsyncProcessing; if (ma[0].RequireSessionState != HttpSessionStateRequirement.UseDefault) sessionReq = ma[0].RequireSessionState; } switch (sessionReq) { case HttpSessionStateRequirement.Read: if (!useAsync) return new AjaxSyncHttpHandlerSessionReadOnly(p[i]); else return new AjaxAsyncHttpHandlerSessionReadOnly(p[i]); case HttpSessionStateRequirement.ReadWrite: if (!useAsync) return new AjaxSyncHttpHandlerSession(p[i]); else return new AjaxAsyncHttpHandlerSession(p[i]); case HttpSessionStateRequirement.None: if (!useAsync) return new AjaxSyncHttpHandler(p[i]); else return new AjaxAsyncHttpHandler(p[i]); default: if (!useAsync) return new AjaxSyncHttpHandlerSession(p[i]); else return new AjaxAsyncHttpHandlerSession(p[i]); } } return null; }
internal AjaxAsyncHttpHandlerSessionReadOnly(AjaxProcessor p) : base(p) { }
private IHttpHandler GetHandler(HttpContext context, string filename) { Type t = null; Exception typeException = null; string className = filename; if (Utility.Settings != null && Utility.Settings.UrlClassMappings.ContainsKey(filename)) { className = Utility.Settings.UrlClassMappings[filename] as string; if (context.Trace.IsEnabled) { context.Trace.Write(Constant.AjaxID, "Url match to Type: " + className); } } try { t = Type.GetType(className, true); } catch (Exception ex) { if (context.Trace.IsEnabled) { context.Trace.Write(Constant.AjaxID, "Type not found: " + className); } typeException = ex; } AjaxProcessor[] p = new AjaxProcessor[3]; p[0] = new XmlHttpRequestProcessor(context, t); p[1] = new IFrameProcessor(context, t); p[2] = new ExtJSProcessor(context, t); for (int i = 0; i < p.Length; i++) { if (!p[i].CanHandleRequest) { continue; } if (typeException != null) { #if (WEBEVENT) string errorText = string.Format(Constant.AjaxID + " Error", context.User.Identity.Name); Management.WebAjaxErrorEvent ev = new Management.WebAjaxErrorEvent(errorText, WebEventCodes.WebExtendedBase + 200, typeException); ev.Raise(); #endif p[i].SerializeObject(new NotSupportedException("This method is either not marked with an AjaxMethod or is not available.")); return(null); } AjaxMethodAttribute[] ma = (AjaxMethodAttribute[])p[i].AjaxMethod.GetCustomAttributes(typeof(AjaxMethodAttribute), true); bool useAsync = false; HttpSessionStateRequirement sessionReq = HttpSessionStateRequirement.ReadWrite; if (ma.Length > 0) { useAsync = ma[0].UseAsyncProcessing; if (ma[0].RequireSessionState != HttpSessionStateRequirement.UseDefault) { sessionReq = ma[0].RequireSessionState; } } switch (sessionReq) { case HttpSessionStateRequirement.Read: if (!useAsync) { return(new AjaxSyncHttpHandlerSessionReadOnly(p[i])); } else { return(new AjaxAsyncHttpHandlerSessionReadOnly(p[i])); } case HttpSessionStateRequirement.ReadWrite: if (!useAsync) { return(new AjaxSyncHttpHandlerSession(p[i])); } else { return(new AjaxAsyncHttpHandlerSession(p[i])); } case HttpSessionStateRequirement.None: if (!useAsync) { return(new AjaxSyncHttpHandler(p[i])); } else { return(new AjaxAsyncHttpHandler(p[i])); } default: if (!useAsync) { return(new AjaxSyncHttpHandlerSession(p[i])); } else { return(new AjaxAsyncHttpHandlerSession(p[i])); } } } return(null); }
internal AjaxSyncHttpHandlerSession(AjaxProcessor p) : base(p) { }