@Override
  public void valueUnbound(HttpSessionBindingEvent httpSessionBindingEvent) {
    if (_httpSessionBindingListeners == null) {
      return;
    }

    for (HttpSessionBindingListener httpSessionBindingListener : _httpSessionBindingListeners) {

      httpSessionBindingListener.valueUnbound(httpSessionBindingEvent);
    }
  }
Exemplo n.º 2
0
 public void invokeDestructionCallback() {
   LogFactory.getLog(getClass())
       .info(
           "#### invokeDestructionCallback() "
               + getBeanName()
               + " "
               + scope.getConversationId());
   HttpSessionBindingListener listener =
       (HttpSessionBindingListener) scope.getDestructionCallback(getBeanName());
   listener.valueUnbound(null); // cause unbound
 }
Exemplo n.º 3
0
  public void removeAttribute(@Nonnull final String sName) {
    ValueEnforcer.notNull(sName, "Name");

    final Object aValue = m_aAttributes.remove(sName);
    if (aValue instanceof HttpSessionBindingListener)
      ((HttpSessionBindingListener) aValue)
          .valueUnbound(new HttpSessionBindingEvent(this, sName, aValue));
  }
Exemplo n.º 4
0
 /** Clear all of this session's attributes. */
 public void clearAttributes() {
   for (final Map.Entry<String, Object> entry : m_aAttributes.entrySet()) {
     final String sName = entry.getKey();
     final Object aValue = entry.getValue();
     if (aValue instanceof HttpSessionBindingListener)
       ((HttpSessionBindingListener) aValue)
           .valueUnbound(new HttpSessionBindingEvent(this, sName, aValue));
   }
   m_aAttributes.clear();
 }
Exemplo n.º 5
0
  public void setAttribute(@Nonnull final String sName, @Nullable final Object aValue) {
    ValueEnforcer.notNull(sName, "Name");

    if (aValue != null) {
      m_aAttributes.put(sName, aValue);
      if (aValue instanceof HttpSessionBindingListener)
        ((HttpSessionBindingListener) aValue)
            .valueBound(new HttpSessionBindingEvent(this, sName, aValue));
    } else {
      removeAttribute(sName);
    }
  }
Exemplo n.º 6
0
 /**
  * Serialize the attributes of this session into an object that can be turned into a byte array
  * with standard Java serialization.
  *
  * @return a representation of this session's serialized state
  */
 @Nonnull
 public Serializable serializeState() {
   final HashMap<String, Object> aState = new HashMap<String, Object>();
   for (final Map.Entry<String, Object> entry : m_aAttributes.entrySet()) {
     final String sName = entry.getKey();
     final Object aValue = entry.getValue();
     if (aValue instanceof Serializable) {
       aState.put(sName, aValue);
     } else {
       // Not serializable... Servlet containers usually automatically
       // unbind the attribute in this case.
       if (aValue instanceof HttpSessionBindingListener) {
         ((HttpSessionBindingListener) aValue)
             .valueUnbound(new HttpSessionBindingEvent(this, sName, aValue));
       }
     }
   }
   m_aAttributes.clear();
   return aState;
 }
Exemplo n.º 7
0
 private synchronized void callValueUnboundMethod(String key, Object value) {
   if (value instanceof HttpSessionBindingListener) {
     HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, key, value);
     ((HttpSessionBindingListener) value).valueUnbound(event);
   }
 }