//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
using System.Collections.Generic;
using System.IO;
using System.Net;
using DotNetOpenAuth.Messaging;
///
/// A contract for handling.
///
///
/// Implementations of this interface must be thread safe.
///
public interface IDirectWebRequestHandler {
///
/// Determines whether this instance can support the specified options.
///
/// The set of options that might be given in a subsequent web request.
///
/// true if this instance can support the specified options; otherwise, false.
///
bool CanSupport(DirectWebRequestOptions options);
///
/// Prepares an that contains an POST entity for sending the entity.
///
/// The that should contain the entity.
///
/// The stream the caller should write out the entity data to.
///
/// Thrown for any network error.
///
/// The caller should have set the
/// 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 and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch.
///
Stream GetRequestStream(HttpWebRequest request);
///
/// Prepares an that contains an POST entity for sending the entity.
///
/// The that should contain the entity.
/// The options to apply to this web request.
///
/// The stream the caller should write out the entity data to.
///
/// Thrown for any network error.
///
/// The caller should have set the
/// 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 and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch.
///
Stream GetRequestStream(HttpWebRequest request, DirectWebRequestOptions options);
///
/// Processes an and converts the
/// to a instance.
///
/// The to handle.
/// An instance of describing the response.
/// Thrown for any network error.
///
/// Implementations should catch and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch. The
/// value, if set, should be Closed before throwing.
///
IncomingWebResponse GetResponse(HttpWebRequest request);
///
/// Processes an and converts the
/// to a instance.
///
/// The to handle.
/// The options to apply to this web request.
/// An instance of describing the response.
/// Thrown for any network error.
///
/// Implementations should catch and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch. The
/// value, if set, should be Closed before throwing.
///
IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options);
}
<<<<<<< HEAD
=======
///
/// Code contract for the type.
///
[ContractClassFor(typeof(IDirectWebRequestHandler))]
internal abstract class IDirectWebRequestHandlerContract : IDirectWebRequestHandler {
#region IDirectWebRequestHandler Members
///
/// Determines whether this instance can support the specified options.
///
/// The set of options that might be given in a subsequent web request.
///
/// true if this instance can support the specified options; otherwise, false.
///
bool IDirectWebRequestHandler.CanSupport(DirectWebRequestOptions options) {
throw new System.NotImplementedException();
}
///
/// Prepares an that contains an POST entity for sending the entity.
///
/// The that should contain the entity.
///
/// The stream the caller should write out the entity data to.
///
/// Thrown for any network error.
///
/// The caller should have set the
/// 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 and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch.
///
Stream IDirectWebRequestHandler.GetRequestStream(HttpWebRequest request) {
Contract.Requires(request != null);
throw new System.NotImplementedException();
}
///
/// Prepares an that contains an POST entity for sending the entity.
///
/// The that should contain the entity.
/// The options to apply to this web request.
///
/// The stream the caller should write out the entity data to.
///
/// Thrown for any network error.
///
/// The caller should have set the
/// 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 and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch.
///
Stream IDirectWebRequestHandler.GetRequestStream(HttpWebRequest request, DirectWebRequestOptions options) {
Contract.Requires(request != null);
Contract.Requires(((IDirectWebRequestHandler)this).CanSupport(options), MessagingStrings.DirectWebRequestOptionsNotSupported);
////ErrorUtilities.VerifySupported(((IDirectWebRequestHandler)this).CanSupport(options), string.Format(MessagingStrings.DirectWebRequestOptionsNotSupported, options, this.GetType().Name));
throw new System.NotImplementedException();
}
///
/// Processes an and converts the
/// to a instance.
///
/// The to handle.
///
/// An instance of describing the response.
///
/// Thrown for any network error.
///
/// Implementations should catch and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch. The
/// value, if set, should be Closed before throwing.
///
IncomingWebResponse IDirectWebRequestHandler.GetResponse(HttpWebRequest request) {
Contract.Requires(request != null);
Contract.Ensures(Contract.Result() != null);
Contract.Ensures(Contract.Result().ResponseStream != null);
throw new System.NotImplementedException();
}
///
/// Processes an and converts the
/// to a instance.
///
/// The to handle.
/// The options to apply to this web request.
///
/// An instance of describing the response.
///
/// Thrown for any network error.
///
/// Implementations should catch and wrap it in a
/// to abstract away the transport and provide
/// a single exception type for hosts to catch. The
/// value, if set, should be Closed before throwing.
///
IncomingWebResponse IDirectWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) {
Contract.Requires(request != null);
Contract.Requires(((IDirectWebRequestHandler)this).CanSupport(options), MessagingStrings.DirectWebRequestOptionsNotSupported);
Contract.Ensures(Contract.Result() != null);
Contract.Ensures(Contract.Result().ResponseStream != null);
////ErrorUtilities.VerifySupported(((IDirectWebRequestHandler)this).CanSupport(options), string.Format(MessagingStrings.DirectWebRequestOptionsNotSupported, options, this.GetType().Name));
throw new System.NotImplementedException();
}
#endregion
}
>>>>>>> 884bcec... Fixed typo in comments.
}