Example usage for javax.servlet.http HttpSessionBindingEvent getSession

List of usage examples for javax.servlet.http HttpSessionBindingEvent getSession

Introduction

In this page you can find the example usage for javax.servlet.http HttpSessionBindingEvent getSession.

Prototype

@Override
public HttpSession getSession() 

Source Link

Document

Return the session that changed.

Usage

From source file:SessionBindListen.java

public void valueBound(HttpSessionBindingEvent be) {

    HttpSession session = be.getSession();
    String id = session.getId();//from   w  w  w.  j a  v  a  2  s  .  com
    String name = be.getName();
    Object value = be.getValue();
    String source = be.getSource().getClass().getName();
    String message = new StringBuffer("Attribute bound to session in ").append(source)
            .append("\nThe attribute name: ").append(name).append("\n").append("The attribute value: ")
            .append(value).append("\n").append("The session id: ").append(id).toString();

    System.out.println(message);
}

From source file:SessionBindListen.java

public void valueUnbound(HttpSessionBindingEvent be) {

    HttpSession session = be.getSession();
    String id = session.getId();/*w  w w.j  a  va2 s  .  com*/
    String name = be.getName();
    if (name == null)
        name = "Unknown";
    String source = be.getSource().getClass().getName();
    String message = new StringBuffer("Attribute unbound from session in ").append(source)
            .append("\nThe attribute name: ").append(name).append("\n").append("The session id: ").append(id)
            .toString();
    //clear Map; send message
    info.clear();
    System.out.println(message + "\nThe size of the HashMap is: " + info.size());
}

From source file:MyServlet.java

public void valueBound(HttpSessionBindingEvent event) {
    context.log("[" + new Date() + "] BOUND as " + event.getName() + " to " + event.getSession().getId());
}

From source file:MyServlet.java

public void valueUnbound(HttpSessionBindingEvent event) {
    context.log("[" + new Date() + "] UNBOUND as " + event.getName() + " from " + event.getSession().getId());
}

From source file:com.liusoft.dlog4j.SessionUserObject.java

/**
 * ?session_id?????session_id//  ww w.  j  a v  a  2 s  . c  om
 */
public void valueBound(HttpSessionBindingEvent e) {
    this.sessionId = e.getSession().getId();
}

From source file:Binder.java

public void valueBound(HttpSessionBindingEvent event) {
    context.log("" + (new java.util.Date()) + " Binding " + event.getName() + " to session "
            + event.getSession().getId());
}

From source file:Binder.java

public void valueUnbound(HttpSessionBindingEvent event) {
    context.log("" + (new java.util.Date()) + " Unbinding " + event.getName() + " from session "
            + event.getSession().getId());
}

From source file:MyServlet.java

/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event The session attribute event
 *//*from  w w  w .j  av a  2 s  .co  m*/
public void attributeAdded(HttpSessionBindingEvent event) {

    log("attributeAdded('" + event.getSession().getId() + "', '" + event.getName() + "', '" + event.getValue()
            + "')");

}

From source file:MyServlet.java

/**
 * Record the fact that a servlet context attribute was removed.
 *
 * @param event The session attribute event
 *///from w  ww . j  ava2  s  . c  o  m
public void attributeRemoved(HttpSessionBindingEvent event) {

    log("attributeRemoved('" + event.getSession().getId() + "', '" + event.getName() + "', '" + event.getValue()
            + "')");

}

From source file:MyServlet.java

/**
 * Record the fact that a servlet context attribute was replaced.
 *
 * @param event The session attribute event
 *//*from  ww w  . j  a  va  2s.c  om*/
public void attributeReplaced(HttpSessionBindingEvent event) {

    log("attributeReplaced('" + event.getSession().getId() + "', '" + event.getName() + "', '"
            + event.getValue() + "')");

}