}
}
+ internal class AspNetReplyChannel : HttpReplyChannel
+ {
+ public AspNetReplyChannel (HttpStandaloneChannelListener<IReplyChannel> listener)
+ : base (listener)
+ {
+ }
+
+ protected override RequestContext CreateRequestContext (HttpContextInfo ctxi, Message msg)
+ {
+ return new AspNetRequestContext (this, ctxi, msg);
+ }
+
+ protected override Message CreatePostMessage (HttpContextInfo ctxi)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool WaitForRequest (TimeSpan timeout)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
internal abstract class HttpReplyChannel : InternalReplyChannelBase
{
HttpStandaloneChannelListener<IReplyChannel> source;
+2010-07-02 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SvcHttpHandlerFactory.cs : remove unused code.
+ * SvcHttpHandler.cs : ditto. Add some code for what new asp.net
+ support will look like.
+
2010-07-02 Atsushi Enomoto <atsushi@ximian.com>
* Message.cs, MessageImpl.cs, MessageBufferImpl.cs : remove BodyId.
namespace System.ServiceModel.Channels {
+#if !NEW_CODE
internal class WcfListenerInfo
{
public WcfListenerInfo ()
return info.Listener;
}
}
+#endif
internal class SvcHttpHandler : IHttpHandler
{
Type factory_type;
string path;
ServiceHostBase host;
+#if !NEW_CODE
WcfListenerInfoCollection listeners = new WcfListenerInfoCollection ();
+#endif
Dictionary<HttpContext,ManualResetEvent> wcf_wait_handles = new Dictionary<HttpContext,ManualResetEvent> ();
int close_state;
get { return host; }
}
+#if !NEW_CODE
public HttpContext WaitForRequest (IChannelListener listener)
{
if (close_state > 0)
if (best != null)
return best;
throw new InvalidOperationException (String.Format ("The argument HTTP context did not match any of the registered listener manager (could be mismatch in URL, method etc.) {0}", ctx.Request.Url));
-/*
- var actx = new AspNetHttpContextInfo (ctx);
- foreach (var i in listeners)
- if (i.Listener.GetProperty<HttpListenerManager> ().FilterHttpContext (actx))
- return i.Listener;
- throw new InvalidOperationException ();
-*/
}
+#endif
+
+#if NEW_CODE
+
+ public void ProcessRequest (HttpContext context)
+ {
+ EnsureServiceHost ();
+
+ var table = HttpListenerManagerTable.GetOrCreate (host);
+ var manager = table.GetOrCreateManager (host.BaseAddresses [0]);
+ var wait = new ManualResetEvent (false);
+ wcf_wait_handles [context] = wait;
+ manager.ProcessNewContext (new AspNetContextInfo (context));
+ // This method must not return until the RequestContext
+ // explicitly finishes replying. Otherwise xsp will
+ // close the connection after this method call.
+ wait.WaitOne ();
+ }
+
+#else
public void ProcessRequest (HttpContext context)
{
wait.WaitOne ();
}
+#endif
public void EndRequest (IChannelListener listener, HttpContext context)
{
host = null;
}
+#if !NEW_CODE
public void RegisterListener (IChannelListener listener)
{
lock (type_lock)
listeners.Remove (listener);
}
+#endif
+
void EnsureServiceHost ()
{
lock (type_lock) {