TARGET_JVM: call ProfileModule's OnLeave when the action phase ends
authorKonstantin Triger <kostat@mono-cvs.ximian.com>
Sun, 20 Jan 2008 15:58:57 +0000 (15:58 -0000)
committerKonstantin Triger <kostat@mono-cvs.ximian.com>
Sun, 20 Jan 2008 15:58:57 +0000 (15:58 -0000)
svn path=/trunk/mcs/; revision=93350

mcs/class/System.Web/System.Web.Profile/ProfileModule.cs
mcs/class/System.Web/System.Web/HttpApplication.cs

index 3b94864ebb5b07da674b9fade8f61efdaf5b0d96..b5477174b98bd15fd7f992fab02d9c14fea45812 100644 (file)
@@ -40,6 +40,10 @@ namespace System.Web.Profile
                ProfileBase profile;\r
                string anonymousCookieName = null;
 
+#if TARGET_J2EE\r
+               bool _OnLeaveCalled;
+#endif
+
                public ProfileModule ()
                {
                }
@@ -70,6 +74,10 @@ namespace System.Web.Profile
                        if (!ProfileManager.Enabled)\r
                                return;\r
 \r
+#if TARGET_J2EE\r
+                       _OnLeaveCalled = false;\r
+#endif\r
+\r
                        if (HttpContext.Current.Request.IsAuthenticated) {\r
                                HttpCookie cookie = app.Request.Cookies [anonymousCookieName];\r
                                if (cookie != null && (cookie.Expires != DateTime.MinValue && cookie.Expires > DateTime.Now)) {\r
@@ -87,7 +95,9 @@ namespace System.Web.Profile
                                }\r
                        }\r
                }
-
+#if TARGET_J2EE
+               internal
+#endif
                void OnLeave (object o, EventArgs eventArgs)
                {\r
                        if (!ProfileManager.Enabled)\r
@@ -95,6 +105,13 @@ namespace System.Web.Profile
 \r
                        if (!app.Context.ProfileInitialized)
                                return;
+\r
+#if TARGET_J2EE\r
+                       if (_OnLeaveCalled)\r
+                               return;\r
+\r
+                       _OnLeaveCalled = true;\r
+#endif
 
                        if (ProfileManager.AutomaticSaveEnabled) {\r
                                profile = app.Context.Profile;\r
index 7848c7ff4c6a456feda9e5986416d5065a3ac633..7a2e50b3d856ef35f9482cc0ae6ce1bb2cc3529a 100644 (file)
@@ -1018,6 +1018,12 @@ namespace System.Web {
                        }
 #if TARGET_J2EE
                        if (doProcessHandler) {
+                               foreach (IHttpModule module in Modules) {
+                                       if (module is System.Web.Profile.ProfileModule) {
+                                               ((System.Web.Profile.ProfileModule) module).OnLeave (this, EventArgs.Empty);
+                                               break;
+                                       }
+                               }
                                yield return false;
                                goto processHandler;
                        }