Coverage Report - org.apache.tapestry.web.ServletWebSession
 
Classes in this File Line Coverage Branch Coverage Complexity
ServletWebSession
0%
0/21
0%
0/2
1.083
 
 1  
 // Copyright 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.web;
 16  
 
 17  
 import java.util.List;
 18  
 
 19  
 import javax.servlet.http.HttpSession;
 20  
 
 21  
 import org.apache.hivemind.util.Defense;
 22  
 import org.apache.tapestry.describe.DescriptionReceiver;
 23  
 
 24  
 /**
 25  
  * Adapts {@link javax.servlet.http.HttpSession}  as
 26  
  * {@link org.apache.tapestry.web.WebSession}.
 27  
  * 
 28  
  * @author Howard M. Lewis Ship
 29  
  * @since 4.0
 30  
  */
 31  
 public class ServletWebSession implements WebSession
 32  
 {
 33  
     private final HttpSession _httpSession;
 34  
 
 35  
     public ServletWebSession(HttpSession session)
 36  0
     {
 37  0
         Defense.notNull(session, "session");
 38  
 
 39  0
         _httpSession = session;
 40  0
     }
 41  
 
 42  
     public void describeTo(DescriptionReceiver receiver)
 43  
     {
 44  0
         receiver.describeAlternate(_httpSession);
 45  0
     }
 46  
 
 47  
     public List getAttributeNames()
 48  
     {
 49  0
         return WebUtils.toSortedList(_httpSession.getAttributeNames());
 50  
     }
 51  
 
 52  
     public Object getAttribute(String name)
 53  
     {
 54  0
         return _httpSession.getAttribute(name);
 55  
     }
 56  
 
 57  
     public void setAttribute(String name, Object attribute)
 58  
     {
 59  0
         if (attribute == null)
 60  0
             _httpSession.removeAttribute(name);
 61  
         else
 62  0
             _httpSession.setAttribute(name, attribute);
 63  0
     }
 64  
 
 65  
     public String getId()
 66  
     {
 67  0
         return _httpSession.getId();
 68  
     }
 69  
 
 70  
     public boolean isNew()
 71  
     {
 72  0
         return _httpSession.isNew();
 73  
     }
 74  
 
 75  
     public void invalidate()
 76  
     {
 77  0
         _httpSession.invalidate();
 78  0
     }
 79  
 
 80  
     /** 
 81  
      * {@inheritDoc}
 82  
      */
 83  
     public long getCreationTime()
 84  
     {
 85  0
         return _httpSession.getCreationTime();
 86  
     }
 87  
 
 88  
     /** 
 89  
      * {@inheritDoc}
 90  
      */
 91  
     public long getLastAccessedTime()
 92  
     {
 93  0
         return _httpSession.getLastAccessedTime();
 94  
     }
 95  
 
 96  
     /** 
 97  
      * {@inheritDoc}
 98  
      */
 99  
     public int getMaxInactiveInterval()
 100  
     {
 101  0
         return _httpSession.getMaxInactiveInterval();
 102  
     }
 103  
 
 104  
     /** 
 105  
      * {@inheritDoc}
 106  
      */
 107  
     public void setMaxInactiveInterval(int interval)
 108  
     {
 109  0
         _httpSession.setMaxInactiveInterval(interval);
 110  0
     }
 111  
 }