org.apache.tiles.jsp.taglib
Class RenderTagSupport

Package class diagram package RenderTagSupport
java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.tiles.jsp.taglib.RenderTagSupport
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, PutAttributeTagParent, PutListAttributeTagParent
Direct Known Subclasses:
InsertAttributeTag, InsertTemplateTag

public abstract class RenderTagSupport
extends javax.servlet.jsp.tagext.BodyTagSupport
implements PutAttributeTagParent, PutListAttributeTagParent

Support for all tags which render (an attribute, a template, or definition).

Properly invokes the defined preparer and invokes the abstract render method upon completion.

This tag takes special care to ensure that the attribute context is reset to it's original state after the execution of the tag is complete. This ensures that all all included attributes in subsequent tiles are scoped properly and do not bleed outside their intended scope.

Since:
Tiles 2.0
See Also:
Serialized Form

Field Summary
protected  AttributeContext attributeContext
          The attribute context to use to store and read attribute values.
protected  TilesContainer container
          The Tiles container that can be used inside the tag.
protected  boolean flush
          This flag, if true, flushes the content before rendering.
protected  boolean ignore
          This flag, if true, ignores exception thrown by preparers and those caused by problems with definitions.
protected  java.lang.String preparer
          The view preparer to use before the rendering.
protected  java.lang.String role
          The role to check.
 
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_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
RenderTagSupport()
           
 
Method Summary
 int doEndTag()
          
 int doStartTag()
          
protected  void endContext(javax.servlet.jsp.PageContext context)
          Ends the context when exiting the tag.
protected  void execute()
          Deprecated. Use render().
 java.lang.String getPreparer()
          Returns the preparer name.
 java.lang.String getRole()
          Returns the role to check.
protected  boolean isAccessAllowed()
          Deprecated. Implement access allowance in your own tag.
 boolean isFlush()
          Returns the flush flag.
 boolean isIgnore()
          Returns the ignore flag.
 void processNestedTag(PutAttributeTag nestedTag)
           Process nested ≶put> tag.
 void processNestedTag(PutListAttributeTag nestedTag)
          Process the nested tag.
 void release()
          
protected abstract  void render()
          Render the specified content.
 void setFlush(boolean flush)
          Sets the flush flag.
 void setIgnore(boolean ignore)
          Sets the ignore flag.
 void setPreparer(java.lang.String preparer)
          Sets the preparer name.
 void setRole(java.lang.String role)
          Sets the role to check.
protected  void startContext(javax.servlet.jsp.PageContext context)
          Starts the context when entering the tag.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, 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.Tag
getParent, setPageContext, setParent
 

Field Detail

role

protected java.lang.String role
The role to check. If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).


preparer

protected java.lang.String preparer
The view preparer to use before the rendering.


flush

protected boolean flush
This flag, if true, flushes the content before rendering.


ignore

protected boolean ignore
This flag, if true, ignores exception thrown by preparers and those caused by problems with definitions.


container

protected TilesContainer container
The Tiles container that can be used inside the tag.


attributeContext

protected AttributeContext attributeContext
The attribute context to use to store and read attribute values.

Constructor Detail

RenderTagSupport

public RenderTagSupport()
Method Detail

getRole

public java.lang.String getRole()
Returns the role to check. If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).

Returns:
The role to check.

setRole

public void setRole(java.lang.String role)
Sets the role to check. If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).

Parameters:
role - The role to check.

getPreparer

public java.lang.String getPreparer()
Returns the preparer name.

Returns:
The preparer name.

setPreparer

public void setPreparer(java.lang.String preparer)
Sets the preparer name.

Parameters:
preparer - The preparer name.

isFlush

public boolean isFlush()
Returns the flush flag. If true, current page out stream is flushed before insertion.

Returns:
The flush flag.

setFlush

public void setFlush(boolean flush)
Sets the flush flag. If true, current page out stream is flushed before insertion.

Parameters:
flush - The flush flag.

isIgnore

public boolean isIgnore()
Returns the ignore flag. If it is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown.

Returns:
The ignore flag.

setIgnore

public void setIgnore(boolean ignore)
Sets the ignore flag. If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown.

Parameters:
ignore - The ignore flag.

release

public void release()

Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport

doStartTag

public int doStartTag()
               throws TilesJspException

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
TilesJspException

doEndTag

public int doEndTag()
             throws TilesJspException

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
TilesJspException

execute

protected void execute()
                throws TilesJspException,
                       java.io.IOException
Deprecated. Use render().

Execute the tag by invoking the preparer, if defined, and then rendering.

Throws:
TilesJspException - if a jsp exception occurs.
java.io.IOException - if an io exception occurs.

render

protected abstract void render()
                        throws TilesJspException,
                               java.io.IOException
Render the specified content.

Throws:
TilesJspException - if a jsp exception occurs.
java.io.IOException - if an io exception occurs.

startContext

protected void startContext(javax.servlet.jsp.PageContext context)
Starts the context when entering the tag.

Parameters:
context - The page context to use.

endContext

protected void endContext(javax.servlet.jsp.PageContext context)
Ends the context when exiting the tag.

Parameters:
context - The page context to use.

processNestedTag

public void processNestedTag(PutAttributeTag nestedTag)

Process nested ≶put> tag.

Places the value of the nested tag within the AttributeContext.It is the responsibility of the descendent to check security. Security will be managed by called tags.

Specified by:
processNestedTag in interface PutAttributeTagParent
Parameters:
nestedTag - the put tag desciendent.

processNestedTag

public void processNestedTag(PutListAttributeTag nestedTag)
Process the nested tag.

Specified by:
processNestedTag in interface PutListAttributeTagParent
Parameters:
nestedTag - Nested tag to process.

isAccessAllowed

protected boolean isAccessAllowed()
Deprecated. Implement access allowance in your own tag.

Checks if the user is inside the specified role.

Returns:
true if the user is allowed to have the tag rendered.