info.magnolia.rendering.model
Class ModelExecutionFilter
java.lang.Object
info.magnolia.cms.filters.AbstractMgnlFilter
info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter
info.magnolia.rendering.model.ModelExecutionFilter
- All Implemented Interfaces:
- info.magnolia.cms.filters.MgnlFilter, javax.servlet.Filter
public class ModelExecutionFilter
- extends info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter
Filter that executes the model for a renderable before template rendering. Looks for a request parameter containing
the identifier of the renderable to execute. The model can decide to send output by itself in which case page rendering
is skipped. The model can also return a URI prefixed by "redirect:", "permanent:" or "forward:" to trigger either
a temporary redirect, a permanent redirect or a forward respectively. For redirects the URI can be absolute or
relative within the web application (the context path is added automatically).
By implementing the EarlyExecutionAware
interface the callback will instead be made to a dedicated method
making it easier to separate functionality for the two scenarios.
To provide proper semantics this class mirrors functionality in RenderingEngine and AbstractRender, specifically in
how it sets up the current content in aggregation state and creation and execution of the model.
- Version:
- $Id$
- See Also:
AbstractRenderer
,
RequestDispatchUtil
,
EarlyExecutionAware
Methods inherited from class info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter |
bypasses, doFilter |
Methods inherited from class info.magnolia.cms.filters.AbstractMgnlFilter |
acceptsEncoding, acceptsGzipEncoding, addAndVerifyHeader, addBypass, addMapping, destroy, getBypasses, getDispatching, getMapping, getMappings, getName, headerContains, init, isEnabled, mapsTo, matches, matchesDispatching, setDispatching, setEnabled, setName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MODEL_ATTRIBUTE_PREFIX
public static final String MODEL_ATTRIBUTE_PREFIX
ACTION_RESULT_ATTRIBUTE_PREFIX
public static final String ACTION_RESULT_ATTRIBUTE_PREFIX
DEFAULT_MODEL_EXECUTION_ATTRIBUTE_NAME
public static final String DEFAULT_MODEL_EXECUTION_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
ModelExecutionFilter
public ModelExecutionFilter()
setAttributeName
public void setAttributeName(String attributeName)
doFilter
public void doFilter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
- Specified by:
doFilter
in class info.magnolia.cms.filters.AbstractMgnlFilter
- Throws:
IOException
javax.servlet.ServletException
getAggregationStateSafely
protected static info.magnolia.cms.core.AggregationState getAggregationStateSafely()
getIdentifierOfNodeToExecute
protected String getIdentifierOfNodeToExecute()
getContent
protected javax.jcr.Node getContent(String nodeIdentifier)
throws javax.servlet.ServletException
- Returns the content node for the supplied node identifier. Never returns null.
- Throws:
javax.servlet.ServletException
getTemplateDefinition
protected TemplateDefinition getTemplateDefinition(javax.jcr.Node content)
throws javax.servlet.ServletException
- Returns the TemplateDefinition for the supplied content. Never returns null.
- Throws:
javax.servlet.ServletException
getRenderingModelBasedRenderer
protected RenderingModelBasedRenderer getRenderingModelBasedRenderer(RenderableDefinition renderableDefinition)
throws javax.servlet.ServletException
- Returns the Renderer for the supplied renderable if it supports RenderingModel. Never returns null.
- Throws:
IllegalArgumentException
- if there is no renderer registered for the renderable
javax.servlet.ServletException
- if the renderer does not support RenderingModel
handleExecutionResult
protected boolean handleExecutionResult(RenderingModel renderingModel,
String actionResult,
TemplateDefinition templateDefinition,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.