public LinkGenerator(IPersister persister, ConnectionMonitor connection, CacheWrapper cacheWrapper, IRequestLogger logger) { _logger = logger; // DON'T USE DISTRIBUTED CACHE FOR N2 internal data // _urlCache = cacheService.GetCache<string>(new CacheConfig("LinkGenerator_urlCache", 1800)); _urlCache = new HttpRuntimeCacheWrapper<string>("LinkGenerator_urlCache", cacheWrapper); _itemCache = new HttpRuntimeCacheWrapper<object>("LinkGenerator_urlCache_item", cacheWrapper); // hook up to persister events connection.Online += delegate { persister.ItemSaved += persister_ItemSaved; persister.ItemMoving += persister_ItemMoving; persister.ItemMoved += persister_ItemMoved; persister.ItemCopied += persister_ItemCopied; persister.ItemDeleted += persister_ItemDeleted; persister.FlushCache += persister_ItemInvalidated; }; connection.Offline += delegate { persister.ItemSaved -= persister_ItemSaved; persister.ItemMoving -= persister_ItemMoving; persister.ItemMoved -= persister_ItemMoved; persister.ItemCopied -= persister_ItemCopied; persister.ItemDeleted -= persister_ItemDeleted; persister.FlushCache -= persister_ItemInvalidated; }; }
public async Task InvokeAsync(HttpContext context, IRequestLogger logger) { context.Request.EnableBuffering(); if (context.Request != null) { string path = context.Request.Path; var method = context.Request.Method; var queryString = context.Request.QueryString.ToString(); string bodyString; using (var reader = new StreamReader(context.Request.Body, Encoding.UTF8, true, 1024, true)) { bodyString = await reader.ReadToEndAsync(); } context.Request.Body.Seek(0, SeekOrigin.Begin); logger.Log(method, path, queryString, bodyString); } if (_next != null) { await _next(context); } }
public Client(IRequestLogger loger, chz.WindowsServices.Setting.ISettingProvider setting) { encoding = Encoding.UTF8; httpClient = new HttpClient(); this.loger = loger; this.setting = setting; }
public CandyRackPartController(IRequestLogger logger, IOffersViewModelBuilder offersViewModelBuilder, ICartApi cartApi, ILinkGenerator linkGenerator) : base(logger, null, null) { _offersViewModelBuilder = offersViewModelBuilder; _cartApi = cartApi; _linkGenerator = linkGenerator; }
public LinkGenerator(IPersister persister, ConnectionMonitor connection, CacheWrapper cacheWrapper, IRequestLogger logger) { _logger = logger; // DON'T USE DISTRIBUTED CACHE FOR N2 internal data // _urlCache = cacheService.GetCache<string>(new CacheConfig("LinkGenerator_urlCache", 1800)); _urlCache = new HttpRuntimeCacheWrapper <string>("LinkGenerator_urlCache", cacheWrapper); _itemCache = new HttpRuntimeCacheWrapper <object>("LinkGenerator_urlCache_item", cacheWrapper); // hook up to persister events connection.Online += delegate { persister.ItemSaved += persister_ItemSaved; persister.ItemMoving += persister_ItemMoving; persister.ItemMoved += persister_ItemMoved; persister.ItemCopied += persister_ItemCopied; persister.ItemDeleted += persister_ItemDeleted; persister.FlushCache += persister_ItemInvalidated; }; connection.Offline += delegate { persister.ItemSaved -= persister_ItemSaved; persister.ItemMoving -= persister_ItemMoving; persister.ItemMoved -= persister_ItemMoved; persister.ItemCopied -= persister_ItemCopied; persister.ItemDeleted -= persister_ItemDeleted; persister.FlushCache -= persister_ItemInvalidated; }; }
public HomeController(IOptions <SetlistConfig> config, ILogger <HomeController> log, ISetlistBuilder setlistBuilder, ISpotifyService spotifyService, IRequestLogger requestLogger) { _config = config; _log = log; _setlistBuilder = setlistBuilder; _spotifyService = spotifyService; _requestLogger = requestLogger; }
public SpotifyService(IHttpContextAccessor httpContextAccessor, IRequestLogger requestLogger) { _httpContextAccessor = httpContextAccessor; _requestLogger = requestLogger; _client = new HttpClient(); _client.BaseAddress = new Uri("https://api.spotify.com/v1"); }
public ShoppingCartController(ICartApi cartApi, IRequestLogger logger, ILinkGenerator linkGenerator, IPageInfo pageInfo, IOffersViewModelBuilder offersViewModelBuilder, IShoppingCartViewModelBuilder shoppingCartViewModelBuilder, ICatalogApi catalogApi) : base(logger, linkGenerator, catalogApi) { CartApi = cartApi; ShoppingCartViewModelBuilder = shoppingCartViewModelBuilder; PageInfo = pageInfo; OffersViewModelBuilder = offersViewModelBuilder; }
public RequestHandler( IRedirectHandler redirectHandler, IRequestLogger requestLogger, IConfiguration configuration) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _requestLogger = requestLogger ?? throw new ArgumentNullException(nameof(requestLogger)); _redirectHandler = redirectHandler ?? throw new ArgumentNullException(nameof(redirectHandler)); }
public ShoppingCartPartController(IRequestLogger logger, ICartApi cartApi, IShoppingCartViewModelBuilder shoppingCartViewModelBuilder, IOffersViewModelBuilder offersViewModelBuilder, ILinkGenerator linkGenerator) : base(logger) { _shoppingCartViewModelBuilder = shoppingCartViewModelBuilder; _cartApi = cartApi; _offersViewModelBuilder = offersViewModelBuilder; _linkGenerator = linkGenerator; }
public CatalogController(IRequestLogger logger, ICategoryViewModelBuilder catViewModelBuilder, ILinkGenerator linkGenerator, IPageInfo pageInfo, ICatalogApi catalogApi) : base(logger, linkGenerator, catalogApi) { _pageInfo = pageInfo; _linkGenerator = linkGenerator; _catViewModelBuilder = catViewModelBuilder; }
/// <summary> /// </summary> /// <param name="baseUrl"></param> /// <param name="requestHandler"></param> /// <param name="requestLogger"></param> protected AbstractRestClient(string baseUrl, IRequestHandler requestHandler, IRequestLogger requestLogger) { RequestLogger = requestLogger; RequestHandler = requestHandler; BaseUrl = baseUrl; RequestHeaders = new Dictionary<string, string>(); ConnectionTimeout = 2000; //Default 2s, deliberately short. ReadWriteTimeout = 8000; // Default 8s, reasonably short if accidentally called from the UI thread }
/// <summary> /// </summary> /// <param name="baseUrl"></param> /// <param name="requestHandler"></param> /// <param name="requestLogger"></param> protected AbstractRestClient(string baseUrl, IRequestHandler requestHandler, IRequestLogger requestLogger) { RequestLogger = requestLogger; RequestHandler = requestHandler; BaseUrl = baseUrl; RequestHeaders = new Dictionary <string, string>(); ConnectionTimeout = 2000; //Default 2s, deliberately short. ReadWriteTimeout = 8000; // Default 8s, reasonably short if accidentally called from the UI thread }
public LogCommandHandlerDecorator(IRequestLogger requestLogger, ICommandHandler <TCommand> decoratedRequestHandler, IOptionsSnapshot <LogSettings> logSettingsOption, ILogger <TCommand> logger) { this.requestLogger = requestLogger; this.decoratedRequestHandler = decoratedRequestHandler; this.logger = logger; this.logSettings = logSettingsOption.Value; }
public StactiveMiddleware( RequestDelegate next, IRequestLogger requestLogger, ILogger <StactiveMiddleware> logger) { _next = next; _logger = logger; _requestLogger = requestLogger; }
public LogQueryHandlerDecorator(IRequestLogger requestLogger, IQueryHandler <TQuery, TResponse> decoratedRequestHandler, IOptionsSnapshot <LogSettings> logSettingsOption, ILogger <TQuery> logger) { this.requestLogger = requestLogger; this.decoratedRequestHandler = decoratedRequestHandler; this.logger = logger; this.logSettings = logSettingsOption.Value; }
public LogCommandHandlerDecorator(IRequestLogger requestLogger, ICommandHandler <TCommand> decoratedRequestHandler, LogSettings logSettings, ILogger <TCommand> logger) { this.requestLogger = requestLogger; this.decoratedRequestHandler = decoratedRequestHandler; this.logger = logger; this.logSettings = logSettings; }
public LogQueryHandlerDecorator(IRequestLogger requestLogger, IQueryHandler <TQuery, TResponse> decoratedRequestHandler, LogSettings logSettings, ILogger <TQuery> logger) { this.requestLogger = requestLogger; this.decoratedRequestHandler = decoratedRequestHandler; this.logger = logger; this.logSettings = logSettings; }
private static Action <NancyContext> GetLogRequestHook(IRequestLogger requestLogger) { return(ctx => { var requestData = ExtractRequestData(ctx.Request); var responseData = ExtractResponseData(ctx.Response); requestLogger.Log(requestData, responseData); }); }
public RequestLogViewModel(IRequestLogger requestLogger) { Requires.NotNull(requestLogger, "requestLogger"); _requestLogger = requestLogger; _lazyUpdateCommand = new Lazy<ICommand>(() => new RelayCommand(OnUpdate)); _logEntriesSource = new ObservableCollection<RequestLogEntry>(); _logEntries = new ListCollectionView(_logEntriesSource); _logEntries.SortDescriptions.Add(new SortDescription("Created", ListSortDirection.Descending)); }
private static Func <NancyContext, Exception, dynamic> GetLogErrorHook(IRequestLogger requestLogger) { return((ctx, ex) => { var requestData = ExtractRequestData(ctx.Request); var responseData = ExtractResponseData(ctx.Response); requestLogger.LogError(requestData, responseData, ex); return ctx.Response; }); }
public ASHttpModule(ISettingManager settingManager, IContextProvider httpContextProvider, ILogger logger, IRequestLogger requestLogger, IGeoProvider geoProvider) { this._settingManager = settingManager; this._geoProvider = geoProvider; this._requestLogger = requestLogger; this._httpContextProvider = httpContextProvider; this._logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="HttpLogger"/> class. /// </summary> /// <param name="logger">Actual logger instance to use as writer.</param> /// <param name="requestLogger">Request detail logger.</param> /// <param name="responseLogger">Response detail logger.</param> /// <param name="basicInfoLogger">Basic information logger.</param> /// <param name="requestPredicates">Request path predicates to determine is the log message required.</param> public HttpLogger( ILogger logger, IRequestLogger requestLogger, IResponseLogger responseLogger, IBasicInfoLogger basicInfoLogger, IEnumerable <IHttpRequestPredicate> requestPredicates) { _logger = logger; _requestLogger = requestLogger; _responseLogger = responseLogger; _basicInfoLogger = basicInfoLogger; _requestPredicates = requestPredicates; }
public RequestHandlerTests() { _redirectHandler = A.Fake <IRedirectHandler>(); _requestLogger = A.Fake <IRequestLogger>(); _configuration = A.Fake <IConfiguration>(); _sut = A.Fake <RequestHandler>( o => o.WithArgumentsForConstructor(new object[] { _redirectHandler, _requestLogger, _configuration }) .CallsBaseMethods()); _httpContext = new FakeHttpContext(); _httpContext.Response.StatusCode = 404; WhenIsRemote(); WhenIsNotResourceFile(); }
public ClientController(IBackendCommunication backendCommunication, ILogger logger, ILinkRepository linkRepository, IRequestLogger requestLogger, IHttpResponseMessageBuilder httpResponseMessageBuilder, IOnPremiseRequestBuilder onPremiseRequestBuilder, IPathSplitter pathSplitter, ITraceManager traceManager) { _backendCommunication = backendCommunication; _logger = logger; _linkRepository = linkRepository; _requestLogger = requestLogger; _httpResponseMessageBuilder = httpResponseMessageBuilder; _onPremiseRequestBuilder = onPremiseRequestBuilder; _pathSplitter = pathSplitter; _traceManager = traceManager; }
protected void CreateLog(HttpContext context, IRequestLogger requestLogger, string requestBody, string responseBody) { requestLogger.LogRequest( clientAddress: GetClientAddress(context), requestUrl: GetUrl(context), requestMethod: context.Request.Method, requestHeaders: context.Request.Headers, requestBody: requestBody, responseStatus: context.Response.StatusCode.ToString(), responseHeaders: context.Response.Headers, responseBody: responseBody); }
public WebhookResponseHandler( IEventHandlerFactory eventHandlerFactory, IHttpClientFactory httpClientFactory, IRequestBuilder requestBuilder, IAuthenticationHandlerFactory authenticationHandlerFactory, IRequestLogger requestLogger, IBigBrother bigBrother, SubscriberConfiguration subscriberConfiguration) : base(httpClientFactory, authenticationHandlerFactory, requestBuilder, requestLogger, bigBrother, subscriberConfiguration) { _eventHandlerFactory = eventHandlerFactory; _subscriberConfiguration = subscriberConfiguration; }
public RequestLoggerMiddleware(RequestDelegate next, RequestLoggerOptions options = null) { _next = next; _options = options ?? new RequestLoggerOptions(); if (_options.ShouldUseColor && !Console.IsOutputRedirected) { _logger = new ColorfulRequestLogger(_next); } else { _logger = new PlainRequestLogger(_next); } }
public ClientController(IBackendCommunication backendCommunication, ILogger logger, ILinkRepository linkRepository, IRequestLogger requestLogger, IOnPremiseRequestBuilder onPremiseRequestBuilder, IPathSplitter pathSplitter, ITraceManager traceManager, IInterceptorManager interceptorManager, IPostDataTemporaryStore postDataTemporaryStore) { _backendCommunication = backendCommunication ?? throw new ArgumentNullException(nameof(backendCommunication)); _logger = logger; _linkRepository = linkRepository ?? throw new ArgumentNullException(nameof(linkRepository)); _requestLogger = requestLogger ?? throw new ArgumentNullException(nameof(requestLogger)); _onPremiseRequestBuilder = onPremiseRequestBuilder ?? throw new ArgumentNullException(nameof(onPremiseRequestBuilder)); _pathSplitter = pathSplitter ?? throw new ArgumentNullException(nameof(pathSplitter)); _traceManager = traceManager ?? throw new ArgumentNullException(nameof(traceManager)); _interceptorManager = interceptorManager ?? throw new ArgumentNullException(nameof(interceptorManager)); _postDataTemporaryStore = postDataTemporaryStore ?? throw new ArgumentNullException(nameof(postDataTemporaryStore)); }
public GenericWebhookHandler( IHttpClientFactory httpClientFactory, IAuthenticationHandlerFactory authenticationHandlerFactory, IRequestBuilder requestBuilder, IRequestLogger requestLogger, IBigBrother bigBrother, WebhookConfig webhookConfig) { BigBrother = bigBrother; RequestBuilder = requestBuilder; _requestLogger = requestLogger; WebhookConfig = webhookConfig; _authenticationHandlerFactory = authenticationHandlerFactory; HttpClientFactory = httpClientFactory; }
public static void Enable(INancyModule module, IRequestLogger requestLogger) { if (module == null) { throw new ArgumentNullException("module"); } if (requestLogger == null) { throw new ArgumentNullException("requestLogger"); } module.After.AddItemToEndOfPipeline(GetLogRequestHook(requestLogger)); module.OnError.AddItemToEndOfPipeline(GetLogErrorHook(requestLogger)); }
public ContentControllerBase(IRequestLogger logger, ILinkGenerator linkGenerator, ICatalogApi catalogApi) { _catalogApi = catalogApi; Logger = logger; LinkGenerator = linkGenerator; #if SAVE_VIEW_MODEL _saveVmDir = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/SavedViewModels"); if (!Directory.Exists(_saveVmDir)) { Directory.CreateDirectory(_saveVmDir); } #endif }
public static void Enable(IPipelines pipelines, IRequestLogger requestLogger) { if (pipelines == null) { throw new ArgumentNullException("pipelines"); } if (requestLogger == null) { throw new ArgumentNullException("requestLogger"); } pipelines.AfterRequest.AddItemToEndOfPipeline(GetLogRequestHook(requestLogger)); pipelines.OnError.AddItemToEndOfPipeline(GetLogErrorHook(requestLogger)); }
public BaseRequestCacheManager(string name, ICache<string, byte[]> cache, IHttpParser parser, IRequestLogger requestLogger) { Requires.NotNull(name, "name"); Requires.NotNullOrEmpty<ArgumentException>(name); Requires.NotNullOrWhiteSpace<ArgumentException>(name); _name = name; Requires.NotNull(cache, "cache"); _cache = cache; Requires.NotNull(parser, "parser"); _parser = parser; Requires.NotNull(requestLogger, "requestLogger"); _requestLogger = requestLogger; }
public HttpProxyHandlerFactory(IHttpParser parser, IHttpRequestSender requestSender, IHashProvider hashProvider, ICache<string, byte[]> cache, IRequestLogger requestLogger) { Requires.NotNull(parser, "parser"); _parser = parser; Requires.NotNull(requestSender, "requestSender"); _requestSender = requestSender; Requires.NotNull(hashProvider, "hashProvider"); _hashProvider = hashProvider; Requires.NotNull(cache, "cache"); _cache = cache; Requires.NotNull(requestLogger, "requestLogger"); _requestLogger = requestLogger; }
public RecursiveZonePartsAdapterBase(IRequestLogger logger) : this(logger, null) { }
public RecursiveZonePartsAdapterBase(IRequestLogger logger, ICatalogApi catalogApi) { _logger = logger; _catalogApi = catalogApi; }
/// <summary> /// The Constructor with the Logger parameter. /// </summary> /// <param name="log"></param> public EmployeeInfoController(IRequestLogger log) { objDs = new DataAccess(); logger = log; }
public EmployeeInfoController() { objDs = new DataAccess(); logger = new RequestLogger(); }
public ListOfLinksAdapter(ILinkGenerator linkGenerator, ICatalogApi catalogApi, IRequestLogger logger) : base(logger, catalogApi) { _linkGenerator = linkGenerator; }
public static void RemoveRequestLogger(IRequestLogger requestLogger) { RemoveRequestLogger(requestLogger.RequestId); }
/// <summary> /// The Constructor with the Logger parameter. /// </summary> /// <param name="log"></param> public XmlController(IRequestLogger log) { logger = log; }
public static void AddRequestLogger(IRequestLogger requestLogger) { AddRequestLogger(requestLogger.RequestId, requestLogger); }
/// <summary> /// Initializes a new instance of the <see cref="JsonRestServices"/> class with the specified /// logger, retry logic, URI builder, and string serializer. /// </summary> /// <param name="logger">The logger to use for requests. Specify <c>null</c> if requests do not need to be logged.</param> /// <param name="retryLogic">The retry logic to use for REST operations.</param> /// <param name="urlBuilder">The URL builder to use for constructing URLs with query parameters.</param> /// <param name="stringSerializer">The string serializer to use for requests from this service.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="retryLogic"/> is <c>null</c>. /// <para>-or-</para> /// <para>If <paramref name="urlBuilder"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para>If <paramref name="stringSerializer"/> is <c>null</c>.</para> /// </exception> public JsonRestServices(IRequestLogger logger, IRetryLogic<Response, HttpStatusCode> retryLogic, IUrlBuilder urlBuilder, IStringSerializer stringSerializer) : base(stringSerializer, logger, retryLogic, urlBuilder) { }
/// <summary> /// Initializes a new instance of the <see cref="JsonRestServices"/> class with the specified /// request logger and the default JSON string serializer and URL builder. /// </summary> /// <param name="requestLogger">The logger to use for requests. Specify <c>null</c> if requests do not need to be logged.</param> public JsonRestServices(IRequestLogger requestLogger) : this(requestLogger, new RequestRetryLogic(), new UrlBuilder(), new JsonStringSerializer()) { }
/// <summary> /// Constructor /// </summary> /// <param name="logger">The http request logger</param> public BasicRequestHandler(IRequestLogger logger) { Logger = logger; }
public HttpProxyHandler(IPAddress address, int port, IHttpParser parser, IHttpRequestSender requestSender, IHashProvider hashProvider, ICache<string, byte[]> cache, IRequestLogger requestLogger) { Requires.NotNull(parser, "parser"); _parser = parser; Requires.NotNull(requestSender, "requestSender"); _requestSender = requestSender; Requires.NotNull(hashProvider, "hashProvider"); _hashProvider = hashProvider; Requires.NotNull(cache, "cache"); _cache = cache; Requires.NotNull(requestLogger, "requestLogger"); _requestLogger = requestLogger; _listener = new TcpListener(address, port); // _clientQueue = new ActionQueue<TcpClient>(Handle); _tokenSource = new CancellationTokenSource(); _workingTask = new Task(Run, Token, TaskCreationOptions.LongRunning); _waitHandle = new AutoResetEvent(false); _enableCache = true; }
public IsolatedStorageCacheManager(IsolatedStorageCache<string, byte[]> cache, IHttpParser parser, IRequestLogger requestLogger) : base("Isolated Storage Cache", cache, parser, requestLogger) { }
public static void AddRequestLogger(Guid requestId, IRequestLogger requestLogger) { _requestLoggers.TryAdd(requestId, requestLogger); }
public MemoryRequestCacheManager(MemoryCache<string, byte[]> cache, IHttpParser parser, IRequestLogger requestLogger) : base("Memory Cache", cache, parser, requestLogger) { }
public XmlController() { logger = new RequestLogger(); }