- Httpsessionbindinglistener interface
Definition
public interface Httpsessionbindinglistener
This object is added to the HTTP session, and executing this interface will advertise if there are any objects that are bound to the HTTP session or are unbound from the HTTP session.
Method
1, Valuebound
public void Valuebound (Httpsessionbindingevent event);
This method is called when an object is bound to the session. The servlet engine should call this method when the Httpsession.putvalue method is called.
2, Valueunbound
public void Valueunbound (httpsessionbindingeventevent);
This method is called when an object is unbound from the session. The Servlet engine should call this method when the Httpsession.removevalue method is called.
- Httpsessionbindingevent class
Defined
public class Httpsessionbindingeventextends EventObject
This event is connected Httpsessionbindinglistener when the HttpSession is heard to bind and unbind. This may be a result of a session being terminated or invalidated. The event source is Httpsession.putvalue or httpsession.removevalue.
constructor function
Public Httpsessionbindingevent (HttpSession session, String name);
Constructs a new httpsessionbindingevent by the Session that caused the event and the name of the object in which the binding or unbind occurred.
method
1, GetName
Public String getName ();
Returns the name of the object on which the binding and unbind occurred.
2, GetSession
Public HttpSession getsession ();
Returns the name of the session where the binding and unbind occurred.
Package Javax.servlet.http;public class Httpsessionbindingevent extends httpsessionevent{ private String name; private Object value; Public Httpsessionbindingevent (HttpSession session, String name) { Super (session); this.name = name; } Public Httpsessionbindingevent (HttpSession session, String name, Object value) { Super (session); this.name = name; This.value = value; } Public HttpSession getsession () { return super.getsession (); } Public String getName () { return this.name; } Public Object GetValue () { return this.value; }}
Servlet--httpsessionbindinglistener interface, Httpsessionbindingevent class