Class RuleFileService
java.lang.Object
fr.paris.lutece.plugins.seo.service.RuleFileService
Builds the URL rewriting rules from the database, and publishes them so that every node reloads them.
The rules used to be written to a file read by the rewrite filter. They are a pure derivative of the
seo_rule and seo_friendly_url tables, so that file was a copy of data already persisted, and
one local to each node. The filter now builds its configuration from getRulesXml(), and
publishRules() only stamps a new version in the datastore.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringRenders the rewrite rules held in the database as the XML configuration expected by the rewrite filter.static booleanPublishes the rules held in the database : checks that they form a configuration the rewrite filter accepts, then stamps a new version, which every node compares to the one it has loaded, and records the log shown in the back office.
-
Method Details
-
publishRules
public static boolean publishRules()Publishes the rules held in the database : checks that they form a configuration the rewrite filter accepts, then stamps a new version, which every node compares to the one it has loaded, and records the log shown in the back office.The check is what the administrator gets as feedback. A rule holding an invalid regular expression used to break the rewriting silently, the failure only appearing in the log of each node at the next reload : nothing is published unless the rules parse.
- Returns:
truewhen the rules were published,falsewhen they were rejected
-
getRulesXml
Renders the rewrite rules held in the database as the XML configuration expected by the rewrite filter. Free of any side effect : the filter calls it on every reload.- Returns:
- The rules, as an urlrewrite configuration document
-