diff --git a/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.2005/Web.Config b/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.2005/Web.Config index bf3acac1..7ba5cd4e 100644 --- a/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.2005/Web.Config +++ b/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.2005/Web.Config @@ -1,63 +1,81 @@ - - -
-
- - -
- - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.Providers/Web.config b/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.Providers/Web.config index fab1e14f..1451118c 100644 --- a/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.Providers/Web.config +++ b/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.Providers/Web.config @@ -90,4 +90,15 @@ --> + + + + + + + + + + + diff --git a/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs b/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs index c9256a15..4ed00327 100644 --- a/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs +++ b/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs @@ -34,6 +34,7 @@ using Spring.Objects.Factory.Config; using Spring.Objects.Factory.Support; using Spring.Objects.Factory.Xml; using Spring.Objects.Support; +using Spring.Reflection.Dynamic; using Spring.Util; #endregion @@ -161,8 +162,11 @@ namespace Spring.Context.Support { string firstRequestPath = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/') + "/dummy.context"; log.Info("Forcing first request " + firstRequestPath); - HttpRuntime.ProcessRequest( - new SimpleWorkerRequest(firstRequestPath, string.Empty, new StringWriter())); + SafeMethod fnProcessRequestNow = new SafeMethod(typeof(HttpRuntime).GetMethod("ProcessRequestNow", BindingFlags.Static|BindingFlags.NonPublic)); + SimpleWorkerRequest wr = new SimpleWorkerRequest(firstRequestPath, string.Empty, new StringWriter()); + fnProcessRequestNow.Invoke(null, new object[] { wr }); +// HttpRuntime.ProcessRequest( +// wr); log.Info("Successfully processed first request!"); } catch (Exception ex) diff --git a/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs b/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs index ff1defc0..b56c152d 100644 --- a/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs +++ b/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs @@ -34,6 +34,7 @@ using Spring.Core.TypeResolution; using Spring.Expressions; using Spring.Objects.Factory.Config; using Spring.Objects.Factory.Support; +using Spring.Reflection.Dynamic; using Spring.Threading; using Spring.Util; using Spring.Web.Support; @@ -77,6 +78,10 @@ namespace Spring.Context.Support // Required for Session End event handling private static int CACHEKEYPREFIXLENGTH = 0; private static CacheItemRemovedCallback s_originalCallback; +#if NET_2_0 + // required to enable accessing HttpContext.Request during IHttpModule.Init() in integrated mode + private static readonly SafeField ContextHideRequestResponse = new SafeField(typeof(HttpContext).GetField("HideRequestResponse", BindingFlags.Instance|BindingFlags.NonPublic)); +#endif /// /// For webapplications always @@ -142,7 +147,24 @@ namespace Spring.Context.Support { throw new InvalidOperationException("Implementations of IApplicationContext must also implement IConfigurableApplicationContext"); } + +#if NET_2_0 + // TODO: this is only a workaround to get us up & running in IIS7/integrated mode + // We must review all code for relative virtual paths - they must be resolved to application-relative paths + // during parsing of the object definitions + bool hideRequestResponse = (bool) ContextHideRequestResponse.GetValue(app.Context); + ContextHideRequestResponse.SetValue(app.Context, false); + try + { + HttpApplicationConfigurer.Configure(appContext, app); + } + finally + { + ContextHideRequestResponse.SetValue(app.Context, hideRequestResponse); + } +#else HttpApplicationConfigurer.Configure(appContext, app); +#endif } #region IHttpHandler configuration