Coverage Report - org.webslinger.servlet.HttpSessionData
 
Classes in this File Line Coverage Branch Coverage Complexity
HttpSessionData
60%
12/20
N/A
0
 
 1  
 package org.webslinger.servlet;
 2  
 
 3  
 import java.io.Serializable;
 4  
 import java.util.HashMap;
 5  
 import java.util.Map;
 6  
 import java.util.Set;
 7  
 import javax.servlet.ServletContext;
 8  
 import javax.servlet.http.HttpSession;
 9  
 import javax.servlet.http.HttpSessionContext;
 10  
 
 11  
 public class HttpSessionData implements Serializable {
 12  16
     protected final long creationTime = System.currentTimeMillis();
 13  16
     protected final Map<String, Object> attributes = new HashMap<String, Object>();
 14  
     protected final String id;
 15  
     protected final String remoteAddr;
 16  
     protected boolean isNew;
 17  
 
 18  16
     public HttpSessionData(String id, String remoteAddr) {
 19  16
         this.id = id;
 20  16
         this.remoteAddr = remoteAddr;
 21  16
     }
 22  
 
 23  
     public boolean isNew() {
 24  63
         return isNew;
 25  
     }
 26  
 
 27  
     void sentId() {
 28  0
         isNew = false;
 29  0
     }
 30  
 
 31  
     public String getRemoteAddr() {
 32  0
         return remoteAddr;
 33  
     }
 34  
 
 35  
     // HttpSession methods
 36  
 
 37  
     public Object get(String name) {
 38  56
         return attributes.get(name);
 39  
     }
 40  
 
 41  
     public Set<String> getNameSet() {
 42  0
         return attributes.keySet();
 43  
     }
 44  
 
 45  
     public long getCreationTime() {
 46  0
         return creationTime;
 47  
     }
 48  
 
 49  
     public String getId() {
 50  0
         return id;
 51  
     }
 52  
 
 53  
     public void invalidate() {
 54  6
         attributes.clear();
 55  6
     }
 56  
 
 57  
     public void remove(String name) {
 58  0
         attributes.remove(name);
 59  0
     }
 60  
 
 61  
     public void put(String name, Object value) {
 62  18
         attributes.put(name, value);
 63  18
     }
 64  
 }