1 55 56 package org.jboss.axis.transport.http; 57 58 import org.jboss.axis.session.Session; 59 60 import javax.servlet.http.HttpServletRequest ; 61 import javax.servlet.http.HttpSession ; 62 import java.util.Enumeration ; 63 64 69 public class AxisHttpSession implements Session 70 { 71 private HttpSession rep; 72 private HttpServletRequest req; 73 74 public AxisHttpSession(HttpServletRequest realRequest) 75 { 76 req = realRequest; 77 } 78 79 public AxisHttpSession(HttpSession realSession) 80 { 81 rep = realSession; 82 } 83 84 87 public HttpSession getRep() 88 { 89 ensureSession(); 90 return rep; 91 } 92 93 98 public void setRep(HttpSession realSession) 99 { 100 rep = realSession; 101 } 102 103 108 public Object get(String key) 109 { 110 ensureSession(); 111 return rep.getAttribute(key); 112 } 113 114 120 public void set(String key, Object value) 121 { 122 ensureSession(); 123 rep.setAttribute(key, value); 124 } 125 126 131 public void remove(String key) 132 { 133 ensureSession(); 134 rep.removeAttribute(key); 135 } 136 137 140 public Enumeration getKeys() 141 { 142 ensureSession(); 143 return rep.getAttributeNames(); 144 } 145 146 153 public void setTimeout(int timeout) 154 { 155 ensureSession(); 156 rep.setMaxInactiveInterval(timeout); 157 } 158 159 164 public int getTimeout() 165 { 166 ensureSession(); 167 return rep.getMaxInactiveInterval(); 168 } 169 170 173 public void touch() 174 { 175 } 177 178 protected void ensureSession() 179 { 180 if (rep == null) 181 { 182 rep = req.getSession(); 183 } 184 } 185 186 194 public Object getLockObject() 195 { 196 ensureSession(); 197 return rep; 198 } 199 } 200 | Popular Tags |