using System;
using System.Net;
namespace WebDAVSharp.Server.Adapters
{
///
/// This
/// implementation wraps around a
/// instance.
///
public sealed class HttpListenerContextAdapter : IHttpListenerContext
{
#region Public Functions
///
/// Initializes a new instance of the class.
///
/// The to adapt for WebDAV#.
/// context
/// is null.
public HttpListenerContextAdapter(HttpListenerContext context)
{
if (context == null)
throw new ArgumentNullException(nameof(context));
AdaptedInstance = context;
_request = new HttpListenerRequestAdapter(context.Request);
_response = new HttpListenerResponseAdapter(context.Response);
}
#endregion
#region Private Variables
private readonly HttpListenerRequestAdapter _request;
private readonly HttpListenerResponseAdapter _response;
#endregion
#region Properties
///
/// Gets the internal instance that was adapted for WebDAV#.
///
///
/// The adapted instance.
///
public HttpListenerContext AdaptedInstance { get; }
///
/// Gets the request adapter.
///
public IHttpListenerRequest Request => _request;
///
/// Gets the response adapter.
///
public IHttpListenerResponse Response => _response;
#endregion
}
}