Class SeoUrlRewriteFilter
- java.lang.Object
-
- org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
-
- fr.paris.lutece.plugins.seo.web.SeoUrlRewriteFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class SeoUrlRewriteFilter extends org.tuckey.web.filters.urlrewrite.UrlRewriteFilterUrlRewriteFilter whose init parameters can be overridden through the configuration API used by lutece-core (MicroProfile Config, exposed byAppPropertiesService).For an init parameter named
xxxdeclared inseo.xml, the configuration propertyseo.urlrewriter.xxxtakes precedence whenever it is defined and not blank. Since the resolution goes through MicroProfile Config, the value may come from a plugin properties file, a system property, an environment variable (SEO_URLREWRITER_XXX) or any other config source registered in the application.The filter is instantiated by reflection by the core FilterService, outside of the CDI container : the programmatic configuration API is used instead of
@ConfigPropertyinjection.The rewrite rules are read from the database rather than from a configuration file. They are a pure derivative of the
seo_ruleandseo_friendly_urltables, so a file would only be a copy of data already persisted, and one local to each node : in a multi node deployment, generating it from the back office wrote it on the node that served the request while the others kept the former rules indefinitely. Every node now builds its rules from the same tables, and reloads them when the version stamped in the datastore changes.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPREFIX_CONFIG_PARAMPrefix of the configuration properties overriding the filter init parameters
-
Constructor Summary
Constructors Constructor Description SeoUrlRewriteFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(javax.servlet.FilterConfig filterConfig)booleanisTimeToReloadConf()The parent returns false as soon as the configuration did not come from a file, which is always the case here, and tracks the interval with a private field.voidreloadConf()The parent compares the last modified date of the configuration file, which no longer exists : the version stamped in the datastore when the rules were last published is compared instead, so a publication from any node is picked up by all of them.
-
-
-
Field Detail
-
PREFIX_CONFIG_PARAM
public static final java.lang.String PREFIX_CONFIG_PARAM
Prefix of the configuration properties overriding the filter init parameters- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Filter- Overrides:
initin classorg.tuckey.web.filters.urlrewrite.UrlRewriteFilter- Throws:
javax.servlet.ServletException
-
isTimeToReloadConf
public boolean isTimeToReloadConf()
The parent returns false as soon as the configuration did not come from a file, which is always the case here, and tracks the interval with a private field. Both are replaced by this filter.Beware of the unit : the parent stores the interval in milliseconds but its getter returns seconds.
- Overrides:
isTimeToReloadConfin classorg.tuckey.web.filters.urlrewrite.UrlRewriteFilter
-
reloadConf
public void reloadConf()
The parent compares the last modified date of the configuration file, which no longer exists : the version stamped in the datastore when the rules were last published is compared instead, so a publication from any node is picked up by all of them.- Overrides:
reloadConfin classorg.tuckey.web.filters.urlrewrite.UrlRewriteFilter
-
-