Class MustacheView
- 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
-
- com.github.mjeanroy.springmvc.view.mustache.MustacheView
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.web.context.ServletContextAware,org.springframework.web.servlet.View
public class MustacheView extends org.springframework.web.servlet.view.AbstractTemplateViewImplementation of mustache view. Use jmustache internally as template compiler.
-
-
Constructor Summary
Constructors Constructor Description MustacheView()Build new view.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAlias(String key, String value)Add alias mapping.voidaddAliases(Map<String,String> aliases)Add partials mapping.Map<String,String>getAliases()Get list of aliases that map alias name to partial path.MustacheCompilergetCompiler()Get compiler that will be used to compile view.protected voidrenderMergedTemplateModel(Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)voidsetCompiler(MustacheCompiler compiler)Set new mustache compiler that can be used to compile view.StringtoString()-
Methods inherited from class org.springframework.web.servlet.view.AbstractTemplateView
applyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpers
-
Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView
afterPropertiesSet, checkResource, getUrl, isUrlRequired, setUrl
-
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse
-
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
-
-
-
-
Method Detail
-
setCompiler
public void setCompiler(MustacheCompiler compiler)
Set new mustache compiler that can be used to compile view.- Parameters:
compiler- Mustache compiler.
-
getCompiler
public MustacheCompiler getCompiler()
Get compiler that will be used to compile view.- Returns:
- Mustache compiler.
-
addAliases
public void addAliases(Map<String,String> aliases)
Add partials mapping.- Parameters:
aliases- New aliases.
-
addAlias
public void addAlias(String key, String value)
Add alias mapping.- Parameters:
key- Partial key.value- Partial name.
-
getAliases
public Map<String,String> getAliases()
Get list of aliases that map alias name to partial path.- Returns:
- Aliases.
-
renderMergedTemplateModel
protected void renderMergedTemplateModel(Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
- Specified by:
renderMergedTemplateModelin classorg.springframework.web.servlet.view.AbstractTemplateView- Throws:
Exception
-
toString
public String toString()
- Overrides:
toStringin classorg.springframework.web.servlet.view.AbstractUrlBasedView
-
-