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

Field Summary
(package private)  Integer duration
           
(package private)  String key
           
(package private)  String val
           
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
MemoizeTag()
           
 
Method Summary
 int doAfterBody()
          Actions after some body has been evaluated.
 int doEndTag()
          Process the end tag.
 int doStartTag()
          At start of tag, try looking up key and see if we have a valid mapping for it.
 void setDuration(String nSeconds)
           
 void setKey(String k)
           
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.BodyTag
doInitBody, setBodyContent
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, release, setPageContext, setParent
 

Field Detail

key

String key

val

String val

duration

Integer duration
Constructor Detail

MemoizeTag

public MemoizeTag()
Method Detail

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)