/// <summary> /// Initializes a new instance of the <see cref="HttpOperationSelector"/> class with a /// list of <see cref="HttpOperationSelectionData"/> and <see cref="TrailingSlashMode"/>. /// </summary> /// <param name="baseAddress">BaseAddress used for mapping the requestUri to the entries in operationList</param> /// <param name="operations"> /// The <see cref="HttpOperationSelectionData"/> instances that describe the operations of the service. /// </param> /// <param name="trailingSlashMode"> /// The setting for the /// <see cref="TrailingSlashMode">TrailingSlashMode</see>. /// </param> public UriAndMethodOperationSelector(Uri baseAddress, IEnumerable <HttpOperationDescription> operations, TrailingSlashMode trailingSlashMode) { if (baseAddress == null) { throw Fx.Exception.ArgumentNull("baseAddress"); } if (operations == null) { throw Fx.Exception.ArgumentNull("operations"); } this.baseAddress = baseAddress; if (!this.baseAddress.AbsolutePath.EndsWith("/", StringComparison.Ordinal)) { this.baseAddressDoesNotHaveTrailingSlash = true; this.baseAddressSegmentCount = this.baseAddress.Segments.Length; } this.trailingSlashMode = trailingSlashMode; this.methodSpecificTables = GenerateMethodSpecificTables(operations, this.baseAddress, out this.catchAllOperationName); this.methodSpecificTables.TryGetValue(wildCardHttpMethod, out this.wildcardTable); }
internal static bool IsDefined(TrailingSlashMode trailingSlashMode) { return(trailingSlashMode == TrailingSlashMode.AutoRedirect || trailingSlashMode == TrailingSlashMode.Ignore); }