Home » apache-tomcat-6.0.26-src » org.apache » catalina » session » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   
   18   
   19   package org.apache.catalina.session;
   20   
   21   
   22   import java.util.Enumeration;
   23   
   24   import javax.servlet.ServletContext;
   25   import javax.servlet.http.HttpSession;
   26   import javax.servlet.http.HttpSessionContext;
   27   
   28   
   29   /**
   30    * Facade for the StandardSession object.
   31    *
   32    * @author Remy Maucherat
   33    * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $
   34    */
   35   
   36   public class StandardSessionFacade
   37       implements HttpSession {
   38   
   39   
   40       // ----------------------------------------------------------- Constructors
   41   
   42   
   43       /**
   44        * Construct a new session facade.
   45        */
   46       public StandardSessionFacade(StandardSession session) {
   47           super();
   48           this.session = (HttpSession) session;
   49       }
   50   
   51   
   52       /**
   53        * Construct a new session facade.
   54        */
   55       public StandardSessionFacade(HttpSession session) {
   56           super();
   57           this.session = session;
   58       }
   59   
   60   
   61       // ----------------------------------------------------- Instance Variables
   62   
   63   
   64       /**
   65        * Wrapped session object.
   66        */
   67       private HttpSession session = null;
   68   
   69   
   70       // ---------------------------------------------------- HttpSession Methods
   71   
   72   
   73       public long getCreationTime() {
   74           return session.getCreationTime();
   75       }
   76   
   77   
   78       public String getId() {
   79           return session.getId();
   80       }
   81   
   82   
   83       public long getLastAccessedTime() {
   84           return session.getLastAccessedTime();
   85       }
   86   
   87   
   88       public ServletContext getServletContext() {
   89           // FIXME : Facade this object ?
   90           return session.getServletContext();
   91       }
   92   
   93   
   94       public void setMaxInactiveInterval(int interval) {
   95           session.setMaxInactiveInterval(interval);
   96       }
   97   
   98   
   99       public int getMaxInactiveInterval() {
  100           return session.getMaxInactiveInterval();
  101       }
  102   
  103   
  104       public HttpSessionContext getSessionContext() {
  105           return session.getSessionContext();
  106       }
  107   
  108   
  109       public Object getAttribute(String name) {
  110           return session.getAttribute(name);
  111       }
  112   
  113   
  114       public Object getValue(String name) {
  115           return session.getAttribute(name);
  116       }
  117   
  118   
  119       public Enumeration getAttributeNames() {
  120           return session.getAttributeNames();
  121       }
  122   
  123   
  124       public String[] getValueNames() {
  125           return session.getValueNames();
  126       }
  127   
  128   
  129       public void setAttribute(String name, Object value) {
  130           session.setAttribute(name, value);
  131       }
  132   
  133   
  134       public void putValue(String name, Object value) {
  135           session.setAttribute(name, value);
  136       }
  137   
  138   
  139       public void removeAttribute(String name) {
  140           session.removeAttribute(name);
  141       }
  142   
  143   
  144       public void removeValue(String name) {
  145           session.removeAttribute(name);
  146       }
  147   
  148   
  149       public void invalidate() {
  150           session.invalidate();
  151       }
  152   
  153   
  154       public boolean isNew() {
  155           return session.isNew();
  156       }
  157   
  158   
  159   }

Home » apache-tomcat-6.0.26-src » org.apache » catalina » session » [javadoc | source]