C# Class WebApiThrottle.ThrottlingFilter

Throttle action filter
Inheritance: System.Web.Http.Filters.ActionFilterAttribute, IActionFilter
Afficher le fichier Open project: stefanprodan/WebApiThrottle

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
ComputeThrottleKey ( RequestIdentity requestIdentity, RateLimitPeriod period ) : string
GetClientIp ( HttpRequestMessage request ) : IPAddress
QuotaExceededResponse ( HttpRequestMessage request, object content, HttpStatusCode responseCode, string retryAfter ) : HttpResponseMessage
SetIdentity ( HttpRequestMessage request ) : RequestIdentity

Private Methods

Méthode Description
ApplyThrottling ( System.Web.Http.Controllers.HttpActionContext filterContext, WebApiThrottle.EnableThrottlingAttribute &attr ) : bool

Method Details

ComputeThrottleKey() protected méthode

protected ComputeThrottleKey ( RequestIdentity requestIdentity, RateLimitPeriod period ) : string
requestIdentity RequestIdentity
period RateLimitPeriod
Résultat string

GetClientIp() protected méthode

protected GetClientIp ( HttpRequestMessage request ) : IPAddress
request System.Net.Http.HttpRequestMessage
Résultat System.Net.IPAddress

OnActionExecuting() public méthode

public OnActionExecuting ( System.Web.Http.Controllers.HttpActionContext actionContext ) : void
actionContext System.Web.Http.Controllers.HttpActionContext
Résultat void

QuotaExceededResponse() protected méthode

protected QuotaExceededResponse ( HttpRequestMessage request, object content, HttpStatusCode responseCode, string retryAfter ) : HttpResponseMessage
request System.Net.Http.HttpRequestMessage
content object
responseCode HttpStatusCode
retryAfter string
Résultat System.Net.Http.HttpResponseMessage

SetIdentity() protected méthode

protected SetIdentity ( HttpRequestMessage request ) : RequestIdentity
request System.Net.Http.HttpRequestMessage
Résultat RequestIdentity

ThrottlingFilter() public méthode

Initializes a new instance of the ThrottlingFilter class. By default, the QuotaExceededResponseCode property is set to 429 (Too Many Requests).
public ThrottlingFilter ( ) : System
Résultat System

ThrottlingFilter() public méthode

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 ///
Résultat System