Inheritance: System.EventArgs
コード例 #1
0
 protected override void OnRequestReceived(RequestEventArgs <HttpRequest, HttpResponse> rea)
 {
     base.OnRequestReceived(rea);
     if (HttpRequestReceived != null)
     {
         HttpRequestReceived(this, (HttpServerEventArgs)rea);
     }
 }
コード例 #2
0
 protected override void Treat(RequestEventArgs <HttpRequest, HttpResponse> rea, Stream client)
 {
     try
     {
         base.Treat(rea, client);
         if (rea.Response.Headers.ContainsKey("Connection") && rea.Response.Headers["Connection"] == "Keep-Alive")
         {
             Treat(GetEventArgs(rea.Request), client);
         }
     }
     catch (NotImplementedException e)
     {
         ReplyError(client, e, HttpStatusCode.NotImplemented);
     }
     catch (Exception e)
     {
         ReplyError(client, e, HttpStatusCode.BadRequest);
     }
 }
コード例 #3
0
ファイル: UdpRestServer.cs プロジェクト: RoyDoron/bonjour.net
 private void ReceiveRequest(IAsyncResult result)
 {
     RequestEventArgs rea = new RequestEventArgs();
     IPEndPoint ep = new IPEndPoint(IPAddress.Any, Port);
     byte[] requestBytes = client.EndReceive(result, ref ep);
     if (IsStarted)
         client.BeginReceive(ReceiveRequest, null);
     HttpRequest request = HttpRequest.FromBytes(requestBytes);
     rea.Request = request;
     rea.Host = ep;
     try
     {
         OnRequestReceived(rea);
         Reply(ep, rea.Response);
     }
     catch (NotImplementedException e)
     {
         ReplyError(ep, e, HttpStatusCode.NotImplemented);
     }
     catch (Exception e)
     {
         ReplyError(ep, e, HttpStatusCode.BadRequest);
     }
 }
コード例 #4
0
ファイル: Command.cs プロジェクト: devrelm/Zeroconf.NET
 public abstract void Execute(RequestEventArgs e);
コード例 #5
0
ファイル: Program.cs プロジェクト: RoyDoron/bonjour.net
 static void server_RequestReceived(object sender, RequestEventArgs<HttpRequest, HttpResponse> e)
 {
     Console.WriteLine("Request received from " + e.Host);
 }
コード例 #6
0
ファイル: RestServer.cs プロジェクト: RoyDoron/bonjour.net
 public void OnRequestReceived(RequestEventArgs rea)
 {
     if (RequestReceived != null)
         RequestReceived(this, rea);
 }
コード例 #7
0
ファイル: Command.cs プロジェクト: RoyDoron/bonjour.net
 public abstract void Execute(RequestEventArgs e);