Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web.Extensions/Web/Script/Services
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv13508
Modified Files:
ScriptHandlerFactory.cs
Log Message:
Try to de-couple the url from the actual object definition name in WebServiceExporter [SPRNET-762]
Apply Erich's fix to the ScriptHandlerFactory (Spring.Web.Extensions)
Index: ScriptHandlerFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web.Extensions/Web/Script/Services/ScriptHandlerFactory.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ScriptHandlerFactory.cs 31 May 2007 18:34:55 -0000 1.1
--- ScriptHandlerFactory.cs 27 Mar 2008 11:11:22 -0000 1.2
***************
*** 30,33 ****
--- 30,34 ----
using Spring.Util;
using Spring.Web.Services;
+ using Spring.Web.Support;
#endregion
***************
*** 42,46 ****
/// <author>Thomas Broyer</author>
/// <version>$Id$</version>
! public class ScriptHandlerFactory : IHttpHandlerFactory
{
private static readonly Type scriptHandlerFactoryType =
--- 43,47 ----
/// <author>Thomas Broyer</author>
/// <version>$Id$</version>
! public class ScriptHandlerFactory : AbstractHandlerFactory, IHttpHandlerFactory
{
private static readonly Type scriptHandlerFactoryType =
***************
*** 74,79 ****
}
- #region IHttpHandlerFactory Members
-
/// <summary>
/// Retrieves an instance of the <see cref="System.Web.IHttpHandler"/>
--- 75,78 ----
***************
*** 86,90 ****
/// <param name="pathTranslated">The physical application path for the web service.</param>
/// <returns>The web service handler object.</returns>
! public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
string filename = VirtualPathUtility.ToAbsolute(context.Request.FilePath);
--- 85,89 ----
/// <param name="pathTranslated">The physical application path for the web service.</param>
/// <returns>The web service handler object.</returns>
! public override IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
string filename = VirtualPathUtility.ToAbsolute(context.Request.FilePath);
***************
*** 94,102 ****
if (webServiceData == null)
{
! string serviceName = WebUtils.GetPageName(url);
! IApplicationContext appContext = WebApplicationContext.Current;
! if (appContext.ContainsObjectDefinition(serviceName))
{
! Type serviceType = appContext.GetType(serviceName);
object[] attrs = serviceType.GetCustomAttributes(typeof(ScriptServiceAttribute), false);
if (attrs.Length > 0)
--- 93,111 ----
if (webServiceData == null)
{
! IConfigurableApplicationContext appContext =
! WebApplicationContext.GetContext(url) as IConfigurableApplicationContext;
!
! if (appContext == null)
{
! throw new InvalidOperationException(
! "Implementations of IApplicationContext must also implement IConfigurableApplicationContext");
! }
!
! string appRelativeVirtualPath = WebUtils.GetAppRelativePath(url);
! NamedObjectDefinition nod = FindWebObjectDefinition(appRelativeVirtualPath, appContext.ObjectFactory);
!
! if (nod != null)
! {
! Type serviceType = appContext.GetType(nod.Name);
object[] attrs = serviceType.GetCustomAttributes(typeof(ScriptServiceAttribute), false);
if (attrs.Length > 0)
***************
*** 115,124 ****
/// </summary>
/// <param name="handler">The <see cref="System.Web.IHttpHandler" /> object to reuse.</param>
! public void ReleaseHandler(IHttpHandler handler)
{
this.scriptHandlerFactory.ReleaseHandler(handler);
}
-
- #endregion
}
}
\ No newline at end of file
--- 124,131 ----
/// </summary>
/// <param name="handler">The <see cref="System.Web.IHttpHandler" /> object to reuse.</param>
! public override void ReleaseHandler(IHttpHandler handler)
{
this.scriptHandlerFactory.ReleaseHandler(handler);
}
}
}
\ No newline at end of file
|