Java-ServletRequestListener-ServletRequestAttributeListener

时间:2022-04-22 16:07:01
   /**
     * A ServletRequestListener can be implemented by the developer
     * interested in being notified of requests coming in and out of
     * scope in a web component. A request is defined as coming into
     * scope when it is about to enter the first servlet or filter
     * in each web application, as going out of scope when it exits
     * the last servlet or the first filter in the chain.
     *
     * @since Servlet 2.4
     */

//Servlet请求监听器,开发者可以实现这个接口来监听请求进入或者离开web应用
public interface ServletRequestListener extends EventListener {

    /** The request is about to go out of scope of the web application. */
	//Request销毁监听
    public void requestDestroyed ( ServletRequestEvent sre );

    /** The request is about to come into scope of the web application. */
    //Request初始化监听
    public void requestInitialized ( ServletRequestEvent sre );
}
  /**
     * A ServletRequestAttributeListener can be implemented by the
     * developer interested in being notified of request attribute
     * changes. Notifications will be generated while the request
     * is within the scope of the web application in which the listener
     * is registered. A request is defined as coming into scope when
     * it is about to enter the first servlet or filter in each web
     * application, as going out of scope when it exits the last servlet
     * or the first filter in the chain.
     *
     * @since Servlet 2.4
     */
//servlet 请求参数监听器,开发者可以实现这个接口来通知属性的改变
public interface ServletRequestAttributeListener extends EventListener {
    /** Notification that a new attribute was added to the
     ** servlet request. Called after the attribute is added.
     */
	//属性添加监听
    public void attributeAdded(ServletRequestAttributeEvent srae);

    /** Notification that an existing attribute has been removed from the
     ** servlet request. Called after the attribute is removed.
     */
    //属性删除监听
    public void attributeRemoved(ServletRequestAttributeEvent srae);

    /** Notification that an attribute was replaced on the
     ** servlet request. Called after the attribute is replaced.
     */
    //属性替代监听
    public void attributeReplaced(ServletRequestAttributeEvent srae);
}