org.apache.tiles.jsp.taglib
Class RoleSecurityTagSupport

Package class diagram package RoleSecurityTagSupport
java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.tiles.jsp.taglib.RoleSecurityTagSupport
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
Direct Known Subclasses:
AddAttributeTag, ContainerTagSupport, PutAttributeTag

public abstract class RoleSecurityTagSupport
extends javax.servlet.jsp.tagext.BodyTagSupport

Base tag for the tiles tags which provides standard support for security.

Since:
Tiles 2.0
See Also:
Serialized Form

Field Summary
 
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
RoleSecurityTagSupport()
           
 
Method Summary
 int doEndTag()
          
protected abstract  void execute()
          Executes the tag.
 java.lang.String getRole()
          Returns the role to check.
protected  boolean isAccessAllowed()
          Checks if the user is inside the specified role.
 void release()
          
 void setRole(java.lang.String role)
          Sets the role to check.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, doStartTag, 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
 

Constructor Detail

RoleSecurityTagSupport

public RoleSecurityTagSupport()
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.

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException

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

release

public void release()

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

execute

protected abstract void execute()
                         throws org.apache.tiles.TilesException,
                                javax.servlet.jsp.JspException,
                                java.io.IOException
Executes the tag. It is called inside doEndTag().

Throws:
org.apache.tiles.TilesException - If something goews wrong during the use of Tiles.
javax.servlet.jsp.JspException - If something goes wrong during rendering.
java.io.IOException - If something goes wrong during writing content.

isAccessAllowed

protected boolean isAccessAllowed()
Checks if the user is inside the specified role.

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