Class SeoUrlRewriteFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
AppPropertiesService).
For an init parameter named xxx declared in seo.xml, the configuration property
seo.urlrewriter.xxx takes 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 @ConfigProperty injection.
The rewrite rules are read from the database rather than from a configuration file. They are a pure derivative of the
seo_rule and seo_friendly_url tables, 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
FieldsModifier and TypeFieldDescriptionstatic final StringPrefix of the configuration properties overriding the filter init parametersFields inherited from class org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
DEFAULT_MOD_REWRITE_STYLE_CONF_PATH, DEFAULT_WEB_CONF_PATH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit(jakarta.servlet.FilterConfig filterConfig) booleanThe 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.voidThe 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.Methods inherited from class org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
destroy, destroyActual, doFilter, getConfReloadCheckInterval, getConfReloadLastCheck, getFullVersionString, getStatusPath, isConfReloadCheckEnabled, isLoaded, isStatusEnabled
-
Field Details
-
PREFIX_CONFIG_PARAM
Prefix of the configuration properties overriding the filter init parameters- See Also:
-
-
Constructor Details
-
SeoUrlRewriteFilter
public SeoUrlRewriteFilter()
-
-
Method Details
-
init
public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Filter- Overrides:
initin classorg.tuckey.web.filters.urlrewrite.UrlRewriteFilter- Throws:
jakarta.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
-