ServletListenerRegistrationBean

A ServletContextInitializer to register EventListeners in a Servlet 3.0+ container. Similar to the registration features provided by ServletContext but with a Spring Bean friendly design. This bean can be used to register the following types of listener:

  • ServletContextAttributeListener
  • ServletRequestListener
  • ServletRequestAttributeListener
  • HttpSessionAttributeListener
  • HttpSessionIdListener
  • HttpSessionListener
  • ServletContextListener

Author

Dave Syer

Phillip Webb

Since

1.4.0

Parameters

<T>

the type of listener

Constructors

Link copied to clipboard
constructor()
Create a new ServletListenerRegistrationBean instance.
constructor(listener: T)
Create a new ServletListenerRegistrationBean instance.

Properties

Link copied to clipboard
val HIGHEST_PRECEDENCE: Int = -2147483648
Link copied to clipboard
open var listener: T
Link copied to clipboard
val LOWEST_PRECEDENCE: Int = 2147483647
Link copied to clipboard
open var order: Int

Functions

Link copied to clipboard
open fun getSupportedTypes(): Set<Class<out Any>>
Return the supported types for this registration.
Link copied to clipboard
open fun isEnabled(): Boolean
Return if the registration is enabled.
Link copied to clipboard
Returns true if the specified listener is one of the supported types.
Link copied to clipboard
fun onStartup(servletContext: ServletContext)
Configure the given ServletContext with any servlets, filters, listeners context-params and attributes necessary for initialization.
Link copied to clipboard
open fun setEnabled(enabled: Boolean)
Flag to indicate that the registration is enabled.