Nov 9, 2021 3:37:19 PM Thomas Dumont avatar

Create servlets and filters


Servlets and filters are usually declared in the WEB-INF/web.xml file, but this file is unique and can not be modified by plugins.

In order to offer plugins such components, Lutece proposes to create servlets and plugin filters. These are declared in the xml file of the plugin (located in webapp/WEB-INF/plugins/).

Java classes

Java classes for servlets or filters must be written in exactly the same way as standard servlets or filters. Only their declaration is different.

Existing classes, for example from external products, can be packaged as a servlet or plugin filter (example : the url rewrite filter used by the urlrewriter plugin).

Declaration of servlets and filters

Servlets and filters are to be declared in the plugin's XML file as follows :

<!-- servlets -->

<!-- filters -->
            <param-value>value of param1</param-value>

Servlet URLs must be based on "/servlet/plugins/myplugin"