| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Collections.ObjectModel; |
| | | 6 | | using CoreWCF.Channels; |
| | | 7 | | using CoreWCF.Collections.Generic; |
| | | 8 | | using CoreWCF.Description; |
| | | 9 | | |
| | | 10 | | namespace CoreWCF.Configuration |
| | | 11 | | { |
| | | 12 | | public class WebHttpServiceBehavior : IServiceBehavior |
| | | 13 | | { |
| | | 14 | | private readonly IServiceProvider _serviceProvider; |
| | | 15 | | |
| | 36 | 16 | | public WebHttpServiceBehavior(IServiceProvider serviceProvider) |
| | | 17 | | { |
| | 36 | 18 | | _serviceProvider = serviceProvider; |
| | 36 | 19 | | } |
| | | 20 | | |
| | | 21 | | public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collect |
| | | 22 | | { |
| | 37 | 23 | | } |
| | | 24 | | |
| | | 25 | | public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) |
| | | 26 | | { |
| | 36 | 27 | | } |
| | | 28 | | |
| | | 29 | | public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) |
| | | 30 | | { |
| | 146 | 31 | | foreach (ServiceEndpoint endpoint in serviceDescription.Endpoints) |
| | | 32 | | { |
| | 37 | 33 | | WebMessageEncodingBindingElement webEncodingBindingElement = endpoint.Binding.CreateBindingElements().Fi |
| | 37 | 34 | | if (webEncodingBindingElement != null) |
| | | 35 | | { |
| | 37 | 36 | | var behaviors = (KeyedByTypeCollection<IEndpointBehavior>)endpoint.EndpointBehaviors; |
| | 37 | 37 | | behaviors.Add(new WebHttpBehavior(_serviceProvider)); |
| | | 38 | | } |
| | | 39 | | } |
| | 36 | 40 | | } |
| | | 41 | | } |
| | | 42 | | } |