public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { HttpRequest request = context.Request; string contentType = request.ContentType; if (!String.IsNullOrEmpty(contentType) && contentType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)) { Type handlerType = null; if (url.EndsWith(ProfileService.DefaultWebServicePath, StringComparison.Ordinal)) { handlerType = typeof(ProfileService); } else if (url.EndsWith(AuthenticationService.DefaultWebServicePath, StringComparison.Ordinal)) { handlerType = typeof(AuthenticationService); } else { handlerType = BuildManager.GetCompiledType(url); if (handlerType == null) { handlerType = WebServiceParser.GetCompiledType(url, context); } } return(RestHandler.GetHandler(context, handlerType, url)); } if (request.PathInfo.StartsWith("/js", StringComparison.OrdinalIgnoreCase)) { return(new ClientProxyHandler(WebServiceParser.GetCompiledType(url, context), url)); } return(_wsFactory.GetHandler(context, requestType, url, pathTranslated)); }
private static IHttpHandler CreateHandler(WebServiceData webServiceData, string methodName) { // Get the data about the method being called WebServiceMethodData methodData = webServiceData.GetMethodData(methodName); // Create the proper handler, depending on whether we need session state RestHandler handler; if (methodData.RequiresSession) handler = new RestHandlerWithSession(); else handler = new RestHandler(); // Save the method data in the handler handler._webServiceMethodData = methodData; return handler; }
public static IHttpHandler GetHandler(HttpContext context, Type type, string filePath) { RestHandler handler = new RestHandler(context, type, filePath); LogicalTypeInfo.LogicalMethodInfo mi = handler._logicalMethodInfo; if (mi.MethodInfo.IsStatic) { if (IRequiresSessionStateType.IsAssignableFrom(type)) { return(IReadOnlySessionStateType.IsAssignableFrom(type) ? new ReadOnlySessionWrapperHandler(handler) : new SessionWrapperHandler(handler)); } } else if (mi.EnableSession) { return(new SessionWrapperHandler(handler)); } return(handler); }
private static IHttpHandler CreateHandler(WebServiceData webServiceData, string methodName) { // Get the data about the method being called WebServiceMethodData methodData = webServiceData.GetMethodData(methodName); // Create the proper handler, depending on whether we need session state RestHandler handler; if (methodData.RequiresSession) { handler = new RestHandlerWithSession(); } else { handler = new RestHandler(); } // Save the method data in the handler handler._webServiceMethodData = methodData; return(handler); }
public static IHttpHandler GetHandler (HttpContext context, Type type, string filePath) { RestHandler handler = new RestHandler (context, type, filePath); LogicalTypeInfo.LogicalMethodInfo mi = handler._logicalMethodInfo; if (mi.MethodInfo.IsStatic) { if (IRequiresSessionStateType.IsAssignableFrom (type)) return IReadOnlySessionStateType.IsAssignableFrom (type) ? new ReadOnlySessionWrapperHandler (handler) : new SessionWrapperHandler (handler); } else if (mi.WebMethod.EnableSession) return new SessionWrapperHandler (handler); return handler; }