Package com.netscape.cms.servlet.common
Class CMSTemplate
- java.lang.Object
-
- com.netscape.cms.servlet.common.CMSFile
-
- com.netscape.cms.servlet.common.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 Summary
Fields Modifier and Type Field Description java.lang.String
mPostOutput
java.lang.String
mPreOutput
static java.lang.String
SUFFIX
static java.lang.String
TEMPLATE_TAG
-
Fields inherited from class com.netscape.cms.servlet.common.CMSFile
mAbsPath, mContent, mLastAccess, mLastModified, mLogger
-
-
Constructor Summary
Constructors Constructor Description CMSTemplate(java.io.File file, java.lang.String charset)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.static java.lang.String
escapeJavaScriptStringHTML(java.lang.String v)
Like escapeJavaScriptString(String s) but also escape '[' for HTML processing.java.lang.String
getOutput(CMSTemplateParams input)
for debugging, return contents that would've been outputed.java.lang.String
getTemplateName()
boolean
init(java.io.File template)
boolean
outputEpilog(java.io.PrintWriter out)
Output the post HTML tags and post-output buffer.boolean
outputProlog(java.io.PrintWriter out)
Ouput the pre-amble HTML Header including the pre-output buffer.void
renderOutput(java.io.OutputStream rout, CMSTemplateParams input)
Write a javascript representation of 'input' surrounded by SCRIPT tags to the outputstream-
Methods inherited from class com.netscape.cms.servlet.common.CMSFile
getAbsPath, getContent, getLastAccess, getLastModified, log, setLastAccess, toString, toString
-
-
-
-
Field Detail
-
SUFFIX
public static final java.lang.String SUFFIX
- See Also:
- Constant Field Values
-
mPreOutput
public java.lang.String mPreOutput
-
mPostOutput
public java.lang.String mPostOutput
-
TEMPLATE_TAG
public static final java.lang.String TEMPLATE_TAG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CMSTemplate
public CMSTemplate(java.io.File file, java.lang.String charset) throws java.io.IOException, EBaseException
Constructor- Parameters:
file
- template file to loadcharset
- character set- Throws:
java.io.IOException
- if the there was an error opening the fileEBaseException
-
-
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 toinput
- 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. stevep - performance improvements - about 4 times faster than before.
-
escapeJavaScriptStringHTML
public static java.lang.String escapeJavaScriptStringHTML(java.lang.String v)
Like escapeJavaScriptString(String s) but also escape '[' for HTML processing.
-
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
-
-