コード例 #1
0
        /// <summary>
        /// 创建上下文环境
        /// </summary>
        /// <param name="client"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public override HttpContext <T> GetContext <T>(HttpClient client, HttpRequestMessage request)
        {
            var ctx = new HttpContext <T>(client, request);

            //附加监听器
            if (client.Monitor != null)
            {
                ctx.AttachMonitor(client.Monitor);
            }

            return(ctx);
        }
コード例 #2
0
		/// <summary>
		/// 创建上下文环境
		/// </summary>
		/// <param name="client"></param>
		/// <param name="request"></param>
		/// <returns></returns>
		public virtual HttpContext<T> GetContext<T>(HttpClient client, HttpRequestMessage request) where T : class
		{
			var ctx = new HttpContext<T>(client, request);

			//附加监听器
			if (client.Monitor != null)
				ctx.AttachMonitor(client.Monitor);

			var e = new HttpHandlerEventArgs(null, ctx);

			OnHttpContextCreated(e);

			return e.HttpContext as HttpContext<T>;
		}
コード例 #3
0
        /// <summary>
        /// 创建上下文环境
        /// </summary>
        /// <param name="client"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public override HttpContext GetContext(HttpClient client, HttpRequestMessage request)
        {
            //证书
            client.Setting.CertificateManager?.SetRequest(request);

            var ctx = new HttpContext(client, request);

            //附加监听器
            if (client.Monitor != null)
            {
                ctx.AttachMonitor(client.Monitor);
            }

            return(ctx);
        }
コード例 #4
0
		/// <summary>
		/// 创建上下文环境
		/// </summary>
		/// <param name="client"></param>
		/// <param name="request"></param>
		/// <returns></returns>
		public virtual HttpContext GetContext(HttpClient client, HttpRequestMessage request)
		{
			//证书
			client.Setting.CertificateManager?.SetRequest(request);

			var ctx = new HttpContext(client, request);
			
			//附加监听器
			if (client.Monitor != null)
				ctx.AttachMonitor(client.Monitor);

			var e = new HttpHandlerEventArgs(null, ctx);

			OnHttpContextCreated(e);

			return e.HttpContext;
		}