コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WebConnection"/> class.
        /// </summary>
        /// <param name="tunnel">The tunnel this connection is associated with.</param>
        /// <param name="context">The context.</param>
        public WebConnection(WebTunnel tunnel, HttpContext context)
            : base(tunnel.Id)
        {
            _tunnel      = tunnel;
            _context     = context;
            _interceptor = new WebConnectionResponseInterceptor(context.Response);

            _cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(context.RequestAborted);
        }
コード例 #2
0
        /// <summary>
        /// 追加一个响应拦截器。
        /// </summary>
        /// <param name="interceptor"></param>
        /// <returns></returns>
        public virtual BasicHttpClientBuilder AddResponseInterceptor(HttpResponseInterceptor interceptor)
        {
            if (interceptor == null)
            {
                throw new ArgumentNullException(nameof(interceptor));
            }

            ResponseInterceptors.Add(interceptor);
            return(this);
        }
コード例 #3
0
 public virtual Org.Apache.Http.Protocol.HttpProcessorBuilder AddLast(HttpResponseInterceptor
                                                                      e)
 {
     if (e == null)
     {
         return(this);
     }
     GetResponseChainBuilder().AddLast(e);
     return(this);
 }
コード例 #4
0
 /// <summary>Adds this protocol interceptor to the tail of the protocol processing list.
 ///     </summary>
 /// <remarks>
 /// Adds this protocol interceptor to the tail of the protocol processing list.
 /// <p/>
 /// Please note this value can be overridden by the
 /// <see cref="SetHttpProcessor(Apache.Http.Protocol.HttpProcessor)">SetHttpProcessor(Apache.Http.Protocol.HttpProcessor)
 ///     </see>
 /// method.
 /// </remarks>
 public Apache.Http.Impl.Client.HttpClientBuilder AddInterceptorLast(HttpResponseInterceptor
                                                                     itcp)
 {
     if (itcp == null)
     {
         return(this);
     }
     if (responseLast == null)
     {
         responseLast = new List <HttpResponseInterceptor>();
     }
     responseLast.AddLast(itcp);
     return(this);
 }
コード例 #5
0
 IHttpClientBuilder IHttpClientBuilder.AddResponseInterceptor(HttpResponseInterceptor interceptor)
 {
     return(this.AddResponseInterceptor(interceptor));
 }
コード例 #6
0
 /// <summary>
 /// 追加一个响应拦截器。
 /// </summary>
 /// <param name="interceptor"></param>
 /// <returns></returns>
 public new WxpayApiClientBuilder AddResponseInterceptor(HttpResponseInterceptor interceptor)
 {
     base.AddResponseInterceptor(interceptor);
     return(this);
 }
コード例 #7
0
 public virtual Org.Apache.Http.Protocol.HttpProcessorBuilder Add(HttpResponseInterceptor
                                                                  e)
 {
     return(AddLast(e));
 }