|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.handler.HtmlRewriter
sunlabs.brazil.template.RewriteContext (view source)
public class RewriteContext
A variant containing instance variables that may be referenced by
rewriting filters. Every implementation of the template class
may define methods of the form:
tag_xxx
or
tag_slash_xxx
which will get called when the corrosponding HTML entity
<xxx ...>
or
</xxx ...>
is found in the content being filtered.
An instance of this class is passed to each tag
method, permitting introspection of the current filtering context.
Field Summary | |
---|---|
String |
prefix
The prefix to use for locating keys in the server or request properties objects. |
Request |
request
The Request object, as passed to a handler's respond method. |
Server |
server
The server object, as passed to a handler's init method. |
String |
sessionId
A unique session id, if available. |
String |
templatePrefix
This is the prefix defined by the invoker of a set of templates. |
Fields inherited from class sunlabs.brazil.handler.HtmlRewriter |
---|
lex, sb |
Constructor Summary | |
---|---|
RewriteContext(Server server,
String prefix,
Request request,
String content,
String sessionId,
TemplateRunner runner,
Vector templates)
|
Method Summary | |
---|---|
void |
abort()
Cause this RewriteContext to abort its processing. |
void |
addClosingTag(String tag)
Add a closing tag to the list of tags that mark un-interpreted text Deal with the tag prefix, if any |
boolean |
checkRewriteState(int state)
Check whether this RewriteContext is in the specified state. |
void |
decrNestingLevel()
Decrement the nesting level counter. |
String |
get(String name)
overwrite "get" to automatically do ${...} substitutions The default is "true". |
String |
get(String name,
boolean subst)
Get an attribute value, and optionally perform ${...} substitutions. |
String |
get(String name,
String dflt)
Get a tag attribute, with a default value. |
Properties |
getNamespaceProperties()
Get the proper properties table based on the "namespace" attribute. |
int |
getNestingLevel()
Return the current nesting level counter. |
void |
incrNestingLevel()
Increment the nesting level counter. |
boolean |
isClosingFor(String tag)
See if the current token is the closing tag for the given string. |
boolean |
isClosingFor(String tag,
boolean close)
See if the current token is the closing tag for the given string. |
boolean |
isTrue(String name)
Determine the value of a boolean attribute in the current tag. |
void |
process()
Invoke a template on this token, if any template is interested in this token. |
boolean |
setRewriteState(int state)
Set the given state of this RewriteContext. |
String |
snarfTillClose()
Grab all the markup between the current tag, and the corrosponding closing tag. |
void |
substAttributeValues()
Substitute all attribute values. |
int |
tagsSeen()
Return the number of HTML tags seen to this point. |
Template |
templateFromTag(String tag)
Get the template that will process the supplied tag (if any). |
void |
unsetRewriteState(int state)
Unset the given state of this RewriteContext. |
Methods inherited from class sunlabs.brazil.handler.HtmlRewriter |
---|
accumulate, append, appendToken, getArgs, getBody, getMap, getTag, getToken, getType, isSingleton, keys, killToken, nextTag, nextToken, pushback, put, quote, remove, reset, setSingleton, setTag, setType, tagCount, tokenCount, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Server server
public String prefix
public String templatePrefix
public Request request
public String sessionId
Constructor Detail |
---|
public RewriteContext(Server server, String prefix, Request request, String content, String sessionId, TemplateRunner runner, Vector templates)
Method Detail |
---|
public void abort()
public boolean setRewriteState(int state)
public void unsetRewriteState(int state)
public boolean checkRewriteState(int state)
public void incrNestingLevel()
public void decrNestingLevel()
public int getNestingLevel()
public void process()
public int tagsSeen()
public String get(String name)
get
in class HtmlRewriter
name
- The key to lookup in the current tag's attributes.
null
if the key was not in the attributes.LexML.getAttributes()
public String get(String name, boolean subst)
public String get(String name, String dflt)
dflt
is used instead.
name
- The name of the attribute to look updflt
- The default attribute value (may be null)
public boolean isTrue(String name)
name
- The name of the boolean attribute
public boolean isClosingFor(String tag)
tag
- tag whose match ( e.g. /[prefix]tag is to be found
public boolean isClosingFor(String tag, boolean close)
tag
- tag whose match ( e.g. /[prefix]tag is to be foundclose
- if set, "tag" matches "/[prefix]tag", otherwise
tag matches "[prefix]tag".
public String snarfTillClose()
public void addClosingTag(String tag)
public Properties getNamespaceProperties()
public Template templateFromTag(String tag)
tag
- the name of the html tag that will get processed
public void substAttributeValues()
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |