C# Class DotNetOpenAuth.ApplicationBlock.Util.WrappingWebRequestHandler

Wraps some instance of a web request handler in order to perform some extra operation on all outgoing HTTP requests.
Inheritance: IDirectWebRequestHandler
显示文件 Open project: 23/23-api-dotnet

Public Methods

Method Description
CanSupport ( DirectWebRequestOptions options ) : bool

Determines whether this instance can support the specified options.

GetRequestStream ( HttpWebRequest request ) : Stream

Prepares an HttpWebRequest that contains an POST entity for sending the entity.

The caller should have set the HttpWebRequest.ContentLength and any other appropriate properties before calling this method. Callers must close and dispose of the request stream when they are done writing to it to avoid taking up the connection too long and causing long waits on subsequent requests.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch.

GetRequestStream ( HttpWebRequest request, DirectWebRequestOptions options ) : Stream

Prepares an HttpWebRequest that contains an POST entity for sending the entity.

The caller should have set the HttpWebRequest.ContentLength and any other appropriate properties before calling this method. Callers must close and dispose of the request stream when they are done writing to it to avoid taking up the connection too long and causing long waits on subsequent requests.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch.

GetResponse ( HttpWebRequest request ) : DotNetOpenAuth.Messaging.IncomingWebResponse

Processes an HttpWebRequest and converts the HttpWebResponse to a IncomingWebResponse instance.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch. The WebException.Response value, if set, should be Closed before throwing.

GetResponse ( HttpWebRequest request, DirectWebRequestOptions options ) : DotNetOpenAuth.Messaging.IncomingWebResponse

Processes an HttpWebRequest and converts the HttpWebResponse to a IncomingWebResponse instance.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch. The WebException.Response value, if set, should be Closed before throwing.

Private Methods

Method Description
WrappingWebRequestHandler ( IDirectWebRequestHandler wrappedHandler, Action action ) : System

Initializes a new instance of the WrappingWebRequestHandler class.

Method Details

CanSupport() public method

Determines whether this instance can support the specified options.
public CanSupport ( DirectWebRequestOptions options ) : bool
options DirectWebRequestOptions The set of options that might be given in a subsequent web request.
return bool

GetRequestStream() public method

Prepares an HttpWebRequest that contains an POST entity for sending the entity.

The caller should have set the HttpWebRequest.ContentLength and any other appropriate properties before calling this method. Callers must close and dispose of the request stream when they are done writing to it to avoid taking up the connection too long and causing long waits on subsequent requests.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch.

Thrown for any network error.
public GetRequestStream ( HttpWebRequest request ) : Stream
request System.Net.HttpWebRequest The that should contain the entity.
return Stream

GetRequestStream() public method

Prepares an HttpWebRequest that contains an POST entity for sending the entity.

The caller should have set the HttpWebRequest.ContentLength and any other appropriate properties before calling this method. Callers must close and dispose of the request stream when they are done writing to it to avoid taking up the connection too long and causing long waits on subsequent requests.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch.

Thrown for any network error.
public GetRequestStream ( HttpWebRequest request, DirectWebRequestOptions options ) : Stream
request System.Net.HttpWebRequest The that should contain the entity.
options DirectWebRequestOptions The options to apply to this web request.
return Stream

GetResponse() public method

Processes an HttpWebRequest and converts the HttpWebResponse to a IncomingWebResponse instance.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch. The WebException.Response value, if set, should be Closed before throwing.

Thrown for any network error.
public GetResponse ( HttpWebRequest request ) : DotNetOpenAuth.Messaging.IncomingWebResponse
request System.Net.HttpWebRequest The to handle.
return DotNetOpenAuth.Messaging.IncomingWebResponse

GetResponse() public method

Processes an HttpWebRequest and converts the HttpWebResponse to a IncomingWebResponse instance.

Implementations should catch WebException and wrap it in a ProtocolException to abstract away the transport and provide a single exception type for hosts to catch. The WebException.Response value, if set, should be Closed before throwing.

Thrown for any network error.
public GetResponse ( HttpWebRequest request, DirectWebRequestOptions options ) : DotNetOpenAuth.Messaging.IncomingWebResponse
request System.Net.HttpWebRequest The to handle.
options DirectWebRequestOptions The options to apply to this web request.
return DotNetOpenAuth.Messaging.IncomingWebResponse