Servlet, Filters and Listeners

Servlets, filters and listeners can be detected and registered by SeedStack which makes them injectable and interceptable.

You can register a servlet by annotating your servlet class with @WebServlet:

public class MyServlet extends HttpServlet {

Similarly, you can register a filter by annotating your filter class with @WebFilter:

public class MyFilter implements Filter {

Also, you can register a listener by annotating your listener class with @WebListener

public class MyListener implements ServletContextListener {

Any class annotated with WebListener must implement one or more of the ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, HttpSessionListener, HttpSessionAttributeListener or HttpSessionIdListener interfaces.

If you are running in a Web container also scanning those annotations, you need to disable the server detection to avoid getting an exception for duplicate registration.


On this page