org.riotfamily.common.web.view.freemarker
Class RiotFreeMarkerView
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractView
org.springframework.web.servlet.view.AbstractUrlBasedView
org.springframework.web.servlet.view.AbstractTemplateView
org.springframework.web.servlet.view.freemarker.FreeMarkerView
org.riotfamily.common.web.view.freemarker.RiotFreeMarkerView
- All Implemented Interfaces:
- BeanNameAware, InitializingBean, ApplicationContextAware, ServletContextAware, View
public class RiotFreeMarkerView
- extends FreeMarkerView
Differences to Spring's FreeMarkerView:
- Model attributes may override attributes from the request or the session
- The plain HttpServletRequest object is exposed under the key "request"
- The model is not exposed to the request, unless the
freeMarkeServletMode
is enabled
- Provides the possibility to post process the model via the
ModelPostProcessor
interface
Methods inherited from class org.springframework.web.servlet.view.freemarker.FreeMarkerView |
autodetectConfiguration, checkTemplate, doRender, exposeHelpers, getConfiguration, getEncoding, getObjectWrapper, getTemplate, getTemplate, initApplicationContext, processTemplate, setConfiguration, setEncoding |
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
addStaticAttribute, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, prepareResponse, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute, writeToResponse |
REQUEST_KEY
public static final String REQUEST_KEY
- See Also:
- Constant Field Values
MODEL_ATTRIBUTE
public static final String MODEL_ATTRIBUTE
RiotFreeMarkerView
public RiotFreeMarkerView()
setAllowModelOverride
public void setAllowModelOverride(boolean allowModelOverride)
- Sets whether the model may contain keys that are also present as request
or session attributes. Otherwise an exception will be thrown when Spring
tries to expose an attribute that conflicts with a key in the model.
setFreeMarkerServletMode
public void setFreeMarkerServletMode(boolean freeMarkerServletMode)
- Sets whether the view should mimic the behavior of the
FreemarkerServlet
, i.e. provide support JSP tag libraries, the
"Request", "Session" and "Application" HashModels. By default this
mode is disabled, mainly because JSP support requires exposure of the
model as separate request attributes, which can be quite confusing when
working with nested views.
- Parameters:
freeMarkerServletMode
-
setModelPostProcessors
public void setModelPostProcessors(Collection<ModelPostProcessor> modelPostProcessors)
render
public final void render(Map model,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
- Specified by:
render
in interface View
- Overrides:
render
in class AbstractView
- Throws:
Exception
wrapResponse
protected HttpServletResponse wrapResponse(HttpServletRequest request,
HttpServletResponse response)
- Subclasses may override this method in order to wrap the
HttpServletResponse before it is passed on to the render method.
The default implementation simply returns the given response.
renderMergedTemplateModel
protected void renderMergedTemplateModel(Map model,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
- Overrides:
renderMergedTemplateModel
in class FreeMarkerView
- Throws:
Exception