public class BasicTilesContainer extends java.lang.Object implements TilesContainer, AttributeEvaluatorFactoryAware
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFINITIONS_CONFIG
Deprecated.
|
Constructor and Description |
---|
BasicTilesContainer() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkInit()
Determine whether or not the container has been
initialized.
|
void |
endContext(java.lang.Object... requestItems)
Ends a context, where attribute values are stored independently
from others.
It must be called after a TilesContainer.startContext(Object...) call. |
java.lang.Object |
evaluate(Attribute attribute,
java.lang.Object... requestItems)
Evaluates the given attribute.
|
TilesApplicationContext |
getApplicationContext()
Returns the Tiles application context used by this container.
|
AttributeContext |
getAttributeContext(java.lang.Object... requestItems)
Retrive the attribute context of the current request.
|
protected AttributeContext |
getContext(TilesRequestContext tilesContext)
Get attribute context from request.
|
TilesContextFactory |
getContextFactory()
Deprecated.
Do not use it, it returns
null . Use
getRequestContextFactory() . |
protected ArrayStack<AttributeContext> |
getContextStack(TilesRequestContext tilesContext)
Returns the context stack.
|
protected Definition |
getDefinition(java.lang.String definitionName,
TilesRequestContext request)
Returns a definition specifying its name.
|
DefinitionsFactory |
getDefinitionsFactory()
Returns the definitions factory.
|
PreparerFactory |
getPreparerFactory()
Returns the preparer factory used by this container.
|
protected TilesRequestContextFactory |
getRequestContextFactory()
Returns the request context factory.
|
protected java.util.List<java.lang.String> |
getResourceNames(java.lang.String resourceString)
Parse the resourceString into a list of resource paths
which can be loaded by the application context.
|
protected java.lang.String |
getResourceString()
Derive the resource string from the initialization parameters.
|
protected java.lang.String |
getResourceString(java.util.Map<java.lang.String,java.lang.String> parms)
Derive the resource string from the initialization parameters.
|
void |
init(java.util.Map<java.lang.String,java.lang.String> initParameters)
Initialize the Container with the given configuration.
|
protected void |
initializeDefinitionsFactory(DefinitionsFactory definitionsFactory,
java.lang.String resourceString,
java.util.Map<java.lang.String,java.lang.String> initParameters)
Deprecated.
Do not use, the Definitions Factory should be initialized by
the Tiles Container Factory.
|
boolean |
isValidDefinition(java.lang.String definitionName,
java.lang.Object... requestItems)
Determine whether or not the definition exists.
|
protected AttributeContext |
popContext(TilesRequestContext tilesContext)
Pops a context object out of the stack.
|
void |
prepare(java.lang.String preparer,
java.lang.Object... requestItems)
Executes a preparer.
|
protected void |
pushContext(AttributeContext context,
TilesRequestContext tilesContext)
Pushes a context object in the stack.
|
void |
render(Attribute attr,
java.lang.Object... requestItems)
Render the given Attribute.
|
void |
render(Attribute attr,
java.io.Writer writer,
java.lang.Object... requestItems)
Deprecated.
|
void |
render(java.lang.String definitionName,
java.lang.Object... requestItems)
Render the given tiles request.
|
protected void |
render(TilesRequestContext request,
AttributeContext attributeContext)
Renders the specified attribute context.
|
protected void |
render(TilesRequestContext request,
Definition definition)
Renders the specified definition.
|
protected void |
render(TilesRequestContext request,
java.lang.String definitionName)
Renders the definition with specified name.
|
void |
renderContext(java.lang.Object... requestItems)
Renders the current context, as it is.
|
void |
setApplicationContext(TilesApplicationContext context)
Sets the Tiles application context to use.
|
void |
setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
Sets the attribute evaluator factory.
|
void |
setContextFactory(TilesContextFactory contextFactory)
Deprecated.
|
void |
setDefinitionsFactory(DefinitionsFactory definitionsFactory)
Set the definitions factory.
|
void |
setPreparerFactory(PreparerFactory preparerFactory)
Set the preparerInstance factory.
|
void |
setRendererFactory(RendererFactory rendererFactory)
Sets the renderer instance factory.
|
void |
setRequestContextFactory(TilesRequestContextFactory contextFactory)
Sets the request context factory.
|
AttributeContext |
startContext(java.lang.Object... requestItems)
Starts a new context, where attribute values are stored independently
from others.
When the use of the contexts is finished, call TilesContainer.endContext(Object...) |
public static final java.lang.String DEFINITIONS_CONFIG
DefinitionsFactory.DEFINITIONS_CONFIG
.public void init(java.util.Map<java.lang.String,java.lang.String> initParameters)
init
in interface TilesContainer
initParameters
- application context for this containerjava.lang.IllegalStateException
- If the container has been already
initialized.DefinitionsFactoryException
- If something goes wrong during
initialization.public AttributeContext startContext(java.lang.Object... requestItems)
TilesContainer.endContext(Object...)
startContext
in interface TilesContainer
requestItems
- the current request objects.public void endContext(java.lang.Object... requestItems)
TilesContainer.startContext(Object...)
call.endContext
in interface TilesContainer
requestItems
- the current request objects.public void renderContext(java.lang.Object... requestItems)
renderContext
in interface TilesContainer
requestItems
- the current request objects.public TilesApplicationContext getApplicationContext()
getApplicationContext
in interface TilesContainer
public void setApplicationContext(TilesApplicationContext context)
context
- The Tiles application context.public AttributeContext getAttributeContext(java.lang.Object... requestItems)
getAttributeContext
in interface TilesContainer
requestItems
- the current request objects.@Deprecated public TilesContextFactory getContextFactory()
null
.protected TilesRequestContextFactory getRequestContextFactory()
public void setContextFactory(TilesContextFactory contextFactory)
setRequestContextFactory(TilesRequestContextFactory)
.contextFactory
- The context factory.public void setRequestContextFactory(TilesRequestContextFactory contextFactory)
contextFactory
- The context factory.public DefinitionsFactory getDefinitionsFactory()
public void setDefinitionsFactory(DefinitionsFactory definitionsFactory)
definitionsFactory
- the definitions factory for this instance.public PreparerFactory getPreparerFactory()
public void setPreparerFactory(PreparerFactory preparerFactory)
preparerFactory
- the preparerInstance factory for this conainer.public void setRendererFactory(RendererFactory rendererFactory)
rendererFactory
- the renderer instance factory for this container.public void setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
setAttributeEvaluatorFactory
in interface AttributeEvaluatorFactoryAware
attributeEvaluatorFactory
- The attribute evaluator factory to use.public void prepare(java.lang.String preparer, java.lang.Object... requestItems)
prepare
in interface TilesContainer
preparer
- The name of the preparer to execute.requestItems
- the current request objects.public void render(java.lang.String definitionName, java.lang.Object... requestItems)
render
in interface TilesContainer
definitionName
- the current definition.requestItems
- the current request objects.@Deprecated public void render(Attribute attr, java.io.Writer writer, java.lang.Object... requestItems) throws java.io.IOException
render
in interface TilesContainer
attr
- The attribute to render.writer
- A writer. IT WON'T BE EVALUATED!!!requestItems
- the current request objects.java.io.IOException
- If something goes wrong during writing to the output.public void render(Attribute attr, java.lang.Object... requestItems) throws java.io.IOException
render
in interface TilesContainer
attr
- The attribute to render.requestItems
- the current request objects.java.io.IOException
- If something goes wrong during writing to the output.public java.lang.Object evaluate(Attribute attribute, java.lang.Object... requestItems)
evaluate
in interface TilesContainer
attribute
- The attribute to evaluate.requestItems
- the current request objects.public boolean isValidDefinition(java.lang.String definitionName, java.lang.Object... requestItems)
isValidDefinition
in interface TilesContainer
definitionName
- the name of the definition.requestItems
- the current request objects.protected Definition getDefinition(java.lang.String definitionName, TilesRequestContext request)
definitionName
- The name of the definition to find.request
- The request context.DefinitionsFactoryException
- If the definitions factory throws an
exception.protected java.lang.String getResourceString()
DEFINITIONS_CONFIG
is available, attempts
to retrieve LEGACY_DEFINITIONS_CONFIG
. If niether are
available, returns "/WEB-INF/tiles.xml".protected java.lang.String getResourceString(java.util.Map<java.lang.String,java.lang.String> parms)
DEFINITIONS_CONFIG
is available, attempts
to retrieve LEGACY_DEFINITIONS_CONFIG
. If niether are
available, returns "/WEB-INF/tiles.xml".parms
- The initialization parameters.protected java.util.List<java.lang.String> getResourceNames(java.lang.String resourceString)
resourceString
- comma seperated resourcesprotected void checkInit()
java.lang.IllegalStateException
- if the container has already been initialized.@Deprecated protected void initializeDefinitionsFactory(DefinitionsFactory definitionsFactory, java.lang.String resourceString, java.util.Map<java.lang.String,java.lang.String> initParameters)
definitionsFactory
- The factory to initialize.resourceString
- The string containing a comma-separated-list of
resources.initParameters
- A map containing the initialization parameters.DefinitionsFactoryException
- If something goes wrong.protected ArrayStack<AttributeContext> getContextStack(TilesRequestContext tilesContext)
tilesContext
- The Tiles context object to use.protected void pushContext(AttributeContext context, TilesRequestContext tilesContext)
context
- The context to push.tilesContext
- The Tiles context object to use.protected AttributeContext popContext(TilesRequestContext tilesContext)
tilesContext
- The Tiles context object to use.protected AttributeContext getContext(TilesRequestContext tilesContext)
tilesContext
- current Tiles application context.protected void render(TilesRequestContext request, java.lang.String definitionName)
request
- The request context.definitionName
- The name of the definition to render.NoSuchDefinitionException
- If the definition has not been found.DefinitionsFactoryException
- If something goes wrong when
obtaining the definition.protected void render(TilesRequestContext request, Definition definition)
request
- The request context.definition
- The definition to render.protected void render(TilesRequestContext request, AttributeContext attributeContext)
request
- The request context.attributeContext
- The context to render.InvalidTemplateException
- If the template is not valid.CannotRenderException
- If something goes wrong during rendering.