diff options
author | Lluis Sanchez <lluis@novell.com> | 2004-05-13 12:55:28 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2004-05-13 12:55:28 +0400 |
commit | a1befbed0525ee992c0a58043803f3e961f60ab0 (patch) | |
tree | 7e7d6193990031a110c72b0293e0b6774a8d40be /mcs | |
parent | 0a461a9b9cfe43e6b8f17b1769bba14dfdb94d23 (diff) |
* HttpChannel.cs, HttpClientChannel.cs: Added missing IDictionary
properties.
* HttpRemotingHandler.cs: Added missing constructor.
* HttpRemotingHandlerFactory.cs: Made ConfigureHttpChannel private.
* HttpServerChannel.cs: Fixed IDictionary properties.
svn path=/trunk/mcs/; revision=27245
Diffstat (limited to 'mcs')
6 files changed, 99 insertions, 62 deletions
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog index 45a24240e2d..d292b26185a 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog @@ -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. diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpChannel.cs index 277033461ee..4ae2d710199 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpChannel.cs @@ -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; } + } } } diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs index 9c58283cd4b..6200214a41c 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs @@ -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 diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandler.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandler.cs index 49077feb94c..5d70de53a82 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandler.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandler.cs @@ -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; diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandlerFactory.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandlerFactory.cs index 4d82298333b..3294606c507 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandlerFactory.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpRemotingHandlerFactory.cs @@ -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; } diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs index c0d946a0636..7d724095e82 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs @@ -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 |