1 16 17 package org.apache.tester.shared; 18 19 20 import java.io.Serializable ; 21 import java.sql.Date ; 22 import javax.servlet.http.HttpSessionActivationListener ; 23 import javax.servlet.http.HttpSessionBindingEvent ; 24 import javax.servlet.http.HttpSessionBindingListener ; 25 import javax.servlet.http.HttpSessionEvent ; 26 27 28 39 40 public class SharedSessionBean implements 41 HttpSessionActivationListener , HttpSessionBindingListener , Serializable { 42 43 44 46 47 50 protected Date dateProperty = 51 new Date (System.currentTimeMillis()); 52 53 public Date getDateProperty() { 54 return (this.dateProperty); 55 } 56 57 public void setDateProperty(Date dateProperty) { 58 this.dateProperty = dateProperty; 59 } 60 61 62 65 protected String lifecycle = ""; 66 67 public String getLifecycle() { 68 return (this.lifecycle); 69 } 70 71 public void setLifecycle(String lifecycle) { 72 this.lifecycle = lifecycle; 73 } 74 75 76 79 protected String stringProperty = "Default String Property Value"; 80 81 public String getStringProperty() { 82 return (this.stringProperty); 83 } 84 85 public void setStringProperty(String stringProperty) { 86 this.stringProperty = stringProperty; 87 } 88 89 90 92 93 96 public String toString() { 97 98 StringBuffer sb = new StringBuffer ("SharedSessionBean[lifecycle="); 99 sb.append(this.lifecycle); 100 sb.append(",dateProperty="); 101 sb.append(dateProperty); 102 sb.append(",stringProperty="); 103 sb.append(this.stringProperty); 104 sb.append("]"); 105 return (sb.toString()); 106 107 } 108 109 110 112 113 118 public void sessionDidActivate(HttpSessionEvent event) { 119 120 lifecycle += "/sda"; 121 122 } 123 124 125 130 public void sessionWillPassivate(HttpSessionEvent event) { 131 132 lifecycle += "/swp"; 133 134 } 135 136 137 139 140 145 public void valueBound(HttpSessionBindingEvent event) { 146 147 lifecycle += "/vb"; 148 149 } 150 151 152 157 public void valueUnbound(HttpSessionBindingEvent event) { 158 159 lifecycle += "/vu"; 160 161 } 162 163 164 } 165 166 | Popular Tags |