* HttpChannel.cs, HttpClientChannel.cs: Added missing IDictionary
authorLluis Sanchez <lluis@novell.com>
Thu, 13 May 2004 08:55:28 +0000 (08:55 -0000)
committerLluis Sanchez <lluis@novell.com>
Thu, 13 May 2004 08:55:28 +0000 (08:55 -0000)
properties.
* HttpRemotingHandler.cs: Added missing constructor.
* HttpRemotingHandlerFactory.cs: Made ConfigureHttpChannel private.
* HttpServerChannel.cs: Fixed IDictionary properties.

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

mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandler.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandlerFactory.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs

index 45a24240e2d2792f50553f5a0abe6a185e27bf6a..d292b26185a7b4457b08ddba97407bdae6945785 100644 (file)
@@ -1,3 +1,11 @@
+2004-05-13  Lluis Sanchez Gual <lluis@ximian.com>
+
+       * HttpChannel.cs, HttpClientChannel.cs: Added missing IDictionary 
+       properties.
+       * HttpRemotingHandler.cs: Added missing constructor.
+       * HttpRemotingHandlerFactory.cs: Made ConfigureHttpChannel private.
+       * HttpServerChannel.cs: Fixed IDictionary properties.
+
 2004-04-30  Lluis Sanchez Gual <lluis@ximian.com>
 
        * HttpServer.cs: Removed dead code.
index 277033461eedcdc23495943f775809ba21edab00..4ae2d710199b5999e317967e7a1bf3bee1f8d4d7 100644 (file)
@@ -18,16 +18,16 @@ using System;
 using System.Collections;
 using System.Runtime.Remoting.Messaging;
 
-
 namespace System.Runtime.Remoting.Channels.Http  
 {
-
-       public class HttpChannel: IChannelReceiver, IChannelSender, IChannel, IChannelReceiverHook
+       public class HttpChannel: BaseChannelWithProperties, IChannelReceiver, 
+               IChannelSender, IChannel, IChannelReceiverHook
        {
                private HttpServerChannel serverChannel;
                private HttpClientChannel clientChannel;
                private string channelName = "http";
                private int channelPriority = 1;
+               private AggregateDictionary properties;
 
                public HttpChannel()
                {
@@ -41,9 +41,9 @@ namespace System.Runtime.Remoting.Channels.Http
                        SetupChannel(prop,null,null);
                }
 
-               public HttpChannel (IDictionary Properties,IClientChannelSinkProvider clientSinkProvider,IServerChannelSinkProvider serverSinkProvider)
+               public HttpChannel (IDictionary properties,IClientChannelSinkProvider clientSinkProvider,IServerChannelSinkProvider serverSinkProvider)
                {
-                       SetupChannel (Properties,clientSinkProvider,serverSinkProvider);
+                       SetupChannel (properties,clientSinkProvider,serverSinkProvider);
                }
 
                private void SetupChannel (IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
@@ -56,6 +56,8 @@ namespace System.Runtime.Remoting.Channels.Http
                        
                        val = properties ["priority"];
                        if (val != null) channelPriority = Convert.ToInt32 (val);
+                       
+                       this.properties = new AggregateDictionary (new IDictionary[] {clientChannel, serverChannel});
                }
 
 
@@ -122,5 +124,21 @@ namespace System.Runtime.Remoting.Channels.Http
                {
                        serverChannel.AddHookChannelUri (channelUri);
                } 
+               
+               public override object this [object key]
+               {
+                       get { return properties[key]; }
+                       set { properties[key] = value; }
+               }
+               
+               public override ICollection Keys 
+               {
+                       get { return properties.Keys; }
+               }
+               
+               public override IDictionary Properties 
+               {
+                       get { return properties; }
+               }
        }
 }
index 9c58283cd4b75782ba77619862d47b274ecdcf87..6200214a41c4f7ba9ea275299abe608c224ff3a3 100644 (file)
@@ -28,7 +28,7 @@ using System.Text;
 
 namespace System.Runtime.Remoting.Channels.Http
 {
-       public class HttpClientChannel : IChannelSender,IChannel
+       public class HttpClientChannel : BaseChannelWithProperties, IChannelSender,IChannel
        {
                // Property Keys (purposely all lower-case)
                private const String ProxyNameKey = "proxyname";
@@ -47,28 +47,20 @@ namespace System.Runtime.Remoting.Channels.Http
                private int _clientConnectionLimit = 0; // bump connection limit to at least this number (only meaningful if > 0)
                private bool _bUseDefaultCredentials = false; // should default credentials be used?
         
-               private IClientChannelSinkProvider _sinkProvider = null; // sink chain provider         
-        
-               private IMessageSink _msgSink;
-
-
+               private IClientChannelSinkProvider _sinkProvider = null; // sink chain provider
 
                public HttpClientChannel()
                {
-                       
-                       SetupProvider(_sinkProvider);
+                       SetupProvider (null,null);
                } 
-
-
                
                public HttpClientChannel(String name, IClientChannelSinkProvider sinkProvider)
                {
                        if(name != null)
                                _channelName = name;
                        
-                       SetupProvider(sinkProvider);
+                       SetupProvider (sinkProvider, null);
                }
-       
 
                // constructor used by config file
                public HttpClientChannel(IDictionary properties, IClientChannelSinkProvider sinkProvider)
@@ -101,11 +93,9 @@ namespace System.Runtime.Remoting.Channels.Http
                                }
                        }
                        
-                       SetupProvider (sinkProvider);
-
+                       SetupProvider (sinkProvider, properties);
                } 
         
-               
                public int ChannelPriority
                {
                        get { return _channelPriority; }    
@@ -143,19 +133,18 @@ namespace System.Runtime.Remoting.Channels.Http
                        if(url != null && HttpHelper.StartsWithHttp(url))
                        {
                                HttpHelper.Parse(url, out objectURI);
-                               _msgSink = (IMessageSink) _sinkProvider.CreateSink(this,url,remoteChannelData); 
+                               IMessageSink msgSink = (IMessageSink) _sinkProvider.CreateSink(this,url,remoteChannelData); 
                                
-                               if(_msgSink !=null )
+                               if(msgSink !=null )
                                        SetServicePoint(url);
 
-                               return _msgSink;
+                               return msgSink;
                        }
                        else
                        {
                                objectURI = null;
                                return null;
                        }
-
                }
 
                private void UpdateProxy()
@@ -182,12 +171,16 @@ namespace System.Runtime.Remoting.Channels.Http
                internal IWebProxy ProxyObject { get { return _proxyObject; } }
                internal bool UseDefaultCredentials { get { return _bUseDefaultCredentials; } }
 
-               private void SetupProvider(IClientChannelSinkProvider sinkProvider)
+               private void SetupProvider (IClientChannelSinkProvider sinkProvider, IDictionary properties)
                {
+                       if (properties == null) properties = new Hashtable ();
+                       HttpClientTransportSinkProvider httpSink = new HttpClientTransportSinkProvider (properties);
+                       SinksWithProperties = httpSink;
+                       
                        if(sinkProvider == null)
                        {
                                _sinkProvider = new SoapClientFormatterSinkProvider();
-                               _sinkProvider.Next = new HttpClientTransportSinkProvider();
+                               _sinkProvider.Next = httpSink;
                        }
                        else
                        {
@@ -199,17 +192,30 @@ namespace System.Runtime.Remoting.Channels.Http
                                        dummySinkProvider = dummySinkProvider.Next;
                                }
 
-                               dummySinkProvider.Next = new HttpClientTransportSinkProvider();
+                               dummySinkProvider.Next = httpSink;
                        } 
-                       
+               }
+               
+               public override object this [object key]
+               {
+                       get { return Properties[key]; }
+                       set { Properties[key] = value; }
+               }
+               
+               public override ICollection Keys 
+               {
+                       get { return Properties.Keys; }
                }
        } 
 
 
-       internal class HttpClientTransportSinkProvider : IClientChannelSinkProvider
+       internal class HttpClientTransportSinkProvider : IClientChannelSinkProvider, IChannelSinkBase
        {
-               internal HttpClientTransportSinkProvider()
+               IDictionary _properties;
+               
+               internal HttpClientTransportSinkProvider (IDictionary properties)
                {
+                       _properties = properties;
                }    
    
                public IClientChannelSink CreateSink(IChannelSender channel, String url, 
@@ -224,6 +230,12 @@ namespace System.Runtime.Remoting.Channels.Http
                        get { return null; }
                        set { throw new NotSupportedException(); }
                }
+               
+               public IDictionary Properties
+               {
+                       get { return _properties; }
+               }
+               
        } // class HttpClientTransportSinkProvider
 
 
index 49077feb94cf465a624e7d1743fbd97cf7705345..5d70de53a82d9d14ff62a6346429930d7da60477 100644 (file)
@@ -22,6 +22,12 @@ namespace System.Runtime.Remoting.Channels.Http
                {
                }
 
+               [MonoTODO]
+               public HttpRemotingHandler (Type type, object srvID)
+               {
+                       throw new NotImplementedException ();
+               }
+
                internal HttpRemotingHandler (HttpServerTransportSink sink)
                {
                        transportSink = sink;
index 4d82298333bd0ddd2cbfbd8d10fcaf9ccf281c23..3294606c507838d137f41d3dc5890041ef0535da 100644 (file)
@@ -35,7 +35,7 @@ namespace System.Runtime.Remoting.Channels.Http
                        return new HttpRemotingHandler (transportSink);
                }
                
