|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.app.event.implement.EscapeReference
public abstract class EscapeReference
Base class for escaping references. To use it, override the following methods:
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 "Perl5" format used by the ORO regular expression
library. More info is at
http://jakarta.apache.org/oro/api/org/apache/oro/text/perl/package-summary.html.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.velocity.app.event.ReferenceInsertionEventHandler |
---|
ReferenceInsertionEventHandler.referenceInsertExecutor |
Constructor Summary | |
---|---|
EscapeReference()
|
Method Summary | |
---|---|
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(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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EscapeReference()
Method Detail |
---|
protected abstract String escape(Object text)
text
- the text to escape
protected abstract String getMatchAttribute()
eventhandler.escape.XYZ.match
where XYZ
is the type of escaping being done.
public Object referenceInsert(String reference, Object value)
referenceInsert
in interface ReferenceInsertionEventHandler
reference
- value
-
public void setRuntimeServices(RuntimeServices rs)
setRuntimeServices
in interface RuntimeServicesAware
rs
- instance of RuntimeServicesprotected RuntimeServices getRuntimeServices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |