コード例 #1
0
 public void GetContext()
 {
     while (true)
     {
         while (_requestsQueue._requestQueue.Count > 0)
         {
             var httpListenerContext = _requestsQueue.GetRequest();
             if (httpListenerContext == null)
             {
                 continue;
             }
             Dispatcher dispatcher = new Dispatcher(httpListenerContext, _domainPath);
             dispatcher.ParseRequest();
             if (dispatcher.UrlAbsolutePath().Contains("favicon"))
             {
                 continue;
             }
             HttpHandlerFactory httpHandlerFactory = new HttpHandlerFactory();
             IHttpHandler       httpHandler        = httpHandlerFactory.GetHttpHandler(dispatcher.GetHttpMethod());
             _bytes = httpHandler.GetBytes(dispatcher);
             Response response = new Response(httpListenerContext);
             response.WriteResponse(_bytes);
         }
     }
 }