com.arsdigita.acs.tags
Class MemoizeTag
java.lang.Object
|
+--javax.servlet.jsp.tagext.TagSupport
|
+--javax.servlet.jsp.tagext.BodyTagSupport
|
+--com.arsdigita.acs.tags.MemoizeTag
- All Implemented Interfaces:
- BodyTag, Serializable, Tag
- public class MemoizeTag
- extends BodyTagSupport
- implements BodyTag
A tag wrapper for MemoizeCache. Writes cache lookup to response.
If not found, evaluates tag body and caches it.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
key
String key
val
String val
duration
Integer duration
MemoizeTag
public MemoizeTag()
doStartTag
public int doStartTag()
throws JspException
- At start of tag, try looking up key and see if we have a valid
mapping for it. If we do, write it out to the response. Otherwise
evaluate the body, and save it in the tag.
- Specified by:
doStartTag
in interface Tag
- Overrides:
doStartTag
in class BodyTagSupport
- Following copied from interface:
javax.servlet.jsp.tagext.Tag
- See Also:
BodyTag
doAfterBody
public int doAfterBody()
throws JspException
- Description copied from interface:
BodyTag
- Actions after some body has been evaluated.
Not invoked in empty tags or in tags returning SKIP_BODY in doStartTag()
This method is invoked after every body evaluation.
The pair "BODY -- doAfterBody()" is invoked initially if doStartTag()
returned EVAL_BODY_TAG, and it is repeated as long
as the doAfterBody() evaluation returns EVAL_BODY_TAG
The method re-invocations may be lead to different actions because
there might have been some changes to shared state, or because
of external computation.
- Specified by:
doAfterBody
in interface BodyTag
- Overrides:
doAfterBody
in class BodyTagSupport
doEndTag
public int doEndTag()
throws JspException
- Description copied from interface:
Tag
- Process the end tag. This method will be called on all Tag objects.
- Specified by:
doEndTag
in interface Tag
- Overrides:
doEndTag
in class BodyTagSupport
setKey
public void setKey(String k)
setDuration
public void setDuration(String nSeconds)