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