//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
using System;
using System.Diagnostics;
using System.Diagnostics.Contracts;
///
/// An immutable description of a URL that receives messages.
///
[DebuggerDisplay("{AllowedMethods} {Location}")]
[Serializable]
public class MessageReceivingEndpoint {
///
/// Initializes a new instance of the class.
///
/// The URL of this endpoint.
/// The HTTP method(s) allowed.
public MessageReceivingEndpoint(string locationUri, HttpDeliveryMethods method)
: this(new Uri(locationUri), method) {
Contract.Requires(locationUri != null);
Contract.Requires(method != HttpDeliveryMethods.None);
Contract.Requires((method & HttpDeliveryMethods.HttpVerbMask) != 0, MessagingStrings.GetOrPostFlagsRequired);
}
///
/// Initializes a new instance of the class.
///
/// The URL of this endpoint.
/// The HTTP method(s) allowed.
public MessageReceivingEndpoint(Uri location, HttpDeliveryMethods method) {
Contract.Requires(location != null);
Contract.Requires(method != HttpDeliveryMethods.None);
Contract.Requires((method & HttpDeliveryMethods.HttpVerbMask) != 0, MessagingStrings.GetOrPostFlagsRequired);
this.Location = location;
this.AllowedMethods = method;
}
///
/// Gets the URL of this endpoint.
///
public Uri Location { get; private set; }
///
/// Gets the HTTP method(s) allowed.
///
public HttpDeliveryMethods AllowedMethods { get; private set; }
}
}