001: /*
002: * Copyright 1999,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina.session;
018:
019: import java.util.Enumeration;
020:
021: import javax.servlet.ServletContext;
022: import javax.servlet.http.HttpSession;
023: import javax.servlet.http.HttpSessionContext;
024:
025: /**
026: * Facade for the StandardSession object.
027: * <p>
028: * Please note that two sessions are considered equal
029: * only if they are "reference-equal." There is no equals()
030: * method implementation.
031: *
032: * @author Remy Maucherat
033: * @version $Revision: 1.6.2.1 $ $Date: 2004/08/28 12:54:08 $
034: */
035:
036: public class StandardSessionFacade implements HttpSession {
037:
038: // ----------------------------------------------------------- Constructors
039:
040: /**
041: * Construct a new session facade.
042: */
043: public StandardSessionFacade(StandardSession session) {
044: super ();
045: this .session = (HttpSession) session;
046: }
047:
048: /**
049: * Construct a new session facade.
050: */
051: public StandardSessionFacade(HttpSession session) {
052: super ();
053: this .session = session;
054: }
055:
056: // ----------------------------------------------------- Instance Variables
057:
058: /**
059: * Wrapped session object.
060: */
061: private HttpSession session = null;
062:
063: // ---------------------------------------------------- HttpSession Methods
064:
065: public long getCreationTime() {
066: return session.getCreationTime();
067: }
068:
069: public String getId() {
070: return session.getId();
071: }
072:
073: public long getLastAccessedTime() {
074: return session.getLastAccessedTime();
075: }
076:
077: public ServletContext getServletContext() {
078: // FIXME : Facade this object ?
079: return session.getServletContext();
080: }
081:
082: public void setMaxInactiveInterval(int interval) {
083: session.setMaxInactiveInterval(interval);
084: }
085:
086: public int getMaxInactiveInterval() {
087: return session.getMaxInactiveInterval();
088: }
089:
090: public HttpSessionContext getSessionContext() {
091: return session.getSessionContext();
092: }
093:
094: public Object getAttribute(String name) {
095: return session.getAttribute(name);
096: }
097:
098: public Object getValue(String name) {
099: return session.getAttribute(name);
100: }
101:
102: public Enumeration getAttributeNames() {
103: return session.getAttributeNames();
104: }
105:
106: public String[] getValueNames() {
107: return session.getValueNames();
108: }
109:
110: public void setAttribute(String name, Object value) {
111: session.setAttribute(name, value);
112: }
113:
114: public void putValue(String name, Object value) {
115: session.setAttribute(name, value);
116: }
117:
118: public void removeAttribute(String name) {
119: session.removeAttribute(name);
120: }
121:
122: public void removeValue(String name) {
123: session.removeAttribute(name);
124: }
125:
126: public void invalidate() {
127: session.invalidate();
128: }
129:
130: public boolean isNew() {
131: return session.isNew();
132: }
133:
134: }
|