Exemplo n.º 1
0
 private void HttpServer_HttpConnectionReceived(object sender, HttpConnectionEventArgs e)
 {
     if (_started &&
         ((e.Context.Request.Url.IsAbsoluteUri && StringComparer.InvariantCultureIgnoreCase.Compare(e.Context.Request.Url.AbsolutePath, ApplicationPrefix.AbsolutePath) == 0) ||
          StringComparer.InvariantCultureIgnoreCase.Compare(e.Context.Request.Url.OriginalString, ApplicationPrefix.AbsolutePath) == 0))
     {
         OnHmeApplicationRequestReceived(e.Context);
     }
     else if (_started &&
              ((e.Context.Request.Url.IsAbsoluteUri && e.Context.Request.Url.AbsolutePath.StartsWith(ApplicationPrefix.AbsolutePath, StringComparison.InvariantCultureIgnoreCase)) ||
               e.Context.Request.Url.OriginalString.StartsWith(ApplicationPrefix.AbsolutePath, StringComparison.InvariantCultureIgnoreCase)))
     {
         if (StringComparer.InvariantCultureIgnoreCase.Compare(e.Context.Request.Url.LocalPath, iconUri) == 0)
         {
             HmeApplicationIconRequestedArgs iconArgs = new HmeApplicationIconRequestedArgs {
                 BaseUri = BuildBaseUri(e.Context)
             };
             OnHmeApplicationIconRequested(iconArgs);
             e.Context.Response.ContentType     = iconArgs.ContentType;
             e.Context.Response.ContentLength64 = iconArgs.Icon.LongLength;
             e.Context.Response.OutputStream.Write(iconArgs.Icon, 0, iconArgs.Icon.Length);
             //e.Context.Response.Close();
         }
         else
         {
             OnNonApplicationRequestReceived(e);
         }
     }
 }
Exemplo n.º 2
0
        protected virtual void OnNonApplicationRequestReceived(HttpConnectionEventArgs e)
        {
            ServerLog.Write(TraceEventType.Verbose, "Enter HmeServer.OnNonApplicationRequestReceived");
            EventHandler <HttpConnectionEventArgs> handler = NonApplicationRequestReceived;

            if (handler != null)
            {
                handler(this, e);
            }
            ServerLog.Write(TraceEventType.Verbose, "Exit HmeServer.OnNonApplicationRequestReceived");
        }
Exemplo n.º 3
0
 protected override void OnNonApplicationRequestReceived(HttpConnectionEventArgs e)
 {
     ServerLog.Write(TraceEventType.Verbose, "Enter HmeServer<T>.OnNonApplicationRequestReceived");
     if (_usesHostHttpServices)
     {
         var host = ((IHttpApplicationHostPool)GetService(typeof(IHttpApplicationHostPool))).GetHost(WebAppPath);
         host.ProcessRequest(ApplicationPrefix, e.Context);
     }
     else
     {
         base.OnNonApplicationRequestReceived(e);
     }
     ServerLog.Write(TraceEventType.Verbose, "Exit HmeServer<T>.OnNonApplicationRequestReceived");
 }