Example #1
0
 protected virtual void OnProcessResource(HttpRequest request, HttpResponse response)
 {
     if (request.Method == HttpParse.GET_TAG)
     {
         try
         {
             mResourceCenter.ProcessFile(request, response);
         }
         catch (Exception e_)
         {
             if (EnableLog(LogType.Error))
             {
                 BaseServer.Error(e_, request.Session, $"{request.RemoteIPAddress} {request.Method} {request.BaseUrl} file error {e_.Message}");
                 InnerErrorResult result = new InnerErrorResult($"response file error ", e_, ServerConfig.OutputStackTrace);
                 response.Result(result);
             }
         }
     }
     else
     {
         if (EnableLog(LogType.Info))
         {
             Log(LogType.Info, $"{request.RemoteIPAddress}{request.Method} {request.Url} not support");
         }
         NotSupportResult notSupport = new NotSupportResult($"{request.Method} {request.Url} not support");
         response.Result(notSupport);
     }
 }
Example #2
0
 protected virtual void OnProcessResource(HttpRequest request, HttpResponse response)
 {
     if (string.Compare(request.Method, "GET", true) == 0)
     {
         mResourceCenter.ProcessFile(request, response);
     }
     else
     {
         response.NotSupport();
     }
 }
Example #3
0
 protected virtual void OnProcessResource(HttpRequest request, HttpResponse response)
 {
     if (string.Compare(request.Method, "GET", true) == 0)
     {
         try
         {
             mResourceCenter.ProcessFile(request, response);
         }
         catch (Exception e_)
         {
             if (EnableLog(LogType.Error))
             {
                 BaseServer.Error(e_, request.Session, "{0} response file error {1}", request.ClientIPAddress, e_.Message);
                 InnerErrorResult result = new InnerErrorResult(e_, ServerConfig.OutputStackTrace);
                 response.Result(result);
             }
         }
     }
     else
     {
         NotSupportResult notSupport = new NotSupportResult("{0} method {1} not support", request.Url, request.Method);
         response.Result(notSupport);
     }
 }