Пример #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));
        }
Пример #2
0
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            WebServiceHandlerFactory wshFactory = new WebServiceHandlerFactory();

            return(wshFactory.GetHandler(
                       HttpContext.Current, "GET,POST", VirtualPath, HttpContext.Current.Server.MapPath(VirtualPath)));
        }
        IHttpHandler IHttpHandlerFactory.GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
        {
            IHttpHandler handler = null;

            if (context.Request.QueryString != null)
            {
                pathTranslated = getPathTranslatedFromSiteGeneratorGUI(url, pathTranslated);
            }
            // check if it is an .aspx page
            if (".aspx" == Path.GetExtension(pathTranslated))
            {
                context.RewritePath(url, url, context.Request.QueryString.ToString());
                handler = PageParser.GetCompiledPageInstance(url, pathTranslated, context);
            }
            else if (".asmx" == Path.GetExtension(pathTranslated).ToLower())
            {
                WebServiceHandlerFactory wshf = new WebServiceHandlerFactory();
                handler = wshf.GetHandler(context, requestType, url, pathTranslated);
            }
            else
            {
                ProcessStaticContent(pathTranslated);   // Process page and
                HttpContext.Current.Response.End();     //  end here
            }

            return(handler);
        }
Пример #4
0
        public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string virtualPath, string path)
        {
            if (context.Request.PathInfo == "/js")
            {
                Type type = WebServiceParser.GetCompiledType(path, context);

                return(new JSProxyGenerator(type, virtualPath));
            }
            else
            {
                return(fallback.GetHandler(context, requestType, virtualPath, path));
            }
        }
        //private IWindsorContainer _container;

        #region IHttpHandler Members

        /// <summary>
        /// Process the aspx request. This means (eventually) rewriting the url and registering the page
        /// in the container.
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            string rawUrl = context.Request.RawUrl;

            log.Info("Starting request for " + rawUrl);
            DateTime startTime = DateTime.Now;

            // Rewrite url

            #region //Ali Ozgur: This is an ajax request, so we have to realign the rewritten url.

            if (context.Request["HTTP_X_MICROSOFTAJAX"] != null)
            {
                int idx = rawUrl.ToLowerInvariant().IndexOf("/default.aspx");
                if (idx >= 0)
                {
                    rawUrl = rawUrl.Substring(idx, rawUrl.Length - idx);
                }
            }

            #endregion

            WebServiceHandlerFactory factory = new WebServiceHandlerFactory();
            IHttpHandler             handler = factory.GetHandler(context, context.Request.RequestType, context.Request.FilePath,
                                                                  context.Request.FilePath);

            // Process the page just like any other aspx page
            handler.ProcessRequest(context);

            // Release loaded modules. These modules are added to the HttpContext.Items collection by the ModuleLoader.
            ReleaseModules();

            // Log duration
            TimeSpan duration = DateTime.Now - startTime;
            log.Info(String.Format("Request finshed. Total duration: {0} ms.", duration.Milliseconds));
        }
Пример #6
0
 public IHttpHandler GetHttpHandler(RequestContext requestContext)
 {
     // Note: can't pass requestContext.HttpContext as the first parameter because that's
     // type HttpContextBase, while GetHandler wants HttpContext.
     return(_handlerFactory.GetHandler(HttpContext.Current, requestContext.HttpContext.Request.HttpMethod, _virtualPath, requestContext.HttpContext.Server.MapPath(_virtualPath)));
 }
Пример #7
0
 public IHttpHandler GetHttpHandler(RequestContext requestContext)
 {
     return(_handlerFactory.GetHandler(HttpContext.Current, requestContext.HttpContext.Request.HttpMethod, _virtualPath, requestContext.HttpContext.Server.MapPath(_virtualPath)));
 }