used Trace/Debug.WriteLine instead Console.
[mono.git] / mcs / class / Mainsoft.Web / Mainsoft.Web.SessionState / SessionListener.cs
1 //
2 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
3 //
4
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the
8 // "Software"), to deal in the Software without restriction, including
9 // without limitation the rights to use, copy, modify, merge, publish,
10 // distribute, sublicense, and/or sell copies of the Software, and to
11 // permit persons to whom the Software is furnished to do so, subject to
12 // the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 //
25
26 using System;
27 using System.Web.SessionState;
28 using System.Reflection;
29 using javax.servlet.http;
30 using Mainsoft.Web.Hosting;
31 using System.Diagnostics;
32
33 namespace Mainsoft.Web.SessionState
34 {
35         /// <summary>
36         /// <para>This class supports the Framework infrastructure and is not intended to be used directly from your code.</para>
37         /// </summary>
38         public class SessionListener : javax.servlet.http.HttpSessionListener
39         {
40
41                 public void sessionCreated (HttpSessionEvent se) {
42                 }
43
44                 public void sessionDestroyed (HttpSessionEvent se) {
45                         bool setDomain = vmw.@internal.EnvironmentUtils.getAppDomain () == null;
46                         if (setDomain) {
47                                 AppDomain servletDomain = (AppDomain) se.getSession ().getServletContext ().getAttribute (J2EEConsts.APP_DOMAIN);
48                                 if (servletDomain == null)
49                                         return;
50                                 vmw.@internal.EnvironmentUtils.setAppDomain (servletDomain);
51                         }
52                         try {
53                                 HttpSessionStateContainer container =
54                                         ServletSessionStateStoreProvider.CreateContainer (se.getSession ());
55
56                                 SessionStateUtility.RaiseSessionEnd (container, this, EventArgs.Empty);
57                         }
58                         catch (Exception e) {
59                                 Debug.WriteLine (e.Message);
60                                 Debug.WriteLine (e.StackTrace);
61                         }
62                         finally {
63                                 if (setDomain) {
64                                         vmw.@internal.EnvironmentUtils.clearAppDomain ();
65                                 }
66                         }
67                 }
68         }
69 }
70
71 namespace System.Web.GH
72 {
73         /// <summary>
74         /// <para>This class supports the Framework infrastructure and is not intended to be used directly from your code.</para>
75         /// </summary>
76         public class SessionListener : Mainsoft.Web.SessionState.SessionListener
77         {
78         }
79 }
80
81 namespace System.Web.J2EE
82 {
83         /// <summary>
84         /// <para>This class supports the Framework infrastructure and is not intended to be used directly from your code.</para>
85         /// </summary>
86         public class SessionListener : Mainsoft.Web.SessionState.SessionListener
87         {
88         }
89 }