コード例 #1
0
		public void AddRequest(TrackedRequest request)
		{
			IAsyncResult a = null;
			a = BeginInvoke((Action)(() =>
			{
				var asyncResult = a;
				if (asyncResult != null)
				{
					EndInvoke(asyncResult);
				}
				var url = request.Url;
				var startsIndex = url.IndexOf("&start=");
				if (startsIndex != -1)
					url = url.Substring(0, startsIndex);
				RequestsLists.Items.Add(new ListViewItem(new[]
				{
					request.Method, 
					request.Status.ToString(), 
					HttpUtility.UrlDecode(HttpUtility.UrlDecode(url))
				})
				{
					Tag = request
				});
			}));
		}
コード例 #2
0
        public void AddRequest(TrackedRequest request)
        {
            IAsyncResult a = null;

            a = BeginInvoke((Action)(() =>
            {
                var asyncResult = a;
                if (asyncResult != null)
                {
                    EndInvoke(asyncResult);
                }
                var url = request.Url;
                var startsIndex = url.IndexOf("&start=");
                if (startsIndex != -1)
                {
                    url = url.Substring(0, startsIndex);
                }
                RequestsLists.Items.Add(new ListViewItem(new[]
                {
                    request.Method,
                    request.Status.ToString(),
                    HttpUtility.UrlDecode(HttpUtility.UrlDecode(url))
                })
                {
                    Tag = request
                });
            }));
        }
コード例 #3
0
ファイル: Shell.cs プロジェクト: j2jensen/ravendb
        private Action AdaptHttpContext(IHttpContext httpContext, ServerLog serverLog)
        {
            if (pathsToFilter.Contains(httpContext.Request.Url.AbsolutePath))
                return null;
            if (ignoreHilo && httpContext.Request.Url.AbsolutePath.StartsWith("/docs/Raven/Hilo/"))
                return null;
            if (httpContext.Request.Headers["Raven-Timer-Request"] != null)
                return null;

            var requestStream = new MemoryStream();
            httpContext.SetRequestFilter(stream =>
            {
                stream.CopyTo(requestStream);
                return new MemoryStream(requestStream.ToArray());
            });
            var responseStream = new MemoryStream();
            httpContext.SetResponseFilter(stream => new MultiStreamWriter(responseStream, stream));

            var trackedRequest = new TrackedRequest
            {
                Method = httpContext.Request.HttpMethod,
                Url = httpContext.Request.RawUrl,
                RequestHeaders = new NameValueCollection(httpContext.Request.Headers),
                RequestContent = requestStream,
                ResponseContent = responseStream,
                ResponseHeaders = httpContext.Response.GetHeaders(),
            };

            return () =>
            {
                trackedRequest.Status = httpContext.Response.StatusCode;
                serverLog.AddRequest(trackedRequest);
            };
        }
コード例 #4
0
		private string GetRequestText(TrackedRequest trackedRequest)
		{
			var requestStringBuilder = new StringBuilder();
			//AppendHeaders(trackedRequest.RequestHeaders, requestStringBuilder);

			requestStringBuilder.AppendLine();
			WriteStreamContentMaybeJson(requestStringBuilder, trackedRequest.RequestContent, trackedRequest.RequestHeaders);

			return requestStringBuilder.ToString();
		}
コード例 #5
0
        private string GetRequestText(TrackedRequest trackedRequest)
        {
            var requestStringBuilder = new StringBuilder();

            //AppendHeaders(trackedRequest.RequestHeaders, requestStringBuilder);

            requestStringBuilder.AppendLine();
            WriteStreamContentMaybeJson(requestStringBuilder, trackedRequest.RequestContent, trackedRequest.RequestHeaders);

            return(requestStringBuilder.ToString());
        }
コード例 #6
0
ファイル: Shell.cs プロジェクト: arelee/ravendb
        private Action AdaptHttpContext(IHttpContext httpContext, ServerLog serverLog)
        {
            if (pathsToFilter.Contains(httpContext.Request.Url.AbsolutePath))
            {
                return(null);
            }
            if (ignoreHilo && httpContext.Request.Url.AbsolutePath.StartsWith("/docs/Raven/Hilo/"))
            {
                return(null);
            }
            if (httpContext.Request.Headers["Raven-Timer-Request"] != null)
            {
                return(null);
            }

            var requestStream = new MemoryStream();

            httpContext.SetRequestFilter(stream =>
            {
                stream.CopyTo(requestStream);
                return(new MemoryStream(requestStream.ToArray()));
            });
            var responseStream = new MemoryStream();

            httpContext.SetResponseFilter(stream => new MultiStreamWriter(responseStream, stream));

            var trackedRequest = new TrackedRequest
            {
                Method          = httpContext.Request.HttpMethod,
                Url             = httpContext.Request.RawUrl,
                RequestHeaders  = new NameValueCollection(httpContext.Request.Headers),
                RequestContent  = requestStream,
                ResponseContent = responseStream,
                ResponseHeaders = httpContext.Response.GetHeaders(),
            };

            return(() =>
            {
                trackedRequest.Status = httpContext.Response.StatusCode;
                serverLog.AddRequest(trackedRequest);
            });
        }