Esempio n. 1
0
 public void Requested(Servers.RequestAgent requestAgent)
 {
     try
     {
         var items = mRequestedHandlers;
         if (items.Length > 0)
         {
             if (requestAgent.EventRequestCompletedArgs == null)
             {
                 requestAgent.EventRequestCompletedArgs = new Events.EventRequestCompletedArgs(requestAgent.UrlRoute,
                                                                                               requestAgent.Request, requestAgent.Response, Gateway, requestAgent.Code, requestAgent.Server, requestAgent.Time);
                 if (requestAgent.ResponseError != null)
                 {
                     requestAgent.EventRequestCompletedArgs.Error = requestAgent.ResponseError.Message;
                 }
                 requestAgent.EventRequestCompletedArgs.RequestID = requestAgent.Request.ID;
             }
             for (int i = 0; i < items.Length; i++)
             {
                 if (Gateway.PluginCenter.PluginIsEnabled(items[i]))
                 {
                     items[i].Execute(requestAgent.EventRequestCompletedArgs);
                 }
             }
         }
     }
     catch (Exception e_)
     {
         if (Gateway.HttpServer.EnableLog(BeetleX.EventArgs.LogType.Error))
         {
             Gateway.HttpServer.Log(BeetleX.EventArgs.LogType.Error, $"gateway {requestAgent.Request.ID} {requestAgent.Request.RemoteIPAddress} {UrlRoute?.Url} process requeted event error {e_.Message}{e_.StackTrace}");
         }
     }
 }
Esempio n. 2
0
 public void Requested(Servers.RequestAgent requestAgent)
 {
     try
     {
         var items = mRequestedHandlers;
         if (items.Length > 0)
         {
             Events.EventRequestCompletedArgs e = new Events.EventRequestCompletedArgs(requestAgent.UrlRoute,
                                                                                       requestAgent.Request, requestAgent.Response, Gateway, requestAgent.Code, requestAgent.Server, requestAgent.Time);
             for (int i = 0; i < items.Length; i++)
             {
                 items[i].Execute(e);
             }
         }
     }
     catch (Exception e_)
     {
         if (Gateway.HttpServer.EnableLog(BeetleX.EventArgs.LogType.Error))
         {
             Gateway.HttpServer.Log(BeetleX.EventArgs.LogType.Error, $"gateway {UrlRoute?.Url} process requeted error {e_.Message}{e_.StackTrace}");
         }
     }
 }