Example #1
0
 public DefaultGrpcClientFactory(IServiceProvider serviceProvider,
                                 GrpcCallInvokerFactory callInvokerFactory,
                                 IOptionsMonitor <GrpcClientFactoryOptions> clientFactoryOptionsMonitor,
                                 IHttpMessageHandlerFactory messageHandlerFactory)
 {
     _serviceProvider             = serviceProvider;
     _callInvokerFactory          = callInvokerFactory;
     _clientFactoryOptionsMonitor = clientFactoryOptionsMonitor;
     _messageHandlerFactory       = messageHandlerFactory;
 }
        protected GetARideServiceBaseGateway(IHttpMessageHandlerFactory httpMessageHandlerFactory, GatewayConfiguration gatewayConfiguration)
        {
            var httpMessageHandler = httpMessageHandlerFactory.CreateHttpMessageHandler();

            HttpClient = new HttpClient(httpMessageHandler);
            AuthenticationUrl = gatewayConfiguration.AuthenticationUrl;
            ApiUrl = gatewayConfiguration.ApiUrl;
            ClientId = gatewayConfiguration.ClientID;
            ClientSecret = gatewayConfiguration.ClientSecret;
        }
Example #3
0
        public HelloService(IHttpMessageHandlerFactory factory, ILogger <HelloService> logger, IOptionsMonitor <HelloServiceOptions> options)
        {
            _logger = logger;
            _client = new Hello_PortTypeClient();
            _client.Endpoint.EndpointBehaviors.Add(new HttpMessageHandlerBehavior(factory, ServiceName));
            _client.Endpoint.Address = new EndpointAddress(options.CurrentValue.EndpointAddress);

            _client.Endpoint.Binding.CloseTimeout   = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds);
            _client.Endpoint.Binding.OpenTimeout    = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds);
            _client.Endpoint.Binding.ReceiveTimeout = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds);
            _client.Endpoint.Binding.SendTimeout    = TimeSpan.FromSeconds(options.CurrentValue.TimeoutSeconds);
        }
        //Temp fix: Remove after 01-01-2016; IHttpMessageHandlerFactory is registered in the DI.
        //The DI needs to be upgraded for the registeration. below code prevent a runtime error in case that the DI is not upgraded.
        public BaseProvider(IProvidersCommonServices commonServices)
        {
            if (commonServices == null)
            {
                throw new ArgumentNullException("commonServices");
            }

            Logger = commonServices.Logger;
            _httpMessageHandlerFactory = new DefaultHttpMessageHandlerFactory();
            _publicationResolver       = commonServices.PublicationResolver;
            Configuration = commonServices.Configuration;
        }
Example #5
0
        private RaftHttpCluster(IOptionsMonitor <RaftClusterMemberConfiguration> config, IServiceProvider dependencies, out MutableMemberCollection members)
            : this(config.CurrentValue, out members)
        {
            configurator       = dependencies.GetService <IRaftClusterConfigurator>();
            messageHandler     = dependencies.GetService <IMessageHandler>();
            AuditTrail         = dependencies.GetService <IPersistentState>();
            hostingAddresses   = dependencies.GetRequiredService <IServer>().GetHostingAddresses;
            httpHandlerFactory = dependencies.GetService <IHttpMessageHandlerFactory>();
            var loggerFactory = dependencies.GetRequiredService <ILoggerFactory>();

            Logger = loggerFactory.CreateLogger(GetType());
            //track changes in configuration
            configurationTracker = config.OnChange(ConfigurationChanged);
        }
Example #6
0
        public GrpcCallInvokerFactory(
            IServiceScopeFactory scopeFactory,
            ILoggerFactory loggerFactory,
            IOptionsMonitor <GrpcClientFactoryOptions> grpcClientFactoryOptionsMonitor,
            IOptionsMonitor <HttpClientFactoryOptions> httpClientFactoryOptionsMonitor,
            IHttpMessageHandlerFactory messageHandlerFactory)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _loggerFactory = loggerFactory;
            _grpcClientFactoryOptionsMonitor = grpcClientFactoryOptionsMonitor;
            _httpClientFactoryOptionsMonitor = httpClientFactoryOptionsMonitor;
            _messageHandlerFactory           = messageHandlerFactory;

            _scopeFactory   = scopeFactory;
            _activeChannels = new ConcurrentDictionary <EntryKey, CallInvoker>();
            _invokerFactory = CreateInvoker;
        }
Example #7
0
 internal AuthenticationHttpClient(IHttpMessageHandlerFactory httpMessageHandlerFactory, string name)
     : this(new AuthenticationHttpMessageHandler(httpMessageHandlerFactory.CreateHandler(name)))
 {
 }
Example #8
0
 internal OAuthAuthenticated(IHttpMessageHandlerFactory httpMessageHandlerFactory, string oauthToken, HashSet <TwitchConstants.TwitchOAuthScopes> scopes)
     : this(new HttpClient(httpMessageHandlerFactory.CreateHandler()), oauthToken, scopes)
 {
 }
Example #9
0
 public AuthenticationHttpClient(IHttpMessageHandlerFactory httpMessageHandlerFactory)
     : this(new AuthenticationHttpMessageHandler(httpMessageHandlerFactory.CreateHandler()))
 {
 }
        public TridionBinaryProvider(IProvidersCommonServices commonServices, IHttpMessageHandlerFactory httpClientFactory)
            :base(commonServices, httpClientFactory)
        {

        }
