public MethodOverrideHandler(HttpConfiguration httpConfiguration) { //request 顺序: 客户端发起请求 -> HttpServer -> DelegatingHandler -> HttpRoutingDispatcher // -> HttpControllerDispatcher -> Controller InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public AuthenticationHandler(AuthenticationConfiguration configuration, HttpConfiguration httpConfiguration = null) { _authN = new HttpAuthentication(configuration); if (httpConfiguration != null) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); } }
public AuthenticationHandler(AuthenticationConfiguration configuration, HttpConfiguration httpConfiguration = null) { log.Info("Creando AuthenticationHandler..."); _authN = new HttpAuthentication(configuration); if (httpConfiguration != null) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); } }
public RateLimiterHandler(HttpConfiguration httpConfiguration, RateLimiter rateLimiter) : base() { if (rateLimiter == null) { throw new ArgumentNullException("RateLimiter"); } InnerHandler = new HttpControllerDispatcher(httpConfiguration); m_rateLimiter = rateLimiter; }
private HttpServer GetTestCitiesServer(HttpConfiguration config) { HttpControllerDispatcher dispatcher = new HttpControllerDispatcher(config); HttpRoute route = new HttpRoute("{controller}/{action}", new HttpRouteValueDictionary("Cities")); config.Routes.Add("cities", route); HttpServer server = new HttpServer(config, dispatcher); return(server); }
public JsonForIEDelegateHandler(HttpConfiguration config, string contentTypeNewValue = "text/html; charset=utf-8") { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(contentTypeNewValue)) { throw new ArgumentNullException("contentTypeNewValue"); } _contentTypeNewValue = contentTypeNewValue; InnerHandler = new HttpControllerDispatcher(config); }
public void MapODataServiceRoute_MapsHandlerWhenAHandlerIsProvided() { // Arrange HttpRouteCollection routes = new HttpRouteCollection(); HttpConfiguration config = new HttpConfiguration(routes); IEdmModel model = new EdmModel(); HttpMessageHandler handler = new HttpControllerDispatcher(new HttpConfiguration()); // Act ODataRoute route = config.MapODataServiceRoute("odata", "odata", model, handler); // Assert Assert.NotNull(route); Assert.Same(handler, route.Handler); }
private HttpResponseMessage ExecuteSelfHostRequest(string url, string controller, object data, string mediaType) { HttpConfiguration config = new HttpConfiguration(); IHttpRoute routeData; if (!config.Routes.TryGetValue(controller, out routeData)) { HttpRoute route = new HttpRoute("{controller}/{action}", new HttpRouteValueDictionary(controller)); config.Routes.Add(controller, route); } HttpControllerDispatcher dispatcher = new HttpControllerDispatcher(config); HttpServer server = new HttpServer(config, dispatcher); HttpMessageInvoker invoker = new HttpMessageInvoker(server); string serializedChangeSet = String.Empty; if (mediaType == "application/json") { JsonSerializer serializer = new JsonSerializer() { PreserveReferencesHandling = PreserveReferencesHandling.Objects, TypeNameHandling = TypeNameHandling.All }; MemoryStream ms = new MemoryStream(); JsonWriter writer = new JsonTextWriter(new StreamWriter(ms)); serializer.Serialize(writer, data); writer.Flush(); ms.Seek(0, 0); serializedChangeSet = Encoding.UTF8.GetString(ms.GetBuffer()).TrimEnd('\0'); } else { DataContractSerializer ser = new DataContractSerializer(data.GetType(), GetTestKnownTypes()); MemoryStream ms = new MemoryStream(); ser.WriteObject(ms, data); ms.Flush(); ms.Seek(0, 0); serializedChangeSet = Encoding.UTF8.GetString(ms.GetBuffer()).TrimEnd('\0'); } HttpRequestMessage request = TestHelpers.CreateTestMessage(url, HttpMethod.Post, config); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(mediaType)); request.Content = new StringContent(serializedChangeSet, Encoding.UTF8, mediaType); return(invoker.SendAsync(request, CancellationToken.None).Result); }
/// <summary> /// Initializes a new instance of the <see cref="AccessTokenHandler"/> class. /// </summary> /// <param name="httpConfiguration">The HTTP configuration.</param> public AccessTokenHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public HttpServer(HttpControllerDispatcher dispatcher) : this(new HttpConfiguration(), dispatcher) { }
public CustomHandlerWithoutController(HttpConfiguration httpConfiguration) { // создать внутренний обработчик, т.к. выше он создается с помощью base.SendAsync, которого здесь нет InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public ResponseWrappingHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public jqGridODataHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public KDelegatingHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public DataLoader(HttpConfiguration httpConfiguration, UserService userService, ToDoService toDoService) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); this.userService = userService; this.toDoService = toDoService; }
public GZipToJsonHandler(HttpConfiguration config) { InnerHandler = new HttpControllerDispatcher(config); }
public NormalizeHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
protected BasicAuthenticationMessageHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public ClaimsTransformationHandler(ClaimsAuthenticationManager transformer, HttpConfiguration configuration) { _transfomer = transformer; InnerHandler = new HttpControllerDispatcher(configuration); }
/// <summary> /// 构造函数 /// </summary> /// <param name="httpConfiguration">webapi配置</param> public AppKeyValidate(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public CustomEventHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public PerRouteHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public AuthenticationHandler(HttpConfiguration httpConfiguration) { InnerHandler = new HttpControllerDispatcher(httpConfiguration); }
public GZipToJsonHandler(HttpConfiguration config) { //Here we are retaining the standard handler pipeline, so that this can run after the custom handler has run InnerHandler = new HttpControllerDispatcher(config); }