static readonly Type IRequiresSessionStateType = typeof (IRequiresSessionState);\r
static readonly Type IReadOnlySessionStateType = typeof (IReadOnlySessionState);\r
\r
- public static IHttpHandler WrapHandler (IHttpHandler handler, HttpContext context, string url) {\r
- Type type = PageMapper.GetObjectType (context, url);\r
+ public static IHttpHandler WrapHandler (IHttpHandler handler) {\r
+ Type type = (Type) ((IServiceProvider) handler).GetService (typeof (Type));\r
\r
if (IRequiresSessionStateType.IsAssignableFrom (type))\r
return IReadOnlySessionStateType.IsAssignableFrom (type) ?\r
- new ReadOnlySessionWrapperHandler (handler) : new SessionWrapperHandler (handler);\r
- return handler;\r
- }\r
- public static IHttpHandler WrapHandler (IHttpExtendedHandler handler, HttpContext context, string url) {\r
- Type type = PageMapper.GetObjectType (context, url);\r
-\r
- if (IRequiresSessionStateType.IsAssignableFrom (type))\r
- return IReadOnlySessionStateType.IsAssignableFrom (type) ?\r
- new ReadOnlySessionWrapperExtendedHandler (handler) : new SessionWrapperExtendedHandler (handler);\r
+ (handler is IHttpExtendedHandler ? (IHttpHandler) new ReadOnlySessionWrapperExtendedHandler ((IHttpExtendedHandler) handler) : new ReadOnlySessionWrapperHandler (handler)) :\r
+ (handler is IHttpExtendedHandler ? new SessionWrapperExtendedHandler ((IHttpExtendedHandler) handler) : new SessionWrapperHandler (handler));\r
return handler;\r
}\r
\r
#region SessionWrappers\r
\r
- class SessionWrapperHandler : IHttpHandler, IRequiresSessionState\r
+ class SessionWrapperHandler : IHttpHandler, IRequiresSessionState, IServiceProvider\r
{\r
protected readonly IHttpHandler _handler;\r
\r
public void ProcessRequest (HttpContext context) {\r
_handler.ProcessRequest (context);\r
}\r
+\r
+ public object GetService (Type serviceType) {\r
+ return ((IServiceProvider) _handler).GetService (serviceType);\r
+ }\r
}\r
\r
sealed class ReadOnlySessionWrapperHandler : SessionWrapperHandler, IReadOnlySessionState\r
public bool IsCompleted {\r
get { return ((IHttpExtendedHandler) _handler).IsCompleted; }\r
}\r
-\r
- public object GetContextState (HttpContext context) {\r
- return ((IHttpExtendedHandler) _handler).GetContextState (context);\r
- }\r
-\r
- public void SetContextState (HttpContext context, object state) {\r
- ((IHttpExtendedHandler) _handler).SetContextState (context, state);\r
- }\r
}\r
\r
sealed class ReadOnlySessionWrapperExtendedHandler : SessionWrapperExtendedHandler, IReadOnlySessionState\r