public abstract class EscapeReference extends Object implements ReferenceInsertionEventHandler, RuntimeServicesAware
String escape(String text)
String getMatchAttribute()
By default, all references are escaped. However, by setting the match attribute
in the configuration file to a regular expression, users can specify which references
to escape. For example the following configuration property tells the EscapeSqlReference
event handler to only escape references that start with "sql".
(e.g. $sql
, $sql.toString(),
, etc).
eventhandler.escape.sql.match = sql.*
Regular expressions should follow the format used by the Java language. More info in the
Pattern class documentation.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
EscapeReference() |
Modifier and Type | Method and Description |
---|---|
protected abstract String |
escape(Object text)
Escape the given text.
|
protected abstract String |
getMatchAttribute()
Specify the configuration attribute that specifies the
regular expression.
|
protected RuntimeServices |
getRuntimeServices()
Retrieve a reference to RuntimeServices.
|
Object |
referenceInsert(Context context,
String reference,
Object value)
Escape the provided text if it matches the configured regular expression.
|
void |
setRuntimeServices(RuntimeServices rs)
Called automatically when event cartridge is initialized.
|
protected abstract String escape(Object text)
text
- the text to escapeprotected abstract String getMatchAttribute()
eventhandler.escape.XYZ.match
where XYZ
is the type of escaping being done.
public Object referenceInsert(Context context, String reference, Object value)
referenceInsert
in interface ReferenceInsertionEventHandler
reference
- value
- context
- current contextpublic void setRuntimeServices(RuntimeServices rs)
setRuntimeServices
in interface RuntimeServicesAware
rs
- instance of RuntimeServicesprotected RuntimeServices getRuntimeServices()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.