Example #1
0
 public LookupDispatcher(string host, int port, string protocol, int numberOfClients, IRequestFormatter requestFormatter)
 {
     _protocol               = protocol;
     _semaphoreSlim          = new SemaphoreSlim(0, numberOfClients);
     _socketClients          = new List <SocketClient>(GetSocketClients(host, port, numberOfClients));
     _socketClientsAvailable = new Queue <SocketClient>();
     _requestFormatter       = requestFormatter;
 }
 public HandlebarsMediaTypeFormatter(HttpConfiguration config,
                                     IHandlebarsTemplate template,
                                     IRequestFormatter formatter)
     : base()
 {            
     this._template = template;
     this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
     this._formatter = formatter;
                 
     config.Formatters.Insert(0, this);
     _config = config;
     _server = new HttpServer(config);
     _client = new HttpMessageInvoker(_server);
 }
Example #3
0
        public HandlebarsMediaTypeFormatter(HttpConfiguration config,
                                            IHandlebarsTemplate template,
                                            IRequestFormatter formatter)
            : base()
        {
            this._template = template;
            this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
            this._formatter = formatter;

            config.Formatters.Insert(0, this);
            _config = config;
            _server = new HttpServer(config);
            _client = new HttpMessageInvoker(_server);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpRequestParameters" /> class.
        /// </summary>
        /// <param name="verb">The verb.</param>
        /// <param name="template">The template.</param>
        /// <param name="requestFormatter">The request formatter.</param>
        /// <param name="responseFormatter">The response formatter.</param>
        /// <param name="cutomMessageProcessingHandler">The cutom message processing handler.</param>
        internal HttpRequestParameters(string verb, UriTemplate template, IRequestFormatter requestFormatter, IResponseFormatter responseFormatter, IEnumerable <IHttpMessageProcessingHandler> cutomMessageProcessingHandler)
        {
            Contract.Requires <ArgumentNullException>(verb != null);
            Contract.Requires <ArgumentNullException>(template != null);
            Contract.Requires <ArgumentNullException>(requestFormatter != null);
            Contract.Requires <ArgumentNullException>(responseFormatter != null);

            this.HttpMethod        = verb;
            this.UriTemplate       = template;
            this.RequestFormatter  = requestFormatter;
            this.ResponseFormatter = responseFormatter;
            this.CutomMessageProcessingHandlers = new ReadOnlyCollection <IHttpMessageProcessingHandler>((
                                                                                                             cutomMessageProcessingHandler ?? Enumerable.Empty <IHttpMessageProcessingHandler>()).ToList());
        }
Example #5
0
        public HandlebarsMediaTypeFormatter(HttpConfiguration config,
                                            IHandlebarsTemplate template,
                                            IRequestFormatter formatter,
                                            HttpServer server,
                                            HttpMessageInvoker client,
                                            string view,
                                            HttpRequestMessage request)
        {
            this._formatter = formatter;
            this._template  = template;
            this._request   = request;
            this._server    = server;
            this._config    = config;
            this._client    = client;
            this._view      = view;

            this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        }
        public HandlebarsMediaTypeFormatter(HttpConfiguration config,
                                            IHandlebarsTemplate template,
                                            IRequestFormatter formatter,
                                            HttpServer server, 
                                            HttpMessageInvoker client, 
                                            string view,
                                            HttpRequestMessage request)
        {

            this._formatter = formatter;
            this._template = template;
            this._request = request;
            this._server = server;
            this._config = config;
            this._client = client;
            this._view = view;

            this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));            
        }
 public HandlebarsMediaTypeFormatter(HttpRouteCollection routes,
                                     IHandlebarsTemplate template,
                                     IRequestFormatter formatter) : this(new HttpConfiguration(routes), template, formatter)
 {
 }
 public HotChocolateDiagnosticsListener(IRequestFormatter formatter)
 {
     _formatter = formatter ?? throw new ArgumentNullException(nameof(formatter));
 }
Example #9
0
 public static string ToString(this IRestRequest request, IRequestFormatter formatter)
 {
     return(formatter.Format(request));
 }
Example #10
0
 public HandlebarsMediaTypeFormatter(HttpRouteCollection routes,
                                     IHandlebarsTemplate template,
                                     IRequestFormatter formatter) : this(new HttpConfiguration(routes), template, formatter)
 {
 }
Example #11
0
 public HandlebarsJsonFormatter(IRequestFormatter formatter, string view, HttpRequestMessage request) : this(formatter)
 {
     this._view    = view;
     this._request = request;
 }
Example #12
0
 public HandlebarsJsonFormatter(IRequestFormatter formatter) : base()
 {
     this._formatter = formatter;
     this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json"));
     this.MediaTypeMappings.Add(new QueryStringMapping("x-format", "json", new MediaTypeHeaderValue("application/json")));
 }
        public DefaultMethodInvoker(IRequestFormatter formatter)
        {
            if (formatter == null) throw new ArgumentNullException("formatter");

            Formatter = formatter;
        }
 public HandlebarsJsonFormatter(IRequestFormatter formatter, string view, HttpRequestMessage request) : this(formatter)
 {
     this._view = view;
     this._request = request;
 }
 public HandlebarsJsonFormatter(IRequestFormatter formatter) : base()
 {
     this._formatter = formatter;
     this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json"));
     this.MediaTypeMappings.Add(new QueryStringMapping("x-format", "json", new MediaTypeHeaderValue("application/json")));
 }