-               public void ConfigureHttpChannel (HttpContext context)
+               void ConfigureHttpChannel (HttpContext context)
                {
                        lock (GetType())
                        {
@@ -60,7 +60,7 @@ namespace System.Runtime.Remoting.Channels.Http
                                        channelUrl += context.Request.ApplicationPath;
                                        chook.AddHookChannelUri (channelUrl);
                                        
-                                       transportSink = new HttpServerTransportSink (chook.ChannelSinkChain);
+                                       transportSink = new HttpServerTransportSink (chook.ChannelSinkChain, null);
                                }
                                webConfigLoaded = true;
                        }
index c0d946a06364a9340343487e2ea62ee5e31f7d6e..7d724095e825b93eb0b8abeb0c03607d20045599 100644 (file)
@@ -31,8 +31,7 @@ using System.Runtime.InteropServices;
 namespace System.Runtime.Remoting.Channels.Http
 {
 
-
-       public class HttpServerChannel : IChannel,
+       public class HttpServerChannel : BaseChannelWithProperties, IChannel,
                IChannelReceiver, IChannelReceiverHook
        {
                private int               _channelPriority = 1;  // priority of channel (default=1)
@@ -59,13 +58,13 @@ namespace System.Runtime.Remoting.Channels.Http
 
                public HttpServerChannel() : base()
                {
-                       SetupChannel(null);
+                       SetupChannel(null,null);
                }
 
                public HttpServerChannel(int port) : base()
                {
                        _port = port;
-                       SetupChannel(null);
+                       SetupChannel(null,null);
                } 
                
                public HttpServerChannel(String name, int port) : base()
@@ -73,7 +72,7 @@ namespace System.Runtime.Remoting.Channels.Http
             _channelName = name;
                        _port = port;
                        _wantsToListen = false;
-                       SetupChannel(null);
+                       SetupChannel(null,null);
                } 
 
                public HttpServerChannel(String name, int port, IServerChannelSinkProvider sinkProvider) : base()
@@ -82,7 +81,7 @@ namespace System.Runtime.Remoting.Channels.Http
                        
                        _port = port;
                        _wantsToListen = false;
-                       SetupChannel(sinkProvider);
+                       SetupChannel(sinkProvider,null);
                } 
 
                public HttpServerChannel (IDictionary properties, IServerChannelSinkProvider sinkProvider) : base()
@@ -120,12 +119,14 @@ namespace System.Runtime.Remoting.Channels.Http
                                }
                        }
 
-                       SetupChannel (sinkProvider);
+                       SetupChannel (sinkProvider, properties);
                } 
 
 
-               void SetupChannel (IServerChannelSinkProvider sinkProvider)
+               void SetupChannel (IServerChannelSinkProvider sinkProvider, IDictionary properties)
                {
+                       if (properties == null) properties = new Hashtable ();
+                       
                        SetupMachineName();
                        
                        _sinkProvider = sinkProvider;
@@ -153,10 +154,11 @@ namespace System.Runtime.Remoting.Channels.Http
                        IServerChannelSink snk = 
                                ChannelServices.CreateServerChannelSinkChain(_sinkProvider,this);
 
-                       _transportSink = new HttpServerTransportSink (snk);
+                       _transportSink = new HttpServerTransportSink (snk, properties);
+                       SinksWithProperties = _transportSink;
                }
 
-               public void Listen()
+               internal void Listen()
                {
                        while(true)
                        {
@@ -288,44 +290,35 @@ namespace System.Runtime.Remoting.Channels.Http
                        _channelData.ChannelUris = newUris;
                        _wantsToListen = false;
                }
-        
-               public Object this[Object key]
+               
+               public override object this [object key]
                {
-                       get { return null; }
-        
-                       set
-                       {
-                               switch((string)key)
-                               {
-                                       case "":
-                                               break;
-                               }
-                       }
+                       get { return Properties[key]; }
+                       set { Properties[key] = value; }
                }
                
-               public ICollection Keys
+               public override ICollection Keys 
                {
-                       get
-                       {
-                               return new ArrayList(); 
-                       }
+                       get { return Properties.Keys; }
                }
 
        } // HttpServerChannel
 
 
-       internal class HttpServerTransportSink : IServerChannelSink
+       internal class HttpServerTransportSink : IServerChannelSink, IChannelSinkBase
        {
                private static String s_serverHeader =
                        "mono .NET Remoting, mono .NET CLR " + System.Environment.Version.ToString();
     
                // sink state
                private IServerChannelSink _nextSink;
+               private IDictionary _properties;
         
 
-               public HttpServerTransportSink (IServerChannelSink nextSink)
+               public HttpServerTransportSink (IServerChannelSink nextSink, IDictionary properties)
                {
                        _nextSink = nextSink;
+                       _properties = properties;
 
                } // IServerChannelSink
 
@@ -415,7 +408,7 @@ namespace System.Runtime.Remoting.Channels.Http
 
                public IDictionary Properties
                {
-                       get { return null; }
+                       get { return _properties; }
                } // Properties