001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.servlet;
016    
017    import java.util.Enumeration;
018    
019    import javax.servlet.ServletContext;
020    import javax.servlet.http.HttpSession;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class HttpSessionWrapper implements HttpSession {
026    
027            public HttpSessionWrapper(HttpSession session) {
028                    _session = session;
029            }
030    
031            @Override
032            public Object getAttribute(String name) {
033                    return _session.getAttribute(name);
034            }
035    
036            @Override
037            public Enumeration<String> getAttributeNames() {
038                    return _session.getAttributeNames();
039            }
040    
041            @Override
042            public long getCreationTime() {
043                    return _session.getCreationTime();
044            }
045    
046            @Override
047            public String getId() {
048                    return _session.getId();
049            }
050    
051            @Override
052            public long getLastAccessedTime() {
053                    return _session.getLastAccessedTime();
054            }
055    
056            @Override
057            public int getMaxInactiveInterval() {
058                    return _session.getMaxInactiveInterval();
059            }
060    
061            @Override
062            public ServletContext getServletContext() {
063                    return _session.getServletContext();
064            }
065    
066            /**
067             * @deprecated As of 6.1.0
068             */
069            @Deprecated
070            @Override
071            public javax.servlet.http.HttpSessionContext getSessionContext() {
072                    return _session.getSessionContext();
073            }
074    
075            /**
076             * @deprecated As of 6.1.0
077             */
078            @Deprecated
079            @Override
080            public Object getValue(String name) {
081                    return _session.getValue(name);
082            }
083    
084            /**
085             * @deprecated As of 6.1.0
086             */
087            @Deprecated
088            @Override
089            public String[] getValueNames() {
090                    return _session.getValueNames();
091            }
092    
093            public HttpSession getWrappedSession() {
094                    return _session;
095            }
096    
097            @Override
098            public void invalidate() {
099                    _session.invalidate();
100            }
101    
102            @Override
103            public boolean isNew() {
104                    return _session.isNew();
105            }
106    
107            /**
108             * @deprecated As of 6.1.0
109             */
110            @Deprecated
111            @Override
112            public void putValue(String name, Object value) {
113                    _session.putValue(name, value);
114            }
115    
116            @Override
117            public void removeAttribute(String name) {
118                    _session.removeAttribute(name);
119            }
120    
121            /**
122             * @deprecated As of 6.1.0
123             */
124            @Deprecated
125            @Override
126            public void removeValue(String name) {
127                    _session.removeValue(name);
128            }
129    
130            @Override
131            public void setAttribute(String name, Object value) {
132                    _session.setAttribute(name, value);
133            }
134    
135            @Override
136            public void setMaxInactiveInterval(int interval) {
137                    _session.setMaxInactiveInterval(interval);
138            }
139    
140            private final HttpSession _session;
141    
142    }