Class ConfigurableMessageHandler
A message handler which contains the main logic of our HTTP requests. It contains a list of
IHttp
Inheritance
Implements
Inherited Members
Namespace: Google.Apis.Http
Assembly: Google.Apis.Core.dll
Syntax
public class ConfigurableMessageHandler : DelegatingHandler, IDisposable
Constructors
ConfigurableMessageHandler(HttpMessageHandler)
Constructs a new configurable message handler.
Declaration
public ConfigurableMessageHandler(HttpMessageHandler httpMessageHandler)
Parameters
Type | Name | Description |
---|---|---|
System. |
httpMessageHandler |
Fields
CredentialKey
Key for a credential in a System.
Declaration
public const string CredentialKey = "__CredentialKey"
Field Value
Type | Description |
---|---|
System. |
ExceptionHandlerKey
Key for exception handlers in an System.
Declaration
public const string ExceptionHandlerKey = "__ExceptionHandlerKey"
Field Value
Type | Description |
---|---|
System. |
ExecuteInterceptorKey
Key for execute handlers in an System.
Declaration
public const string ExecuteInterceptorKey = "__ExecuteInterceptorKey"
Field Value
Type | Description |
---|---|
System. |
MaxAllowedNumTries
Maximum allowed number of tries.
Declaration
public const int MaxAllowedNumTries = 20
Field Value
Type | Description |
---|---|
System. |
MaxRetriesKey
Key for request specific max retries.
Declaration
public const string MaxRetriesKey = "__MaxRetriesKey"
Field Value
Type | Description |
---|---|
System. |
ResponseStreamInterceptorProviderKey
Key for a stream response interceptor provider in an System.
Declaration
public const string ResponseStreamInterceptorProviderKey = "__ResponseStreamInterceptorProviderKey"
Field Value
Type | Description |
---|---|
System. |
UnsuccessfulResponseHandlerKey
Key for unsuccessful response handlers in an System.
Declaration
public const string UnsuccessfulResponseHandlerKey = "__UnsuccessfulResponseHandlerKey"
Field Value
Type | Description |
---|---|
System. |
Properties
ApplicationName
Gets or sets the application name which will be used on the User-Agent header.
Declaration
public string ApplicationName { get; set; }
Property Value
Type | Description |
---|---|
System. |
Credential
The credential to apply to all requests made with this client,
unless theres a specific call credential set.
If Credential implements IHttp
Declaration
public IHttpExecuteInterceptor Credential { get; set; }
Property Value
Type | Description |
---|---|
IHttp |
ExceptionHandlers
Gets a list of IHttp
Declaration
[Obsolete("Use AddExceptionHandler or RemoveExceptionHandler instead.")]
public IList<IHttpExceptionHandler> ExceptionHandlers { get; }
Property Value
Type | Description |
---|---|
System. |
ExecuteInterceptors
Gets a list of IHttp
Declaration
[Obsolete("Use AddExecuteInterceptor or RemoveExecuteInterceptor instead.")]
public IList<IHttpExecuteInterceptor> ExecuteInterceptors { get; }
Property Value
Type | Description |
---|---|
System. |
FollowRedirect
Gets or sets whether the handler should follow a redirect when a redirect response is received. Default
value is true
.
Declaration
public bool FollowRedirect { get; set; }
Property Value
Type | Description |
---|---|
System. |
GoogleApiClientHeader
Gets or sets the value set for the x-goog-api-client header.
Declaration
public string GoogleApiClientHeader { get; set; }
Property Value
Type | Description |
---|---|
System. |
IsLoggingEnabled
Gets or sets whether logging is enabled. Default value is true
.
Declaration
public bool IsLoggingEnabled { get; set; }
Property Value
Type | Description |
---|---|
System. |
LogEvents
The request/response types to log.
Declaration
public ConfigurableMessageHandler.LogEventType LogEvents { get; set; }
Property Value
Type | Description |
---|---|
Configurable |
NumRedirects
Gets or sets the number of redirects that will be allowed to execute. The default value is 10
.
See Num
Declaration
public int NumRedirects { get; set; }
Property Value
Type | Description |
---|---|
System. |
NumTries
Gets or sets the number of tries that will be allowed to execute. Retries occur as a result of either
IHttp1
for not retrying requests. The default value is 3
.
Declaration
public int NumTries { get; set; }
Property Value
Type | Description |
---|---|
System. |
UnsuccessfulResponseHandlers
Gets a list of IHttp
Declaration
[Obsolete("Use AddUnsuccessfulResponseHandler or RemoveUnsuccessfulResponseHandler instead.")]
public IList<IHttpUnsuccessfulResponseHandler> UnsuccessfulResponseHandlers { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
AddExceptionHandler(IHttpExceptionHandler)
Adds the specified handler to the list of exception handlers.
Declaration
public void AddExceptionHandler(IHttpExceptionHandler handler)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
handler |
AddExecuteInterceptor(IHttpExecuteInterceptor)
Adds the specified interceptor to the list of execute interceptors.
Declaration
public void AddExecuteInterceptor(IHttpExecuteInterceptor interceptor)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
interceptor |
AddUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler)
Adds the specified handler to the list of unsuccessful response handlers.
Declaration
public void AddUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler handler)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
handler |
RemoveExceptionHandler(IHttpExceptionHandler)
Removes the specified handler from the list of exception handlers.
Declaration
public void RemoveExceptionHandler(IHttpExceptionHandler handler)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
handler |
RemoveExecuteInterceptor(IHttpExecuteInterceptor)
Removes the specified interceptor from the list of execute interceptors.
Declaration
public void RemoveExecuteInterceptor(IHttpExecuteInterceptor interceptor)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
interceptor |
RemoveUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler)
Removes the specified handler from the list of unsuccessful response handlers.
Declaration
public void RemoveUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler handler)
Parameters
Type | Name | Description |
---|---|---|
IHttp |
handler |
SendAsync(HttpRequestMessage, CancellationToken)
The main logic of sending a request to the server. This send method adds the User-Agent header to a request
with Application
Declaration
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System. |
request | |
System. |
cancellationToken |
Returns
Type | Description |
---|---|
System. |