This project has retired. For details please refer to its Attic page.
AbstractBaseAttributeRenderer (Tiles 2 2.1.4 API)

org.apache.tiles.renderer.impl
Class AbstractBaseAttributeRenderer

Package class diagram package AbstractBaseAttributeRenderer
java.lang.Object
  extended by org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer
All Implemented Interfaces:
TilesApplicationContextAware, TilesRequestContextFactoryAware, AttributeEvaluatorAware, AttributeRenderer
Direct Known Subclasses:
DefinitionAttributeRenderer, StringAttributeRenderer, TemplateAttributeRenderer, UntypedAttributeRenderer

public abstract class AbstractBaseAttributeRenderer
extends Object
implements AttributeRenderer, TilesRequestContextFactoryAware, TilesApplicationContextAware, AttributeEvaluatorAware

Base abstract class that manages authorization to display the attribute.

Since:
2.1.0
Version:
$Rev: 736275 $ $Date: 2009-01-21 10:58:20 +0100 (mer, 21 gen 2009) $

Field Summary
protected  TilesApplicationContext applicationContext
          The Tiles application context.
protected  TilesRequestContextFactory contextFactory
          The Tiles request context factory.
protected  AttributeEvaluator evaluator
          The attribute evaluator.
 
Constructor Summary
AbstractBaseAttributeRenderer()
           
 
Method Summary
protected  TilesRequestContext getRequestContext(Object... requestItems)
          Creates a Tiles request context from request items.
protected  boolean isPermitted(TilesRequestContext request, Set<String> roles)
          Checks if the current user is in one of the comma-separated roles specified in the role parameter.
 void render(Attribute attribute, TilesRequestContext request)
          Renders an attribute.
 void setApplicationContext(TilesApplicationContext applicationContext)
          Sets the Tiles application context.
 void setEvaluator(AttributeEvaluator evaluator)
          Sets the evaluator.
 void setRequestContextFactory(TilesRequestContextFactory contextFactory)
          Sets the Tiles request context factory.
abstract  void write(Object value, Attribute attribute, TilesRequestContext request)
          Implement this method knowing that the attribute won't be null and it will be authorized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contextFactory

protected TilesRequestContextFactory contextFactory
The Tiles request context factory.

Since:
2.1.1

applicationContext

protected TilesApplicationContext applicationContext
The Tiles application context.

Since:
2.1.0

evaluator

protected AttributeEvaluator evaluator
The attribute evaluator.

Since:
2.1.0
Constructor Detail

AbstractBaseAttributeRenderer

public AbstractBaseAttributeRenderer()
Method Detail

setRequestContextFactory

public void setRequestContextFactory(TilesRequestContextFactory contextFactory)
Sets the Tiles request context factory.

Specified by:
setRequestContextFactory in interface TilesRequestContextFactoryAware
Parameters:
contextFactory - The Tiles context factory.

setApplicationContext

public void setApplicationContext(TilesApplicationContext applicationContext)
Sets the Tiles application context.

Specified by:
setApplicationContext in interface TilesApplicationContextAware
Parameters:
applicationContext - The Tiles application context.

setEvaluator

public void setEvaluator(AttributeEvaluator evaluator)
Sets the evaluator.

Specified by:
setEvaluator in interface AttributeEvaluatorAware
Parameters:
evaluator - The evaluator to set.

render

public void render(Attribute attribute,
                   TilesRequestContext request)
            throws IOException
Renders an attribute.

Specified by:
render in interface AttributeRenderer
Parameters:
attribute - The attribute to render.
request - The Tiles request context.
Throws:
IOException - If something goes wrong during rendition.

write

public abstract void write(Object value,
                           Attribute attribute,
                           TilesRequestContext request)
                    throws IOException
Implement this method knowing that the attribute won't be null and it will be authorized.

Parameters:
value - The value of the attribute to be rendered.
attribute - The attribute to render.
request - The Tiles request object.
Throws:
IOException - If something goes wrong during rendition.
Since:
2.1.2

getRequestContext

protected TilesRequestContext getRequestContext(Object... requestItems)
Creates a Tiles request context from request items.

Parameters:
requestItems - The request items.
Returns:
The created Tiles request context.
Since:
2.1.0

isPermitted

protected boolean isPermitted(TilesRequestContext request,
                              Set<String> roles)
Checks if the current user is in one of the comma-separated roles specified in the role parameter.

Parameters:
request - The request context.
roles - The list of roles.
Returns:
true if the current user is in one of those roles.
Since:
2.1.0


Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.