org.beanlet.web
Annotation Type WebListener


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface WebListener

The annotation used to declare a listener for various types of event, in a given web application context. This feature is only supported for Servlet API 3.0 and onwards.

The class annotated MUST implement one, (or more), of the following interfaces: HttpSessionAttributeListener, HttpSessionListener, ServletContextAttributeListener, ServletContextListener, ServletRequestAttributeListener, ServletRequestListener

E.g. @WebListener
public TestListener implements ServletContextListener {

XML Representation

The following xml-fragment shows how to express this annotation in xml. The 'web-listener' tag does not specify any element attribute, which means that this tag is applied to the beanlet's class. The attributes can be specified optionally if the annotation specifies a default value for the particular annotation methods.
<beanlets xmlns="http://beanlet.org/schema/beanlet"
          xmlns:web="http://beanlet.org/schema/web"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://beanlet.org/schema/beanlet http://beanlet.org/schema/beanlet/beanlet_1_0.xsd
                              http://beanlet.org/schema/web http://beanlet.org/schema/web/beanlet_web_1_0.xsd">
  <beanlet name="foo" type="com.acme.Foo">
    <web:web-listener create-listener="false" value=""/>
  </beanlet>
</beanlets>

See Also:
ScopeAnnotation

Optional Element Summary
 boolean createListener
           
 String value
           
 

createListener

public abstract boolean createListener
Returns:
true if instance is created by Servlet container.
Default:
false

value

public abstract String value
Returns:
description of the listener, if present
Default:
""


Copyright © 2006-2012. All Rights Reserved.