Class CMSTemplate


  • public class CMSTemplate
    extends CMSFile
    File templates. This implementation will take an HTML file with a special customer tag <CMS_TEMPLATE> and replace the tag with a series of javascript variable definitions (depending on the servlet)
    Version:
    $Revision$, $Date$
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
      • mPreOutput

        public java.lang.String mPreOutput
      • mPostOutput

        public java.lang.String mPostOutput
    • Constructor Detail

      • CMSTemplate

        public CMSTemplate​(java.io.File file,
                           java.lang.String charset)
                    throws java.io.IOException,
                           EBaseException
        Constructor
        Parameters:
        file - template file to load
        charset - character set
        Throws:
        java.io.IOException - if the there was an error opening the file
        EBaseException
    • Method Detail

      • init

        public boolean init​(java.io.File template)
                     throws EBaseException,
                            java.io.IOException
        Throws:
        EBaseException
        java.io.IOException
      • renderOutput

        public void renderOutput​(java.io.OutputStream rout,
                                 CMSTemplateParams input)
                          throws java.io.IOException
        Write a javascript representation of 'input' surrounded by SCRIPT tags to the outputstream
        Parameters:
        rout - the outputstream to write to
        input - the parameters to write
        Throws:
        java.io.IOException
      • outputProlog

        public boolean outputProlog​(java.io.PrintWriter out)
        Ouput the pre-amble HTML Header including the pre-output buffer.
        Parameters:
        out - output stream specified
        Returns:
        success or error
      • outputEpilog

        public boolean outputEpilog​(java.io.PrintWriter out)
        Output the post HTML tags and post-output buffer.
        Parameters:
        out - output stream specified
        Returns:
        success or error
      • getTemplateName

        public java.lang.String getTemplateName()
        Returns:
        full path of template
      • escapeJavaScriptString

        public static java.lang.String escapeJavaScriptString​(java.lang.String v)
        Escape the contents of src string in preparation to be enclosed in double quotes as a JavaScript String Literal within an <script> portion of an HTML document.
      • escapeJavaScriptStringHTML

        public static java.lang.String escapeJavaScriptStringHTML​(java.lang.String v)
        Like escapeJavaScriptString(String s) but also escapes for HTML processing; i.e., first encode for HTML and then encode for outputting in JavaScript.
      • getOutput

        public java.lang.String getOutput​(CMSTemplateParams input)
                                   throws java.io.IOException
        for debugging, return contents that would've been outputed.
        Throws:
        java.io.IOException