Author: fhanik
Date: Mon May 8 10:22:55 2006
New Revision: 405097
URL: http://svn.apache.org/viewcvs?rev=405097&view=rev
Log:
Make the StandardSession extensible by allowing control whether the listeners
should be notified
by a setAttribute command.
Modified:
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java
Modified:
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java?rev=405097&r1=405096&r2=405097&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java
(original)
+++
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java
Mon May 8 10:22:55 2006
@@ -1230,6 +1230,10 @@
* invalidated session
*/
public void setAttribute(String name, Object value) {
+ setAttribute(name,value,true);
+ }
+
+ public void setAttribute(String name, Object value, boolean notify) {
// Name cannot be null
if (name == null)
@@ -1255,7 +1259,7 @@
HttpSessionBindingEvent event = null;
// Call the valueBound() method if necessary
- if (value instanceof HttpSessionBindingListener) {
+ if (value instanceof HttpSessionBindingListener && notify) {
// Don't call any notification if replacing with the same value
Object oldValue = attributes.get(name);
if (value != oldValue) {
@@ -1274,7 +1278,7 @@
// Call the valueUnbound() method if necessary
if ((unbound != null) && (unbound != value) &&
- (unbound instanceof HttpSessionBindingListener)) {
+ (unbound instanceof HttpSessionBindingListener) && notify) {
try {
((HttpSessionBindingListener) unbound).valueUnbound
(new HttpSessionBindingEvent(getSession(), name));
@@ -1283,6 +1287,8 @@
(sm.getString("standardSession.bindingEvent"), t);
}
}
+
+ if ( !notify ) return;
// Notify interested application event listeners
Context context = (Context) manager.getContainer();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]