org.apache.tiles.jsp.taglib
abstract public class: RoleSecurityTagSupport [javadoc |
source]
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.tiles.jsp.taglib.RoleSecurityTagSupport
All Implemented Interfaces:
BodyTag, IterationTag, Serializable
Direct Known Subclasses:
RenderTagSupport, AddListAttributeTag, PutAttributeTag, InsertDefinitionTag, InsertTemplateTag, InsertAttributeTag, GetAsStringTag, AddAttributeTag, ContainerTagSupport, PutListAttributeTag
Base tag for the tiles tags which provides standard support for security.
- since:
Tiles - 2.0
- version:
$ - Rev: 527536 $ $Date: 2007-04-11 17:44:51 +0200 (Wed, 11 Apr 2007) $
| Methods from javax.servlet.jsp.tagext.TagSupport: |
|---|
|
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
| Method from org.apache.tiles.jsp.taglib.RoleSecurityTagSupport Detail: |
public int doEndTag() throws JspException {
try {
if (isAccessAllowed()) {
execute();
}
} catch (TilesException e) {
String message = "Error executing tag: " + e.getMessage();
LOG.error(message, e);
throw new JspException(message, e);
} catch (IOException io) {
String message = "IO Error executing tag: " + io.getMessage();
LOG.error(message, io);
throw new JspException(message, io);
}
return EVAL_PAGE;
}
|
abstract protected void execute() throws IOException, JspException, TilesException
|
public String getRole() {
return role;
}
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). |
protected boolean isAccessAllowed() {
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
return (role == null || req.isUserInRole(role));
}
Checks if the user is inside the specified role. |
public void release() {
super.release();
this.role = null;
}
|
public void setRole(String role) {
this.role = 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). |