info.magnolia.module.templating
Class ModelExecutionFilter
java.lang.Object
info.magnolia.cms.filters.AbstractMgnlFilter
info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter
info.magnolia.module.templating.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 paragraph before template rendering. Looks for a request parameter containing
the UUID of the paragraph 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.
- Author:
- tmattsson
- 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()
getUuidOfParagraphToExecute
protected String getUuidOfParagraphToExecute()
getContent
protected info.magnolia.cms.core.Content getContent(String uuid)
throws javax.servlet.ServletException
- Returns the Content node for the supplied uuid. Never returns null.
- Throws:
javax.servlet.ServletException
getParagraph
protected Paragraph getParagraph(info.magnolia.cms.core.Content content)
throws javax.servlet.ServletException
- Returns the Paragraph for the supplied Content. Never returns null.
- Throws:
javax.servlet.ServletException
getRenderingModelBasedRenderer
protected RenderingModelBasedRenderer getRenderingModelBasedRenderer(Paragraph paragraph)
throws javax.servlet.ServletException
- Returns the ParagraphRenderer for the supplied Paragraph if it supports RenderingModel. Never returns null.
- Throws:
IllegalArgumentException
- if there is no renderer registered for the paragraph
javax.servlet.ServletException
- if the renderer does not support RenderingModel
handleActionResult
protected boolean handleActionResult(String actionResult,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException,
javax.servlet.ServletException
- Returns true if special handling was performed.
- Throws:
IOException
javax.servlet.ServletException
Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.