Servlet--httpsessionbindinglistener interface, Httpsessionbindingevent class

Source: Internet
Author: User

    • 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.