01: // ========================================================================
02: // $Id: J2EEWebApplicationContext.java,v 1.6 2004/10/03 01:35:42 gregwilkins Exp $
03: // Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.j2ee;
17:
18: import org.jboss.logging.Logger;
19: import org.mortbay.j2ee.session.Manager;
20: import org.mortbay.jetty.handler.ErrorHandler;
21: import org.mortbay.jetty.security.SecurityHandler;
22: import org.mortbay.jetty.servlet.ServletHandler;
23: import org.mortbay.jetty.servlet.SessionHandler;
24: import org.mortbay.jetty.webapp.WebAppContext;
25:
26: public class J2EEWebAppContext extends WebAppContext {
27: protected static final Logger _log = Logger
28: .getLogger(J2EEWebAppContext.class);
29:
30: // ----------------------------------------------------------------------------
31: // DistributedHttpSession support
32: // ----------------------------------------------------------------------------
33: protected boolean _distributable = false;
34:
35: protected Manager _distributableSessionManager;
36:
37: // ----------------------------------------------------------------------------
38: public J2EEWebAppContext(SecurityHandler securityHandler,
39: SessionHandler sessionHandler,
40: ServletHandler servletHandler, ErrorHandler errorHandler) {
41: super (securityHandler, sessionHandler, servletHandler,
42: errorHandler);
43: }
44:
45: // ----------------------------------------------------------------------------
46: public boolean getDistributable() {
47: return _distributable;
48: }
49:
50: // ----------------------------------------------------------------------------
51: public void setDistributable(boolean distributable) {
52: if (_log.isDebugEnabled())
53: _log.debug("setDistributable " + distributable);
54: _distributable = distributable;
55: }
56:
57: // ----------------------------------------------------------------------------
58: public void setDistributableSessionManager(Manager manager) {
59: // _log.info("setDistributableSessionManager "+manager);
60: _distributableSessionManager = (Manager) manager;
61: _distributableSessionManager.setContext(this );
62: }
63:
64: // ----------------------------------------------------------------------------
65: public Manager getDistributableSessionManager() {
66: return _distributableSessionManager;
67: }
68:
69: // ----------------------------------------------------------------------------
70: protected void doStart() throws Exception {
71: // if (getStopGracefully() && !getStatsOn())
72: // setStatsOn(true);
73:
74: super .doStart();
75: }
76:
77: // ----------------------------------------------------------------------------
78: public void doStop() throws Exception {
79: super.doStop();
80: _distributableSessionManager = null;
81: }
82: }
|