001: package com.quadcap.http.servlets.jsp;
002:
003: /* Copyright 1999 - 2003 Quadcap Software. All rights reserved.
004: *
005: * This software is distributed under the Quadcap Free Software License.
006: * This software may be used or modified for any purpose, personal or
007: * commercial. Open Source redistributions are permitted. Commercial
008: * redistribution of larger works derived from, or works which bundle
009: * this software requires a "Commercial Redistribution License"; see
010: * http://www.quadcap.com/purchase.
011: *
012: * Redistributions qualify as "Open Source" under one of the following terms:
013: *
014: * Redistributions are made at no charge beyond the reasonable cost of
015: * materials and delivery.
016: *
017: * Redistributions are accompanied by a copy of the Source Code or by an
018: * irrevocable offer to provide a copy of the Source Code for up to three
019: * years at the cost of materials and delivery. Such redistributions
020: * must allow further use, modification, and redistribution of the Source
021: * Code under substantially the same terms as this license.
022: *
023: * Redistributions of source code must retain the copyright notices as they
024: * appear in each source code file, these license terms, and the
025: * disclaimer/limitation of liability set forth as paragraph 6 below.
026: *
027: * Redistributions in binary form must reproduce this Copyright Notice,
028: * these license terms, and the disclaimer/limitation of liability set
029: * forth as paragraph 6 below, in the documentation and/or other materials
030: * provided with the distribution.
031: *
032: * The Software is provided on an "AS IS" basis. No warranty is
033: * provided that the Software is free of defects, or fit for a
034: * particular purpose.
035: *
036: * Limitation of Liability. Quadcap Software shall not be liable
037: * for any damages suffered by the Licensee or any third party resulting
038: * from use of the Software.
039: */
040:
041: import java.util.Enumeration;
042:
043: import javax.servlet.http.HttpServletRequest;
044: import javax.servlet.http.HttpSession;
045: import javax.servlet.http.HttpSessionContext;
046:
047: /**
048: * The JSP Session object.
049: *
050: * @author Stan Bailes
051: */
052: public class JspSession implements HttpSession {
053: HttpServletRequest req;
054: HttpSession session = null;
055:
056: public JspSession(HttpServletRequest req) {
057: this .req = req;
058: }
059:
060: final HttpSession getSession() {
061: if (session == null)
062: session = req.getSession();
063: return session;
064: }
065:
066: public long getCreationTime() {
067: return getSession().getCreationTime();
068: }
069:
070: public String getId() {
071: return getSession().getId();
072: }
073:
074: public long getLastAccessedTime() {
075: return getSession().getLastAccessedTime();
076: }
077:
078: public void setMaxInactiveInterval(int ivl) {
079: getSession().setMaxInactiveInterval(ivl);
080: }
081:
082: public int getMaxInactiveInterval() {
083: return getSession().getMaxInactiveInterval();
084: }
085:
086: public HttpSessionContext getSessionContext() {
087: return getSession().getSessionContext();
088: }
089:
090: public Object getAttribute(String name) {
091: return getSession().getAttribute(name);
092: }
093:
094: public Object getValue(String name) {
095: return getSession().getValue(name);
096: }
097:
098: public Enumeration getAttributeNames() {
099: return getSession().getAttributeNames();
100: }
101:
102: public String[] getValueNames() {
103: return getSession().getValueNames();
104: }
105:
106: public void setAttribute(String name, Object val) {
107: getSession().setAttribute(name, val);
108: }
109:
110: public void putValue(String name, Object val) {
111: getSession().putValue(name, val);
112: }
113:
114: public void removeAttribute(String name) {
115: getSession().removeAttribute(name);
116: }
117:
118: public void removeValue(String name) {
119: getSession().removeValue(name);
120: }
121:
122: public void invalidate() {
123: getSession().invalidate();
124: }
125:
126: public boolean isNew() {
127: return getSession().isNew();
128: }
129:
130: }
|