C# Class WebApiThrottle.ThrottlingHandler

Inheritance: System.Net.Http.DelegatingHandler
Afficher le fichier Open project: stefanprodan/WebApiThrottle

Méthodes publiques

Méthode Description
ThrottlingHandler ( ) : System

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

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

Initializes a new instance of the ThrottlingHandler 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 ) : Task
SendAsync ( HttpRequestMessage request, CancellationToken cancellationToken ) : Task
SetIdentity ( HttpRequestMessage request ) : RequestIdentity

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

QuotaExceededResponse() protected méthode

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

SendAsync() protected méthode

protected SendAsync ( HttpRequestMessage request, CancellationToken cancellationToken ) : Task
request System.Net.Http.HttpRequestMessage
cancellationToken System.Threading.CancellationToken
Résultat Task

SetIdentity() protected méthode

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

ThrottlingHandler() public méthode

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

ThrottlingHandler() public méthode

Initializes a new instance of the ThrottlingHandler class. Persists the policy object in cache using IPolicyRepository implementation. The policy object can be updated by ThrottleManager at runtime.
public ThrottlingHandler ( 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 IpAddressParser ///
Résultat System