Пример #1
0
        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));
        }