C# Класс WebApiThrottle.ThrottlingFilter

Throttle action filter
Наследование: System.Web.Http.Filters.ActionFilterAttribute, IActionFilter
Показать файл Открыть проект

Открытые методы

Метод Описание
OnActionExecuting ( System.Web.Http.Controllers.HttpActionContext actionContext ) : void
ThrottlingFilter ( ) : System

Initializes a new instance of the ThrottlingFilter class. By default, the QuotaExceededResponseCode property is set to 429 (Too Many Requests).

ThrottlingFilter ( WebApiThrottle.ThrottlePolicy policy, IPolicyRepository policyRepository, IThrottleRepository repository, IThrottleLogger logger, IIpAddressParser ipAddressParser = null ) : System

Initializes a new instance of the ThrottlingFilter class. Persists the policy object in cache using IPolicyRepository implementation. The policy object can be updated by ThrottleManager at runtime.

Защищенные методы

Метод Описание
ComputeThrottleKey ( RequestIdentity requestIdentity, RateLimitPeriod period ) : string
GetClientIp ( HttpRequestMessage request ) : IPAddress
QuotaExceededResponse ( HttpRequestMessage request, object content, HttpStatusCode responseCode, string retryAfter ) : HttpResponseMessage
SetIdentity ( HttpRequestMessage request ) : RequestIdentity

Приватные методы

Метод Описание
ApplyThrottling ( System.Web.Http.Controllers.HttpActionContext filterContext, WebApiThrottle.EnableThrottlingAttribute &attr ) : bool

Описание методов

ComputeThrottleKey() защищенный Метод

protected ComputeThrottleKey ( RequestIdentity requestIdentity, RateLimitPeriod period ) : string
requestIdentity RequestIdentity
period RateLimitPeriod
Результат string

GetClientIp() защищенный Метод

protected GetClientIp ( HttpRequestMessage request ) : IPAddress
request System.Net.Http.HttpRequestMessage
Результат System.Net.IPAddress

OnActionExecuting() публичный Метод

public OnActionExecuting ( System.Web.Http.Controllers.HttpActionContext actionContext ) : void
actionContext System.Web.Http.Controllers.HttpActionContext
Результат void

QuotaExceededResponse() защищенный Метод

protected QuotaExceededResponse ( HttpRequestMessage request, object content, HttpStatusCode responseCode, string retryAfter ) : HttpResponseMessage
request System.Net.Http.HttpRequestMessage
content object
responseCode HttpStatusCode
retryAfter string
Результат System.Net.Http.HttpResponseMessage

SetIdentity() защищенный Метод

protected SetIdentity ( HttpRequestMessage request ) : RequestIdentity
request System.Net.Http.HttpRequestMessage
Результат RequestIdentity

ThrottlingFilter() публичный Метод

Initializes a new instance of the ThrottlingFilter class. By default, the QuotaExceededResponseCode property is set to 429 (Too Many Requests).
public ThrottlingFilter ( ) : System
Результат System

ThrottlingFilter() публичный Метод

Initializes a new instance of the ThrottlingFilter class. Persists the policy object in cache using IPolicyRepository implementation. The policy object can be updated by ThrottleManager at runtime.
public ThrottlingFilter ( WebApiThrottle.ThrottlePolicy policy, IPolicyRepository policyRepository, IThrottleRepository repository, IThrottleLogger logger, IIpAddressParser ipAddressParser = null ) : System
policy WebApiThrottle.ThrottlePolicy /// The policy. ///
policyRepository IPolicyRepository /// The policy repository. ///
repository IThrottleRepository /// The repository. ///
logger IThrottleLogger /// The logger. ///
ipAddressParser IIpAddressParser /// The ip address provider ///
Результат System