properties.
* HttpRemotingHandler.cs: Added missing constructor.
* HttpRemotingHandlerFactory.cs: Made ConfigureHttpChannel private.
* HttpServerChannel.cs: Fixed IDictionary properties.
svn path=/trunk/mcs/; revision=27245
+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.
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()
{
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)
val = properties ["priority"];
if (val != null) channelPriority = Convert.ToInt32 (val);
+
+ this.properties = new AggregateDictionary (new IDictionary[] {clientChannel, serverChannel});
}
{
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; }
+ }
}
}
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";
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)
}
}
- SetupProvider (sinkProvider);
-
+ SetupProvider (sinkProvider, properties);
}
-
public int ChannelPriority
{
get { return _channelPriority; }
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()
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
{
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,
get { return null; }
set { throw new NotSupportedException(); }
}
+
+ public IDictionary Properties
+ {
+ get { return _properties; }
+ }
+
} // class HttpClientTransportSinkProvider
{
}
+ [MonoTODO]
+ public HttpRemotingHandler (Type type, object srvID)
+ {
+ throw new NotImplementedException ();
+ }
+
internal HttpRemotingHandler (HttpServerTransportSink sink)
{
transportSink = sink;
return new HttpRemotingHandler (transportSink);
}
- public void ConfigureHttpChannel (HttpContext context)
+ void ConfigureHttpChannel (HttpContext context)
{
lock (GetType())
{
channelUrl += context.Request.ApplicationPath;
chook.AddHookChannelUri (channelUrl);
- transportSink = new HttpServerTransportSink (chook.ChannelSinkChain);
+ transportSink = new HttpServerTransportSink (chook.ChannelSinkChain, null);
}
webConfigLoaded = true;
}
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)
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()
_channelName = name;
_port = port;
_wantsToListen = false;
- SetupChannel(null);
+ SetupChannel(null,null);
}
public HttpServerChannel(String name, int port, IServerChannelSinkProvider sinkProvider) : base()
_port = port;
_wantsToListen = false;
- SetupChannel(sinkProvider);
+ SetupChannel(sinkProvider,null);
}
public HttpServerChannel (IDictionary properties, IServerChannelSinkProvider sinkProvider) : base()
}
}
- SetupChannel (sinkProvider);
+ SetupChannel (sinkProvider, properties);
}
- void SetupChannel (IServerChannelSinkProvider sinkProvider)
+ void SetupChannel (IServerChannelSinkProvider sinkProvider, IDictionary properties)
{
+ if (properties == null) properties = new Hashtable ();
+
SetupMachineName();
_sinkProvider = sinkProvider;
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)
{
_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
public IDictionary Properties
{
- get { return null; }
+ get { return _properties; }
} // Properties