예제 #1
0
 /// <summary>
 /// Walk through the ApplicationSession objects and compress the ApplicationRequest.RequestBody and ApplicationRequest.ResponseBody
 /// properties setting ApplicationRequest.CompressedRequest and Application.CompressedResponse to those values. Also sets RequestBody and ResponseBody to null
 /// </summary>
 public void compressApplicationSessions()
 {
     if (_sessions != null && _sessions.Count > 0)
     {
         gov.va.medora.utils.Compression compressor = new gov.va.medora.utils.Compression();
         foreach (ApplicationSession session in _sessions.Values)
         {
             if (session.Requests != null && session.Requests.Count > 0)
             {
                 foreach (ApplicationRequest request in session.Requests)
                 {
                     if (!String.IsNullOrEmpty(request.RequestBody))
                     {
                         request.CompressedRequest = compressor.compress(request.RequestBody);
                         request.RequestBody       = "";
                     }
                     if (!String.IsNullOrEmpty(request.ResponseBody))
                     {
                         request.CompressedResponse = compressor.compress(request.ResponseBody);
                         request.ResponseBody       = "";
                     }
                 }
             }
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Walk through the ApplicationSession objects and decompress the ApplicationRequest.CompressedRequest and ApplicationRequest.CompressedResponse
 /// properties setting ApplicationRequest.RequestBody and Application.ResponseBody to those values. Also sets CompressedRequest and CompressedResponse to null
 /// </summary>
 public void decompressApplicationSessions()
 {
     if (_sessions != null && _sessions.Count > 0)
     {
         gov.va.medora.utils.Compression compressor = new gov.va.medora.utils.Compression();
         foreach (ApplicationSession session in _sessions.Values)
         {
             if (session.Requests != null && session.Requests.Count > 0)
             {
                 foreach (ApplicationRequest request in session.Requests)
                 {
                     if (request.CompressedRequest != null && request.CompressedRequest.Length > 0)
                     {
                         request.RequestBody       = compressor.decompress(request.CompressedRequest) as string;
                         request.CompressedRequest = null;
                     }
                     if (request.CompressedResponse != null && request.CompressedResponse.Length > 0)
                     {
                         request.ResponseBody       = compressor.decompress(request.CompressedResponse) as string;
                         request.CompressedResponse = null;
                     }
                 }
             }
         }
     }
 }