Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/Support
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24266/Web/Support
Modified Files:
PageHandlerFactory.cs
Log Message:
Revert changes made in SPRNET-899
Index: PageHandlerFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/Support/PageHandlerFactory.cs,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** PageHandlerFactory.cs 26 Mar 2008 23:29:43 -0000 1.37
--- PageHandlerFactory.cs 4 Apr 2008 20:45:06 -0000 1.38
***************
*** 91,95 ****
if (isDebug) Log.Debug(string.Format("GetHandler():resolving url '{0}'", url));
! PageHandlerWrapper pageHandlerWrapper;
lock (pageHandlerWrappers.SyncRoot)
--- 91,95 ----
if (isDebug) Log.Debug(string.Format("GetHandler():resolving url '{0}'", url));
! IHttpHandler pageHandlerWrapper;
lock (pageHandlerWrappers.SyncRoot)
***************
*** 121,140 ****
if (namedPageDefinition != null)
{
! pageHandlerWrapper = new PageHandlerWrapper(appContext, namedPageDefinition.Name, url, null);
}
else
{
! pageHandlerWrapper = new PageHandlerWrapper(appContext, appRelativeVirtualPath, url, physicalPath);
}
! lock (pageHandlerWrappers.SyncRoot)
{
! pageHandlerWrappers[url] = pageHandlerWrapper;
}
}
! IHttpHandler handler;
! handler = pageHandlerWrapper.GetHandler(context);
! return handler;
}
}
--- 121,157 ----
if (namedPageDefinition != null)
{
! Type pageType = namedPageDefinition.ObjectDefinition.ObjectType;
! if (typeof(IRequiresSessionState).IsAssignableFrom(pageType))
! {
! pageHandlerWrapper = new SessionAwarePageHandlerWrapper(appContext, namedPageDefinition.Name, url, null);
! }
! else
! {
! pageHandlerWrapper = new PageHandlerWrapper(appContext, namedPageDefinition.Name, url, null);
! }
}
else
{
! Type pageType = WebObjectUtils.GetPageType(url);
! if (typeof(IRequiresSessionState).IsAssignableFrom(pageType))
! {
! pageHandlerWrapper = new SessionAwarePageHandlerWrapper(appContext, appRelativeVirtualPath, url, physicalPath);
! }
! else
! {
! pageHandlerWrapper = new PageHandlerWrapper(appContext, appRelativeVirtualPath, url, physicalPath);
! }
}
! if (pageHandlerWrapper.IsReusable)
{
! lock (pageHandlerWrappers.SyncRoot)
! {
! pageHandlerWrappers[url] = pageHandlerWrapper;
! }
}
}
! return pageHandlerWrapper;
}
}
***************
*** 149,153 ****
/// override non-virtual methods from the base Page class.
/// </remarks>
! internal class PageHandlerWrapper
{
private readonly IApplicationContext appContext;
--- 166,170 ----
/// override non-virtual methods from the base Page class.
/// </remarks>
! internal class PageHandlerWrapper : Page, IHttpHandler
{
private readonly IApplicationContext appContext;
***************
*** 216,220 ****
#endregion
! public IHttpHandler GetHandler(HttpContext context)
{
IHttpHandler handler = cachedHandler;
--- 233,237 ----
#endregion
! void IHttpHandler.ProcessRequest(HttpContext context)
{
IHttpHandler handler = cachedHandler;
***************
*** 237,241 ****
ApplySharedState(handler);
ApplyDependencyInjection(handler);
! return handler;
}
--- 254,269 ----
ApplySharedState(handler);
ApplyDependencyInjection(handler);
!
! context.Handler = handler;
! handler.ProcessRequest(context);
! }
!
! /// <summary>
! /// Returns true because this wrapper handler can be reused.
! /// Actual page is instantiated at the beginning of the ProcessRequest method.
! /// </summary>
! bool IHttpHandler.IsReusable
! {
! get { return true; }
}
***************
*** 327,390 ****
}
}
-
- /*
- #region IHttpHandler Members
-
- /// <summary>
- /// Creates instance of the page and delegates call to it.
- /// </summary>
- /// <param name="context">HttpContext of the current page request.</param>
- void IHttpHandler.ProcessRequest(HttpContext context)
- {
- IHttpHandler handler = GetHandler(context);
-
- context.Handler = handler;
- handler.ProcessRequest(context);
- }
-
- /// <summary>
- /// Returns true because this wrapper handler can be reused.
- /// Actual page is instantiated at the beginning of the ProcessRequest method.
- /// </summary>
- bool IHttpHandler.IsReusable
- {
- get { return true; }
- }
-
- #endregion
- */
}
! /*
/// <summary>
! /// Wrapper for handlers that require <see cref="HttpSessionState"/>.
/// </summary>
! /// <remarks>
! /// Delays page object instantiation until ProcessRequest is called
! /// in order to be able to access session state.
! /// </remarks>
! internal class SessionAwarePageHandler : PageHandler, IRequiresSessionState
{
! /// <summary>
! /// Initializes a new instance of the <see cref="SessionAwarePageHandler"/> class.
! /// </summary>
! /// <param name="appContext">Application context instance to retrieve page from.</param>
! /// <param name="pageName">Name of the page object to execute.</param>
! /// <param name="url">Requested page URL.</param>
! /// <param name="path">Translated server path for the page.</param>
! public SessionAwarePageHandler(IApplicationContext appContext, string pageName, string url, string path)
! : base(appContext, pageName, url, path)
! {
! }
! /// <summary>
! /// Initializes a new instance of the <see cref="SessionAwarePageHandler"/> class.
! /// </summary>
! /// <param name="appContext">Application context instance to retrieve page from.</param>
! /// <param name="pageName">Name of the page object to execute.</param>
! public SessionAwarePageHandler(IApplicationContext appContext, string pageName)
! : base(appContext, pageName)
! {
! }
}
! */
}
\ No newline at end of file
--- 355,390 ----
}
}
}
!
! /// <summary>
! /// Wrapper for handlers that require <see cref="HttpSessionState"/>.
! /// </summary>
! /// <remarks>
! /// Delays page object instantiation until ProcessRequest is called
! /// in order to be able to access session state.
! /// </remarks>
! internal class SessionAwarePageHandlerWrapper : PageHandlerWrapper, IRequiresSessionState
! {
/// <summary>
! /// Initializes a new instance of the <see cref="SessionAwarePageHandlerWrapper"/> class.
/// </summary>
! /// <param name="appContext">Application context instance to retrieve page from.</param>
! /// <param name="pageName">Name of the page object to execute.</param>
! /// <param name="url">Requested page URL.</param>
! /// <param name="path">Translated server path for the page.</param>
! public SessionAwarePageHandlerWrapper(IApplicationContext appContext, string pageName, string url, string path)
! : base(appContext, pageName, url, path)
{
! }
! /// <summary>
! /// Initializes a new instance of the <see cref="SessionAwarePageHandlerWrapper"/> class.
! /// </summary>
! /// <param name="appContext">Application context instance to retrieve page from.</param>
! /// <param name="pageName">Name of the page object to execute.</param>
! public SessionAwarePageHandlerWrapper(IApplicationContext appContext, string pageName)
! : base(appContext, pageName)
! {
}
! }
}
\ No newline at end of file
|