Example #11
0
 IAuthenticationBuilder IAuthenticationBuilder.UseHttpMessageHandlerFactory(IHttpMessageHandlerFactory messageHandlerFactory) => UseHttpMessageHandlerFactory(messageHandlerFactory);
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultRemoteTargetActionsFactory"/> class.
 /// </summary>
 /// <param name="context">The WebDAV request context</param>
 /// <param name="httpMessageHandlerFactory">The factory for <see cref="HttpClient"/> instances</param>
 public DefaultRemoteTargetActionsFactory(IWebDavContext context, IHttpMessageHandlerFactory httpMessageHandlerFactory)
 {
     _context = context;
     _httpMessageHandlerFactory = httpMessageHandlerFactory;
 }
 public OrderService(IHttpMessageHandlerFactory messageHandlerFactory)
     : base(messageHandlerFactory)
 {
 }
 public CustomEndpointBehavior(IHttpMessageHandlerFactory factory)
 {
     factory.CreateHandler();
     _httpHandler = () => factory.CreateHandler();
 }
Example #15
0
 public EventsService(IHttpMessageHandlerFactory messageHandlerFactory) : base(messageHandlerFactory)
 {
 }
Example #16
0
 public CreditCheckFilter(IHttpMessageHandlerFactory httpMessageHandlerFactory, ILogger logger)
 {
     this.httpMessageHandlerFactory = httpMessageHandlerFactory;
     this.logger = logger;
 }
        public TridionComponentPresentationProvider(IProvidersCommonServices commonServices, IHttpMessageHandlerFactory httpClientFactory)
            : base(commonServices, httpClientFactory)
        {

        }
Example #18
0
 public MegaRetryFilter(IHttpMessageHandlerFactory messageHandlerFactory = null, int retriesCount = 5)
     : base(messageHandlerFactory, retriesCount)
 {
 }
 /// <summary>
 /// Creates a new <see cref="HttpMessageHandler"/> using the default configuration.
 /// </summary>
 /// <param name="factory">The <see cref="IHttpMessageHandlerFactory"/>.</param>
 /// <returns>An <see cref="HttpMessageHandler"/> configured using the default configuration.</returns>
 public static HttpMessageHandler CreateHandler(this IHttpMessageHandlerFactory factory !!)
 {
     return(factory.CreateHandler(Options.DefaultName));
 public DefaultHttpClientFactory(IHttpMessageHandlerFactory httpMessageHandlerFactory)
 {
     _httpMessageHandlerFactory = Check.NotNull(httpMessageHandlerFactory, nameof(httpMessageHandlerFactory));
 }
Example #21
0
 public GeolocatorMapquest(IHttpMessageHandlerFactory httpMessageHandlerFactory, ConfigurationProviderMapquest configuration)
     : base(httpMessageHandlerFactory)
 {
     _gatewayConfiguration = configuration.GetGatewayConfiguration();
 }
 public GetARideServiceLyftGateway(IHttpMessageHandlerFactory httpMessageHandlerFactory, GatewayConfiguration gatewayConfiguration)
     : base(httpMessageHandlerFactory, gatewayConfiguration)
 {
 }
Example #23
0
        protected GeolocatorBase(IHttpMessageHandlerFactory httpMessageHandlerFactory)
        {
            var httpMessageHander = httpMessageHandlerFactory.CreateHttpMessageHandler();

            _httpClient = new HttpClient(httpMessageHander);
        }
        /// <summary>
        /// Creates a new <see cref="HttpMessageHandler"/> using the default configuration.
        /// </summary>
        /// <param name="factory">The <see cref="IHttpMessageHandlerFactory"/>.</param>
        /// <returns>An <see cref="HttpMessageHandler"/> configured using the default configuration.</returns>
        public static HttpMessageHandler CreateHandler(this IHttpMessageHandlerFactory factory)
        {
            ThrowHelper.ThrowIfNull(factory);

            return(factory.CreateHandler(Options.DefaultName));
        }
 public StaticHttpClientFactory(IHttpMessageHandlerFactory handlerFactory)
 {
     _handlerFactory = handlerFactory;
 }
Example #26
0
        protected RideSharingBase(IHttpMessageHandlerFactory httpMessageHandlerFactory)
        {
            var httpMessageHandler = httpMessageHandlerFactory.CreateHttpMessageHandler();

            _httpClient = new HttpClient(httpMessageHandler);
        }
Example #27
0
 public TridionBinaryProvider(IProvidersCommonServices commonServices, IHttpMessageHandlerFactory httpClientFactory)
     : base(commonServices, httpClientFactory)
 {
 }
 public WcfClientFactory(IHttpMessageHandlerFactory httpMessageHandlerFactory)
 {
     _httpMessageHandlerFactory = httpMessageHandlerFactory ?? throw new ArgumentNullException(nameof(httpMessageHandlerFactory));
 }
Example #29
0
 public ServiceBase(IHttpMessageHandlerFactory messageHandlerFactory)
 {
     MessageHandlerFactory = messageHandlerFactory;
     CurrentHttpClient     = new HttpClient(MessageHandlerFactory.GetHttpMessageHandler());
     CurrentHttpClient.DefaultRequestHeaders.Add("x-functions-key", apiKey);
 }
Example #30
0
 public ProductService(IHttpMessageHandlerFactory messageHandlerFactory)
     : base(messageHandlerFactory)
 {
 }
Example #31
0
 public IBotAuthenticationBuilder UseHttpMessageHandlerFactory(IHttpMessageHandlerFactory messageHandlerFactory)
 {
     HttpMessageHandlerFactory = messageHandlerFactory;
     return(this);
 }
Example #32
0
 public RideSharingLyft(IHttpMessageHandlerFactory httpMessageHandlerFactory, ConfigurationProviderLyft configurationProvider, LyftToGetARyderTransformer lyftToGetARyderTransformer)
     : base(httpMessageHandlerFactory)
 {
     this._lyftGatewayConfiguration   = configurationProvider.GetGatewayConfiguration();
     this._lyftToGetARydertransformer = lyftToGetARyderTransformer;
 }