1 17 18 package org.objectweb.jac.aspects.gui.web; 19 20 import java.util.Stack ; 21 22 27 28 public class Session implements java.io.Serializable { 29 30 31 transient protected Stack requests = new Stack (); 32 33 34 protected String sid; 35 36 38 39 public Session(String sid) { 40 this.sid = sid; 41 } 42 43 47 48 public String getId() { 49 return sid; 50 } 51 52 59 60 public Stack getRequests() { 61 return requests; 62 } 63 64 69 70 public int getRequestCount() { 71 return requests.size(); 72 } 73 74 82 83 public void newRequest(Request request) { 84 getRequests().push(request); 85 } 86 87 92 93 public Request getCurrentRequest() { 94 return (Request)getRequests().peek(); 95 } 96 97 103 104 public Request getPreviousRequest() { 105 Request prevRequest = null; 106 if (requests.size() > 1) { 107 prevRequest = (Request)requests.get(requests.size()-2); 108 } 109 return prevRequest; 110 } 111 112 117 118 public Request endCurrentRequest() { 119 return (Request)getRequests().pop(); 120 } 121 122 125 126 public String toString() { 127 return "session " + sid + ", requests stack = " + requests; 128 } 129 130 } 131 | Popular Tags |