Exemple #1
0
 private void InvokeHandlersWith(HttpProcessor p, Stream stream)
 {
     var handled = false;
     foreach (var handler in _handlers)
     {
         try
         {
             var pipelineResult = handler(p, stream);
             switch (pipelineResult)
             {
                 case HttpServerPipelineResult.Handled:
                     // TODO: allow more pipelining
                 case HttpServerPipelineResult.HandledExclusively:
                     handled = true;
                     break;
             }
             if (pipelineResult == HttpServerPipelineResult.HandledExclusively)
                 break;
         }
         catch
         {
         }
     }
     if (!handled)
     {
         Log("No handlers found for {0}", p.FullUrl);
         throw new Exception("Request was not handled by any registered handlers");
     }
 }
Exemple #2
0
 public override void HandlePOSTRequest(HttpProcessor p, Stream inputData)
 {
     Log("Incoming POST request: {0}", p.FullUrl);
     InvokeHandlersWith(p, inputData);
 }
 public abstract void HandlePOSTRequest(HttpProcessor p, Stream inputData);
Exemple #4
0
 public override void HandleGETRequest(HttpProcessor p)
 {
     Log("Incoming GET request: {0}", p.FullUrl);
     InvokeHandlersWith(p, null);
 }
 public abstract void HandleGETRequest(HttpProcessor p);