Class 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.AbstractTemplateView
    Implementation of mustache view. Use jmustache internally as template compiler.
    • Field Summary

      • Fields inherited from class org.springframework.web.servlet.view.AbstractTemplateView

        SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE
      • Fields inherited from class org.springframework.web.servlet.view.AbstractView

        DEFAULT_CONTENT_TYPE
      • Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

        logger
      • Fields inherited from interface org.springframework.web.servlet.View

        PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
    • Constructor Summary

      Constructors 
      Constructor Description
      MustacheView()
      Build new view.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAlias​(String key, String value)
      Add alias mapping.
      void addAliases​(Map<String,​String> aliases)
      Add partials mapping.
      Map<String,​String> getAliases()
      Get list of aliases that map alias name to partial path.
      MustacheCompiler getCompiler()
      Get compiler that will be used to compile view.
      protected void renderMergedTemplateModel​(Map<String,​Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      void setCompiler​(MustacheCompiler compiler)
      Set new mustache compiler that can be used to compile view.
      String toString()  
      • 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, 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
      • Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

        getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
    • Constructor Detail

      • MustacheView

        public MustacheView()
        Build new view.
    • 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:
        renderMergedTemplateModel in class org.springframework.web.servlet.view.AbstractTemplateView
        Throws:
        Exception
      • toString

        public String toString()
        Overrides:
        toString in class org.springframework.web.servlet.view.AbstractUrlBasedView