public class ConfigDefinitionsWatchdogFilter extends Object implements org.apache.commons.chain.Command
This is the timing mechanism for looking for modified Clay templates and configuration files. This is a preprocess filter chains command that should only be used in the development environment.
Constructor and Description |
---|
ConfigDefinitionsWatchdogFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
accept(org.apache.commons.chain.Context context)
Trigger reloading of the
Clay 's
xml configuration files if the
org.apache.shale.clay.AUTO_RELOAD_CONFIG_FILES init
parameter is set to true in the web.xml. |
boolean |
execute(org.apache.commons.chain.Context context)
Perform the matching algorithm against the value
returned by the
value() method. |
String |
getIncludes() |
protected boolean |
matches(String expr,
Pattern[] patterns,
boolean unrestricted)
Match the specified expression against the specified precompiled
patterns.
|
void |
setIncludes(String includes)
Set the comma-delimited regular expression patterns to include
remote host names that match, if any; or
null for no
restrictions. |
protected String |
value(org.apache.commons.chain.Context context)
Return the servlet path (if any) concatenated with the path info
(if any) for this request.
|
public String getIncludes()
null
.public void setIncludes(String includes)
Set the comma-delimited regular expression patterns to include
remote host names that match, if any; or null
for no
restrictions.
includes
- New include pattern(s)protected String value(org.apache.commons.chain.Context context)
Return the servlet path (if any) concatenated with the path info (if any) for this request.
context
- Context
for the current requestpublic boolean execute(org.apache.commons.chain.Context context) throws Exception
Perform the matching algorithm against the value
returned by the value()
method. If the
value matches()
the includes
pattern list, the Clay
configuration files are checked for changes and reloaded.
execute
in interface org.apache.commons.chain.Command
context
- ShaleWebContext
for this requesttrue
if the chain is doneException
- thrown back to the calling commandprotected void accept(org.apache.commons.chain.Context context) throws Exception
Trigger reloading of the Clay
's
xml configuration files if the
org.apache.shale.clay.AUTO_RELOAD_CONFIG_FILES
init
parameter is set to true
in the web.xml. The HTML templates
are re-cashed on-demand due to their atomicity. The XML configuration
files are shared by all Clay
view composition mechanisms so all files must be reloaded if a change
is made.
context
- Context
for the current requestException
- thrown back to the callerprotected boolean matches(String expr, Pattern[] patterns, boolean unrestricted)
Match the specified expression against the specified precompiled
patterns. If there are no patterns, return the specified unrestricted
return value; otherwise, return true
if the expression
matches one of the patterns, or false
otherwise.
expr
- Expression to be testedpatterns
- Array of Pattern
to be tested againstunrestricted
- Result to be returned if there are no matchestrue
if a match is foundCopyright © 2004-2013 Apache Software Foundation. All Rights Reserved.