当前位置: 首页>>代码示例>>C#>>正文


C# IHttpHandler类代码示例

本文整理汇总了C#中IHttpHandler的典型用法代码示例。如果您正苦于以下问题:C# IHttpHandler类的具体用法?C# IHttpHandler怎么用?C# IHttpHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IHttpHandler类属于命名空间,在下文中一共展示了IHttpHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUpSessionState

        internal static void SetUpSessionState(HttpContextBase context, IHttpHandler handler, ConcurrentDictionary<Type, SessionStateBehavior?> cache)
        {
            WebPageHttpHandler webPageHandler = handler as WebPageHttpHandler;
            Debug.Assert(handler != null);
            SessionStateBehavior? sessionState = GetSessionStateBehavior(webPageHandler.RequestedPage, cache);

            if (sessionState != null)
            {
                // If the page explicitly specifies a session state value, return since it has the most priority.
                context.SetSessionStateBehavior(sessionState.Value);
                return;
            }

            WebPageRenderingBase page = webPageHandler.StartPage;
            StartPage startPage = null;
            do
            {
                // Drill down _AppStart and _PageStart.
                startPage = page as StartPage;
                if (startPage != null)
                {
                    sessionState = GetSessionStateBehavior(page, cache);
                    page = startPage.ChildPage;
                }
            }
            while (startPage != null);

            if (sessionState != null)
            {
                context.SetSessionStateBehavior(sessionState.Value);
            }
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:32,代码来源:SessionStateUtil.cs

示例2: ReleaseHandler

		public void ReleaseHandler(IHttpHandler handler)
		{
			IDisposable d = handler as IDisposable;

			if (d != null)
				d.Dispose();
		}
开发者ID:joaomajesus,项目名称:Tarantino,代码行数:7,代码来源:HandlerFactory.cs

示例3: VerifyAndProcessRequest

		protected override void VerifyAndProcessRequest(IHttpHandler handler, HttpContextBase context)
		{
			Precondition.Require(handler, () => Error.ArgumentNull("handler"));
			Precondition.Require(context, () => Error.ArgumentNull("context"));

			handler.ProcessRequest(context.Unwrap());
		}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:7,代码来源:MvcHttpHandler.cs

示例4: HttpServer

        public HttpServer(IHttpHandler app, HttpServerSettings settings)
        {
            if (app == null) throw new ArgumentNullException("app");
            if (settings == null) throw new ArgumentNullException("settings");

            // init asp.net host
            if (settings.AspNetHost)
            {
                var appHost = new AppHost(settings);
                appHost.Init();
            }

            IHttpListener listener;

            switch (settings.Mode)
            {
                case HttpServerMode.TcpListener:
                    listener = new TcpListenerImpl(app, settings);
                    break;
                case HttpServerMode.HttpListener:
                    listener = new HttpListenerImpl(app, settings);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            _listener = listener;
            _listener.Start();

            _listenerThread = new Thread(Listen);
            _listenerThread.Start();
        }
开发者ID:lstefano71,项目名称:SharpExpress,代码行数:32,代码来源:HttpServer.cs

示例5: ReleaseHandler

 public void ReleaseHandler(IHttpHandler httphandler)
 {
     if (httphandler is HandlerWrapper)
     {
         ((HandlerWrapper) httphandler).ReleaseWrappedHandler();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:XamlHttpHandlerFactory.cs

示例6: RegisterUserControl

        private static void RegisterUserControl(IHttpHandler handler)
        {
            var page = handler as Page;
           
            Action<Control> RegisterUserControl = null;
            Action<ControlCollection> RegisterControls = null;

            EventHandler onPageLoad = null;
            onPageLoad = (sender, e) =>
                 {

                     RegisterControls = controls =>
                     {
                         foreach (Control c in controls)
                             RegisterUserControl(c);
                     };

                     RegisterUserControl = control =>
                     {
                         var userControl = control as UserControl;
                         if (userControl != null)
                             Kernel.Compose(userControl);
                         RegisterControls(control.Controls);
                     };

                     RegisterControls(page.Controls);

                     page.Load -= onPageLoad;
                 };

            if (page != null)
                page.Load += onPageLoad;

        }
开发者ID:netcasewqs,项目名称:nlite.web,代码行数:34,代码来源:HttpHandlerFactory.cs

示例7: GetHttpHandler

        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            if (_httpHandler == null)
                _httpHandler = new AssetManagerRouteHttpHandler(_url);

            return _httpHandler;
        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:7,代码来源:AssetManagerRouteHandler.cs

示例8: ReleaseHandler

 public void ReleaseHandler(IHttpHandler handler)
 {
     if (!this._handler.IsReusable)
     {
         this._handler = null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:HandlerFactoryWrapper.cs

示例9: HttpHandlerFactory

        static HttpHandlerFactory()
        {
            DefaultHttpHandler = new StaticFileHttpHandler();
            DirectoryHttpHandler = AspNetHandler = new AspNetHttpHandler();

            var cache = new Dictionary<string, IHttpHandler>();
            handlers = new Dictionary<string, IHttpHandler>();
            foreach (HttpHandlerElement handlerElement in ServerConfiguration.HttpHandlers)
            {
                try
                {
                    if (handlerElement.Extension == "*")
                    {
                        DefaultHttpHandler = GetOrCreateHttpHandler(handlerElement.HandlerType, cache);
                        continue;
                    }
                    if (handlerElement.Extension == "/")
                    {
                        DirectoryHttpHandler = GetOrCreateHttpHandler(handlerElement.HandlerType, cache);
                        continue;
                    }
                    if (!handlers.ContainsKey(handlerElement.Extension))
                    {
                        handlers[handlerElement.Extension] = GetOrCreateHttpHandler(handlerElement.HandlerType, cache);
                    }
                }
                catch (Exception ex)
                {
                    log.ErrorFormat("Can not create HttpHandler '{0}'.\r\n{1}", handlerElement.HandlerType, ex);
                }
            }
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:32,代码来源:HttpHandlerFactory.cs

示例10: TestHttpServer

        public TestHttpServer(FixedPortAddress address, IHttpHandler handler)
        {
            Url = address.Url;
            this.handler = handler;

            Instance = this;
        }
开发者ID:SystemDot,项目名称:SystemDotServiceBus,代码行数:7,代码来源:TestHttpServer.cs

示例11: HttpListenerImpl

 public HttpListenerImpl(IHttpHandler app, HttpServerSettings settings)
 {
     _app = app;
     _settings = settings;
     _listener = new HttpListener();
     _listener.Prefixes.Add(string.Format(@"http://+:{0}/", settings.Port));
 }
开发者ID:lstefano71,项目名称:SharpExpress,代码行数:7,代码来源:HttpListenerImpl.cs

示例12: GetHttpHandler

        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            if (_httpHandler == null)
                _httpHandler = new ConfigurationRouteHttpHandler();

            return _httpHandler;
        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:7,代码来源:ConfigurationRouteHandler.cs

示例13: ReleaseHandler

 public override void ReleaseHandler(IHttpHandler handler)
 {
     if (!(handler is SourceViewer))
     {
         base.ReleaseHandler(handler);
     }
 }
开发者ID:AlgebraBurger,项目名称:HandlersRepo,代码行数:7,代码来源:SourceViewer.cs

示例14: GetHttpHandler

        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            if (_httpHandler == null)
                _httpHandler = new RestServiceRouteHttpHandler(_type, _url);

            return _httpHandler;
        }
开发者ID:JoB70,项目名称:Bifrost,代码行数:7,代码来源:RestServiceRouteHandler.cs

示例15: Call

        public async Task<object> Call(IHttpHandler httpHandler, string baseUrl, Dictionary<string, object> arguments, HttpApiInstrumenter apiInstrumenter = null)
        {
            var request = new HttpApiRequest { Url = Url.CreateUrl(baseUrl), Method = Method, Headers = Headers.ToList() };

            Action<Func<IHttpArgumentHandler, string, object, Task>> applyArguments = async applier =>
            {
                foreach (var item in ArgumentHandlers)
                {
                    var name = item.Key;
                    object argument;
                    if (arguments.TryGetValue(name, out argument))
                    {
                        var handler = item.Value;
                        await applier(handler, name, argument);
                    }
                }
            };

            applyArguments(async (handler, name, argument) => await handler.ApplyArgument(request, name, argument));

            Func<HttpApiRequest, Task<HttpApiResponse>> call = async apiRequest => await httpHandler.Call(apiRequest);

            HttpApiResponse response;
            if (apiInstrumenter != null)
                response = await apiInstrumenter(request, call);
            else
                response = await call(request);

            applyArguments(async (handler, name, argument) => await handler.ApplyArgument(response, name, argument));
            return await ResponseHandler.HandleResponse(request, response);
        }
开发者ID:kswoll,项目名称:sexy-http,代码行数:31,代码来源:HttpApiEndpoint.cs


注:本文中的IHttpHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。