1 package com.quadcap.http.servlets.jsp; 2 3 40 41 import java.util.Enumeration ; 42 43 import javax.servlet.http.HttpServletRequest ; 44 import javax.servlet.http.HttpSession ; 45 import javax.servlet.http.HttpSessionContext ; 46 47 52 public class JspSession implements HttpSession { 53 HttpServletRequest req; 54 HttpSession session = null; 55 56 public JspSession(HttpServletRequest req) { 57 this.req = req; 58 } 59 60 final HttpSession getSession() { 61 if (session == null) session = req.getSession(); 62 return session; 63 } 64 65 public long getCreationTime() { 66 return getSession().getCreationTime(); 67 } 68 69 public String getId() { 70 return getSession().getId(); 71 } 72 73 public long getLastAccessedTime() { 74 return getSession().getLastAccessedTime(); 75 } 76 77 public void setMaxInactiveInterval(int ivl) { 78 getSession().setMaxInactiveInterval(ivl); 79 } 80 81 public int getMaxInactiveInterval() { 82 return getSession().getMaxInactiveInterval(); 83 } 84 85 public HttpSessionContext getSessionContext() { 86 return getSession().getSessionContext(); 87 } 88 89 public Object getAttribute(String name) { 90 return getSession().getAttribute(name); 91 } 92 93 public Object getValue(String name) { 94 return getSession().getValue(name); 95 } 96 97 public Enumeration getAttributeNames() { 98 return getSession().getAttributeNames(); 99 } 100 101 public String [] getValueNames() { 102 return getSession().getValueNames(); 103 } 104 105 public void setAttribute(String name, Object val) { 106 getSession().setAttribute(name, val); 107 } 108 109 public void putValue(String name, Object val) { 110 getSession().putValue(name, val); 111 } 112 113 public void removeAttribute(String name) { 114 getSession().removeAttribute(name); 115 } 116 117 public void removeValue(String name) { 118 getSession().removeValue(name); 119 } 120 121 public void invalidate() { 122 getSession().invalidate(); 123 } 124 125 public boolean isNew() { 126 return getSession().isNew(); 127 } 128 129 } 130 | Popular Tags |