パッケージ org.mixer2.spring.webmvc

クラス AbstractMixer2XhtmlView

  • すべての実装されたインタフェース:
    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 abstract class AbstractMixer2XhtmlView
    extends org.springframework.web.servlet.view.AbstractUrlBasedView
    Abstract class to create view class for Spring MVC.

    use this class with Mixer2XhtmlViewResolver

    implementation sample
    
     public class HelloWorldView extends AbstractMixer2XhtmlView {
     
        @Autowired
        private FooBar fooBar;
     
        @Override
        protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
              HttpServletResponse response) throws TagTypeUnmatchException {
            
            @SuppressWarnings("unchecked")
            String message = (String) model.get("helloMessage");
            Div div = html.getById("message", Div.class);
            div.unsetContent();
            div.getContent().add(message);
          
            return html;
     }
     

    You NEED NOT to add "@Component" annotation because Mixer2XhtmlViewResolver instantiate the view class through AutowireCapableBeanFactory.

    作成者:
    kazuki43zoo, nabedge
    関連項目:
    helloworld, spring mvc sample, spring mvc sample code
    • フィールドの概要

      フィールド 
      修飾子とタイプ フィールド 説明
      protected java.lang.String docType  
      protected Mixer2Engine mixer2Engine  
      protected org.springframework.core.io.ResourceLoader resourceLoader  
      • クラスから継承されたフィールド org.springframework.web.servlet.view.AbstractView

        DEFAULT_CONTENT_TYPE
      • クラスから継承されたフィールド org.springframework.context.support.ApplicationObjectSupport

        logger
      • インタフェースから継承されたフィールド org.springframework.web.servlet.View

        PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
    • メソッドの概要

      すべてのメソッド staticメソッド インスタンス・メソッド abstractメソッド concreteメソッド 
      修飾子とタイプ メソッド 説明
      void afterPropertiesSet()  
      static AbstractMixer2XhtmlView createDefaultView()  
      java.lang.String getDocType()  
      Mixer2Engine getMixer2Engine()  
      protected java.lang.String modifyHtmlStringHook​(java.lang.String htmlString)
      Override this method if you modify html as string right before http response.
      protected abstract Html renderHtml​(Html html, java.util.Map<java.lang.String,​java.lang.Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Need implementation.
      protected void renderMergedOutputModel​(java.util.Map<java.lang.String,​java.lang.Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected void responseHtml​(Html renderedHtml, javax.servlet.http.HttpServletResponse response)  
      void setDocType​(java.lang.String docType)  
      void setMixer2Engine​(Mixer2Engine mixer2Engine)  
      org.springframework.core.io.ResourceLoader setResourceLoader()  
      void setResourceLoader​(org.springframework.core.io.ResourceLoader resourceLoader)  
      • クラスから継承されたメソッド org.springframework.web.servlet.view.AbstractUrlBasedView

        checkResource, getUrl, isUrlRequired, setUrl, toString
      • クラスから継承されたメソッド 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
      • クラスから継承されたメソッド org.springframework.web.context.support.WebApplicationObjectSupport

        getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
      • クラスから継承されたメソッド org.springframework.context.support.ApplicationObjectSupport

        getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
      • クラスから継承されたメソッド java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • フィールドの詳細

      • resourceLoader

        protected org.springframework.core.io.ResourceLoader resourceLoader
      • docType

        protected java.lang.String docType
    • コンストラクタの詳細

      • AbstractMixer2XhtmlView

        public AbstractMixer2XhtmlView()
    • メソッドの詳細

      • setDocType

        public void setDocType​(java.lang.String docType)
      • getDocType

        public java.lang.String getDocType()
      • setMixer2Engine

        public void setMixer2Engine​(Mixer2Engine mixer2Engine)
      • setResourceLoader

        public void setResourceLoader​(org.springframework.core.io.ResourceLoader resourceLoader)
      • setResourceLoader

        public org.springframework.core.io.ResourceLoader setResourceLoader()
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        定義:
        afterPropertiesSet インタフェース内 org.springframework.beans.factory.InitializingBean
        オーバーライド:
        afterPropertiesSet クラス内 org.springframework.web.servlet.view.AbstractUrlBasedView
        例外:
        java.lang.Exception
      • renderMergedOutputModel

        protected void renderMergedOutputModel​(java.util.Map<java.lang.String,​java.lang.Object> model,
                                               javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response)
                                        throws java.lang.Exception
        定義:
        renderMergedOutputModel クラス内 org.springframework.web.servlet.view.AbstractView
        例外:
        java.lang.Exception
      • responseHtml

        protected void responseHtml​(Html renderedHtml,
                                    javax.servlet.http.HttpServletResponse response)
                             throws java.io.IOException
        例外:
        java.io.IOException
      • modifyHtmlStringHook

        protected java.lang.String modifyHtmlStringHook​(java.lang.String htmlString)
        Override this method if you modify html as string right before http response.
        パラメータ:
        htmlString - String object that is saveToString()ed by mixer2Engine.
        戻り値:
      • renderHtml

        protected abstract Html renderHtml​(Html html,
                                           java.util.Map<java.lang.String,​java.lang.Object> model,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws java.lang.Exception
        Need implementation.
        パラメータ:
        html - Html instance of xhtml template that is loaded by Mixer2XhtmlViewResolver.
        model -
        request -
        response -
        戻り値:
        例外:
        java.lang.Exception - Mixer2XhtmlViewResolver