001: /*
002: * (C) Copyright 2000 - 2005 Nabh Information Systems, Inc.
003: *
004: * This program is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU General Public License
006: * as published by the Free Software Foundation; either version 2
007: * of the License, or (at your option) any later version.
008: *
009: * This program is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with this program; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: *
018: */
019: package com.nabhinc.ws.server;
020:
021: import java.util.Enumeration;
022:
023: import javax.servlet.http.HttpSession;
024:
025: import com.nabhinc.core.WebServiceSession;
026:
027: /**
028: * Implementation of <code>WebServiceSession</code> interface based
029: * on HTTP session.
030: *
031: * @author Padmanabh Dabke
032: * (c) 2005 Nabh Information Systems, Inc. All Rights Reserved.
033: */
034: public class HTTPWebServiceSession implements WebServiceSession {
035:
036: /**
037: * Underlying HTTP session
038: */
039: private HttpSession hwssSession = null;
040:
041: /**
042: * Empty constructor
043: */
044: public HTTPWebServiceSession() {
045: }
046:
047: /**
048: * Creates a session object associated with supplied HTTP session
049: * @param session HTTP session
050: */
051: public HTTPWebServiceSession(HttpSession session) {
052: hwssSession = session;
053: }
054:
055: /**
056: * Set the HTTP session associated with this object.
057: * @param session HTTP session
058: */
059: public void setHttpSession(HttpSession session) {
060: hwssSession = session;
061: }
062:
063: /**
064: * @see com.nabhinc.ws.server.WebServiceSession#getCreationTime()
065: */
066: public long getCreationTime() {
067: return hwssSession.getCreationTime();
068: }
069:
070: /**
071: * @see com.nabhinc.ws.server.WebServiceSession#getId()
072: */
073: public String getId() {
074: return hwssSession.getId();
075: }
076:
077: /**
078: * @see com.nabhinc.ws.server.WebServiceSession#getLastAccessedTime()
079: */
080: public long getLastAccessedTime() {
081: return hwssSession.getLastAccessedTime();
082: }
083:
084: /**
085: * @see com.nabhinc.ws.server.WebServiceSession#setMaxInactiveInterval(int)
086: */
087: public void setMaxInactiveInterval(int interval) {
088: hwssSession.setMaxInactiveInterval(interval);
089:
090: }
091:
092: /**
093: * @see com.nabhinc.ws.server.WebServiceSession#getMaxInactiveInterval()
094: */
095: public int getMaxInactiveInterval() {
096: return hwssSession.getMaxInactiveInterval();
097: }
098:
099: /**
100: * @see com.nabhinc.ws.server.WebServiceSession#getAttribute(java.lang.String)
101: */
102: public Object getAttribute(String name) {
103: return hwssSession.getAttribute(name);
104: }
105:
106: /**
107: * @see com.nabhinc.ws.server.WebServiceSession#getAttributeNames()
108: */
109: public Enumeration getAttributeNames() {
110: return hwssSession.getAttributeNames();
111: }
112:
113: /**
114: * @see com.nabhinc.ws.server.WebServiceSession#setAttribute(java.lang.String, java.lang.Object)
115: */
116: public void setAttribute(String name, Object value) {
117: hwssSession.setAttribute(name, value);
118:
119: }
120:
121: /**
122: * @see com.nabhinc.ws.server.WebServiceSession#removeAttribute(java.lang.String)
123: */
124: public void removeAttribute(String name) {
125: hwssSession.removeAttribute(name);
126:
127: }
128:
129: /**
130: * @see com.nabhinc.ws.server.WebServiceSession#invalidate()
131: */
132: public void invalidate() {
133: hwssSession.invalidate();
134: }
135:
136: /**
137: * @see com.nabhinc.ws.server.WebServiceSession#isNew()
138: */
139: public boolean isNew() {
140: return hwssSession.isNew();
141: }
142:
143: }
|