org.deltava.taglib.content
Class RoleFilterTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.deltava.taglib.content.RoleFilterTag
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag

public class RoleFilterTag
extends TagSupport

A JSP tag to filter body content based on the user's membership in a particular role.

Since:
1.0
Version:
2.6
Author:
Luke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
RoleFilterTag()
           
 
Method Summary
 int doEndTag()
          Closes the JSP and releases state.
 int doStartTag()
          Filters the body content by checking for the user attribute in the request, then retrieves the list of roles from this object.
 void release()
          Clears state by reseting the role list.
 void setRoles(String roles)
          Sets the role(s) a user must belong to in order to view the body of this tag.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, 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
 

Constructor Detail

RoleFilterTag

public RoleFilterTag()
Method Detail

doStartTag

public int doStartTag()
Filters the body content by checking for the user attribute in the request, then retrieves the list of roles from this object.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Returns:
SKIP_BODY if role not found, otherwise EVAL_BODY_INCLUDE

doEndTag

public int doEndTag()
Closes the JSP and releases state.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Returns:
EVAL_PAGE always

setRoles

public void setRoles(String roles)
Sets the role(s) a user must belong to in order to view the body of this tag. Use * (asterisk) for all roles, and a role name prefaced by an ! (exclamation mark) for the lack of role memebrship.

Parameters:
roles - a comma-delimited list of authorized role names

release

public void release()
Clears state by reseting the role list.

Specified by:
release in interface Tag
Overrides:
release in class TagSupport


Copyright © 2004-2009 Global Virtual Airlines Group. All Rights Reserved.