2010-06-23 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 23 Jun 2010 08:03:17 +0000 (08:03 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 23 Jun 2010 08:03:17 +0000 (08:03 -0000)
* ServiceMetadataExtension.cs : Reduced not a few lines of code,
  now that we know wsdl and help do not have to be differentiated,
  this extension support can be a lot simpler.

* HttpListenerManager.cs :
  No need to get messed around MetadataPublishingInfo anymore.

svn path=/trunk/mcs/; revision=159411

mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpListenerManager.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs

index 1dd2a166d3eb2338339d582729d13521ab4ae0a8..76e8e575705b6fc6224b3e86604a4146c134fbad 100755 (executable)
@@ -1,3 +1,8 @@
+2010-06-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * HttpListenerManager.cs :
+         No need to get messed around MetadataPublishingInfo anymore.
+
 2010-06-23  Atsushi Enomoto  <atsushi@ximian.com>
 
        * HttpListenerManager.cs : remove extra different code paths for
index 2b7db968f1900a19554b1d9dfc4b4a847acfc702..5d43f69dac327581e9264d112a6068c2a3b363cb 100644 (file)
@@ -254,12 +254,9 @@ namespace System.ServiceModel.Channels
        {
                static Dictionary<Uri, List<IChannelListener>> registered_channels;
                IChannelListener channel_listener;
-               MetadataPublishingInfo mex_info;
-               HttpGetWsdl wsdl_instance;
                ManualResetEvent wait_http_ctx = new ManualResetEvent (false);
                List<HttpContextInfo> pending = new List<HttpContextInfo> ();
 
-               public MetadataPublishingInfo MexInfo { get { return mex_info; } }
                public HttpTransportBindingElement Source { get; private set; }
                public ChannelDispatcher Dispatcher { get; private set; }
 
@@ -275,8 +272,6 @@ namespace System.ServiceModel.Channels
                {
                        this.Dispatcher = dispatcher;
                        this.channel_listener = channelListener;
-                       mex_info = Dispatcher != null ? Dispatcher.Listener.GetProperty<MetadataPublishingInfo> () : null;
-                       wsdl_instance = mex_info != null ? mex_info.Instance : null;
                        Source = source;
 
                        if (securityTokenManager != null) {
@@ -291,19 +286,6 @@ namespace System.ServiceModel.Channels
                                registered_channels [channel_listener.Uri] = new List<IChannelListener> ();
                        OnRegister (channel_listener, timeout);
                        registered_channels [channel_listener.Uri].Add (channel_listener);
-
-                       // make sure to fill wsdl_instance among other 
-                       // listeners. It is somewhat hacky way, but 
-                       // otherwise there is no assured way to do it.
-                       var wsdl = wsdl_instance;
-                       if (wsdl == null)
-                               foreach (var l in registered_channels [channel_listener.Uri])
-                                       if ((wsdl = l.GetProperty<HttpListenerManager> ().wsdl_instance) != null)
-                                               break;
-                       if (wsdl != null) {
-                               foreach (var l in registered_channels [channel_listener.Uri])
-                                       l.GetProperty<HttpListenerManager> ().wsdl_instance = wsdl;
-                       }
                }
 
                public void Stop (bool abort)
index bfaa0ef3a02eeef37c7bdee30476789c30cc2214..4a0c3f73659943ff4285775c9664731e06d5ead9 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-23  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ServiceMetadataExtension.cs : Reduced not a few lines of code,
+         now that we know wsdl and help do not have to be differentiated,
+         this extension support can be a lot simpler.
+
 2010-06-23  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ServiceMetadataExtension.cs : add Instance field for simplification.
index 400aded1c81086e1ae10c5b05d41a5bb7791f7f4..0dc07aff8dcfcd04dd13c221f865e97f0553ecb1 100644 (file)
@@ -104,14 +104,8 @@ namespace System.ServiceModel.Description
 
                        if (dispatchers == null)
                                dispatchers = new Dictionary<Uri, ChannelDispatcher> ();
-                       else if (dispatchers.ContainsKey (uri)) {
-                               var info = dispatchers [uri].Listener.GetProperty<MetadataPublishingInfo> ();
-                               if (isMex)
-                                       info.SupportsMex = true;
-                               else
-                                       info.SupportsHelp = true;
-                               return;
-                       }
+                       else if (dispatchers.ContainsKey (uri))
+                               return; // already exists (e.g. reached here for wsdl while help is already filled on the same URI.)
 
                        if (binding == null) {
                                switch (scheme) {
@@ -140,12 +134,6 @@ namespace System.ServiceModel.Description
 
                        var channelDispatcher = new DispatcherBuilder (Owner).BuildChannelDispatcher (owner.Description.ServiceType, se, new BindingParameterCollection ());
                        channelDispatcher.MessageVersion = MessageVersion.None; // it has no MessageVersion.
-                       // add HttpGetWsdl to indicate that the ChannelDispatcher is for mex or help.
-                       var listener = channelDispatcher.Listener as ChannelListenerBase;
-                       if (listener != null)
-                               listener.Properties.Add (new MetadataPublishingInfo () { SupportsMex = isMex, SupportsHelp = !isMex, Instance = instance });
-                       else
-                               throw new InvalidOperationException ("FIXME: attempt to use ServiceMetadataExtension to not-supported channel listener: " + listener.GetType ());
                        channelDispatcher.IsMex = true;
                        channelDispatcher.Endpoints [0].DispatchRuntime.InstanceContextProvider = new SingletonInstanceContextProvider (new InstanceContext (owner, instance));
 
@@ -172,18 +160,6 @@ namespace System.ServiceModel.Description
                SMMessage Get (SMMessage req);
        }
 
-       // It is used to identify which page to serve when a channel dispatcher 
-       // has a listener to an relatively empty URI (conflicting with the 
-       // target service endpoint)
-       //
-       // Can't be enum as it is for GetProperty<T> ().
-       internal class MetadataPublishingInfo
-       {
-               public bool SupportsMex { get; set; }
-               public bool SupportsHelp { get; set; }
-               public HttpGetWsdl Instance { get; set; }
-       }
-
        class HttpGetWsdl : IHttpGetHelpPageAndMetadataContract
        {
                ServiceMetadataExtension ext;