public abstract class AbstractBaseAttributeRenderer extends Object implements AttributeRenderer, TilesRequestContextFactoryAware, TilesApplicationContextAware, AttributeEvaluatorFactoryAware
Modifier and Type | Field and Description |
---|---|
protected TilesApplicationContext |
applicationContext
The Tiles application context.
|
protected AttributeEvaluatorFactory |
attributeEvaluatorFactory
The attribute evaluator factory.
|
protected TilesRequestContextFactory |
contextFactory
The Tiles request context factory.
|
Constructor and Description |
---|
AbstractBaseAttributeRenderer() |
Modifier and Type | Method and Description |
---|---|
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 |
setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
Sets the attribute evaluator factory.
|
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.
|
protected TilesRequestContextFactory contextFactory
protected TilesApplicationContext applicationContext
protected AttributeEvaluatorFactory attributeEvaluatorFactory
public void setRequestContextFactory(TilesRequestContextFactory contextFactory)
setRequestContextFactory
in interface TilesRequestContextFactoryAware
contextFactory
- The Tiles context factory.public void setApplicationContext(TilesApplicationContext applicationContext)
setApplicationContext
in interface TilesApplicationContextAware
applicationContext
- The Tiles application context.public void setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
setAttributeEvaluatorFactory
in interface AttributeEvaluatorFactoryAware
attributeEvaluatorFactory
- The attribute evaluator factory to use.public void render(Attribute attribute, TilesRequestContext request) throws IOException
render
in interface AttributeRenderer
attribute
- The attribute to render.request
- The Tiles request context.IOException
- If something goes wrong during rendition.public abstract void write(Object value, Attribute attribute, TilesRequestContext request) throws IOException
value
- The value of the attribute to be rendered.attribute
- The attribute to render.request
- The Tiles request object.IOException
- If something goes wrong during rendition.protected TilesRequestContext getRequestContext(Object... requestItems)
requestItems
- The request items.protected boolean isPermitted(TilesRequestContext request, Set<String> roles)
role
parameter.request
- The request context.roles
- The list of roles.true
if the current user is in one of those roles.Copyright © 2017. All rights reserved.