1 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 31 public class ServletWebSession implements WebSession 32 { 33 private final HttpSession _httpSession; 34 35 public ServletWebSession(HttpSession session) 36 { 37 Defense.notNull(session, "session"); 38 39 _httpSession = session; 40 } 41 42 public void describeTo(DescriptionReceiver receiver) 43 { 44 receiver.describeAlternate(_httpSession); 45 } 46 47 public List getAttributeNames() 48 { 49 return WebUtils.toSortedList(_httpSession.getAttributeNames()); 50 } 51 52 public Object getAttribute(String name) 53 { 54 return _httpSession.getAttribute(name); 55 } 56 57 public void setAttribute(String name, Object attribute) 58 { 59 if (attribute == null) 60 _httpSession.removeAttribute(name); 61 else 62 _httpSession.setAttribute(name, attribute); 63 } 64 65 public String getId() 66 { 67 return _httpSession.getId(); 68 } 69 70 public boolean isNew() 71 { 72 return _httpSession.isNew(); 73 } 74 } | Popular Tags |