blob: df958a853ffcfabb9da99a0578a1b544921ba14f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Apr 14 08:26:34 EDT 2004 -->
<TITLE>
Velocity 1.4 API: Class VelocityServlet
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/VelocityServlet.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="VelocityServlet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.velocity.servlet</FONT>
<BR>
Class VelocityServlet</H2>
<PRE>
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--<B>org.apache.velocity.servlet.VelocityServlet</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig</DD>
</DL>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/velocity/test/VelocityServletTest.MockVelocityServlet.html">VelocityServletTest.MockVelocityServlet</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>VelocityServlet</B><DT>extends javax.servlet.http.HttpServlet</DL>
<P>
Base class which simplifies the use of Velocity with Servlets.
Extend this class, implement the <code>handleRequest()</code> method,
and add your data to the context. Then call
<code>getTemplate("myTemplate.wm")</code>.
This class puts some things into the context object that you should
be aware of:
<pre>
"req" - The HttpServletRequest object
"res" - The HttpServletResponse object
</pre>
There are other methods you can override to access, alter or control
any part of the request processing chain. Please see the javadocs for
more information on :
<ul>
<li> loadConfiguration() : for setting up the Velocity runtime
<li> createContext() : for creating and loading the Context
<li> setContentType() : for changing the content type on a request
by request basis
<li> handleRequest() : you <b>must</b> implement this
<li> mergeTemplate() : the template rendering process
<li> requestCleanup() : post rendering resource or other cleanup
<li> error() : error handling
</ul>
<br>
If you put a contentType object into the context within either your
serlvet or within your template, then that will be used to override
the default content type specified in the properties file.
"contentType" - The value for the Content-Type: header
<P>
<DL>
<DT><B>Author: </B><DD>Dave Bryson, <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>, <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>, <a href="kjohnson@transparent.com">Kent Johnson</a>, <a href="dlr@finemaltcoding.com">Daniel Rall</a>
$Id: VelocityServlet.java,v 1.52.4.1 2004/03/03 23:23:03 geirm Exp $</DD>
<DT><B>See Also: </B><DD><A HREF="../../../../serialized-form.html#org.apache.velocity.servlet.VelocityServlet">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#CONTENT_TYPE">CONTENT_TYPE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The HTTP content type context key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#DEFAULT_CONTENT_TYPE">DEFAULT_CONTENT_TYPE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The default content type for the response</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#DEFAULT_OUTPUT_ENCODING">DEFAULT_OUTPUT_ENCODING</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encoding for the output stream</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#defaultContentType">defaultContentType</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The default content type, itself defaulting to <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#DEFAULT_CONTENT_TYPE"><CODE>DEFAULT_CONTENT_TYPE</CODE></A> if not configured.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#INIT_PROPS_KEY">INIT_PROPS_KEY</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is the string that is looked for when getInitParameter is
called (<code>org.apache.velocity.properties</code>).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#OLD_INIT_PROPS_KEY">OLD_INIT_PROPS_KEY</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use of this properties key has been deprecated, and will be
removed in Velocity version 1.5.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#REQUEST">REQUEST</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The context key for the HTTP request object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#RESPONSE">RESPONSE</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The context key for the HTTP response object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static&nbsp;<A HREF="../../../../org/apache/velocity/util/SimplePool.html">SimplePool</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#writerPool">writerPool</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cache of writers</TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_javax.servlet.http.HttpServlet"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class javax.servlet.http.HttpServlet</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE</CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_javax.servlet.GenericServlet"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class javax.servlet.GenericServlet</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>config</CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#VelocityServlet()">VelocityServlet</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#chooseCharacterEncoding(javax.servlet.http.HttpServletRequest)">chooseCharacterEncoding</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chooses the output character encoding to be used as the value
for the "charset=" portion of the HTTP Content-Type header (and
thus returned by <code>response.getCharacterEncoding()</code>).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#createContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">createContext</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a context suitable to pass to the handleRequest() method
<br><br>
Default implementation will create a VelocityContext object,
put the HttpServletRequest and HttpServletResponse
into the context accessable via the keys VelocityServlet.REQUEST and
VelocityServlet.RESPONSE, respectively.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">doGet</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handles HTTP <code>GET</code> requests by calling <CODE>#doRequest()</CODE>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">doPost</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handles HTTP <code>POST</code> requests by calling <CODE>#doRequest()</CODE>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">doRequest</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handles all requests (by default).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#error(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Exception)">error</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response,
java.lang.Exception&nbsp;cause)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invoked when there is an error thrown in any part of doRequest() processing.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/velocity/Template.html">Template</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#getTemplate(java.lang.String)">getTemplate</A></B>(java.lang.String&nbsp;name)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the requested template.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../org/apache/velocity/Template.html">Template</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#getTemplate(java.lang.String, java.lang.String)">getTemplate</A></B>(java.lang.String&nbsp;name,
java.lang.String&nbsp;encoding)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the requested template with the specified
character encoding.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../org/apache/velocity/Template.html">Template</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#handleRequest(org.apache.velocity.context.Context)">handleRequest</A></B>(<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;ctx)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use
<A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)"><CODE>handleRequest( HttpServletRequest request,
HttpServletResponse response, Context ctx )</CODE></A></I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;<A HREF="../../../../org/apache/velocity/Template.html">Template</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)">handleRequest</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response,
<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;ctx)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implement this method to add your application data to the context,
calling the <code>getTemplate()</code> method to produce your return
value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#init(javax.servlet.ServletConfig)">init</A></B>(javax.servlet.ServletConfig&nbsp;config)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Performs initialization of this servlet.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#initVelocity(javax.servlet.ServletConfig)">initVelocity</A></B>(javax.servlet.ServletConfig&nbsp;config)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initializes the Velocity runtime, first calling
loadConfiguration(ServletConvig) to get a
java.util.Properties of configuration information
and then calling Velocity.init().</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;java.util.Properties</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#loadConfiguration(javax.servlet.ServletConfig)">loadConfiguration</A></B>(javax.servlet.ServletConfig&nbsp;config)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loads the configuration information and returns that
information as a Properties, which will be used to
initialize the Velocity runtime.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#mergeTemplate(org.apache.velocity.Template, org.apache.velocity.context.Context, javax.servlet.http.HttpServletResponse)">mergeTemplate</A></B>(<A HREF="../../../../org/apache/velocity/Template.html">Template</A>&nbsp;template,
<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;context,
javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;merges the template with the context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#requestCleanup(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)">requestCleanup</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response,
<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;context)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A cleanup routine which is called at the end of the <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><CODE>doRequest(HttpServletRequest, HttpServletResponse)</CODE></A>
processing sequence, allowing a derived class to do resource
cleanup or other end of process cycle tasks.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#setContentType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">setContentType</A></B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the content type of the response, defaulting to <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#defaultContentType"><CODE>defaultContentType</CODE></A> if not overriden.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_javax.servlet.http.HttpServlet"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.servlet.http.HttpServlet</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><clinit>, doDelete, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, service, service</CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_javax.servlet.GenericServlet"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.servlet.GenericServlet</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log</CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="REQUEST"><!-- --></A><H3>
REQUEST</H3>
<PRE>
public static final java.lang.String <B>REQUEST</B></PRE>
<DL>
<DD>The context key for the HTTP request object.</DL>
<HR>
<A NAME="RESPONSE"><!-- --></A><H3>
RESPONSE</H3>
<PRE>
public static final java.lang.String <B>RESPONSE</B></PRE>
<DL>
<DD>The context key for the HTTP response object.</DL>
<HR>
<A NAME="CONTENT_TYPE"><!-- --></A><H3>
CONTENT_TYPE</H3>
<PRE>
public static final java.lang.String <B>CONTENT_TYPE</B></PRE>
<DL>
<DD>The HTTP content type context key.</DL>
<HR>
<A NAME="DEFAULT_CONTENT_TYPE"><!-- --></A><H3>
DEFAULT_CONTENT_TYPE</H3>
<PRE>
public static final java.lang.String <B>DEFAULT_CONTENT_TYPE</B></PRE>
<DL>
<DD>The default content type for the response</DL>
<HR>
<A NAME="DEFAULT_OUTPUT_ENCODING"><!-- --></A><H3>
DEFAULT_OUTPUT_ENCODING</H3>
<PRE>
public static final java.lang.String <B>DEFAULT_OUTPUT_ENCODING</B></PRE>
<DL>
<DD>Encoding for the output stream</DL>
<HR>
<A NAME="defaultContentType"><!-- --></A><H3>
defaultContentType</H3>
<PRE>
private static java.lang.String <B>defaultContentType</B></PRE>
<DL>
<DD>The default content type, itself defaulting to <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#DEFAULT_CONTENT_TYPE"><CODE>DEFAULT_CONTENT_TYPE</CODE></A> if not configured.</DL>
<HR>
<A NAME="INIT_PROPS_KEY"><!-- --></A><H3>
INIT_PROPS_KEY</H3>
<PRE>
protected static final java.lang.String <B>INIT_PROPS_KEY</B></PRE>
<DL>
<DD>This is the string that is looked for when getInitParameter is
called (<code>org.apache.velocity.properties</code>).</DL>
<HR>
<A NAME="OLD_INIT_PROPS_KEY"><!-- --></A><H3>
OLD_INIT_PROPS_KEY</H3>
<PRE>
private static final java.lang.String <B>OLD_INIT_PROPS_KEY</B></PRE>
<DL>
<DD>Use of this properties key has been deprecated, and will be
removed in Velocity version 1.5.</DL>
<HR>
<A NAME="writerPool"><!-- --></A><H3>
writerPool</H3>
<PRE>
private static <A HREF="../../../../org/apache/velocity/util/SimplePool.html">SimplePool</A> <B>writerPool</B></PRE>
<DL>
<DD>Cache of writers</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="VelocityServlet()"><!-- --></A><H3>
VelocityServlet</H3>
<PRE>
public <B>VelocityServlet</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="init(javax.servlet.ServletConfig)"><!-- --></A><H3>
init</H3>
<PRE>
public void <B>init</B>(javax.servlet.ServletConfig&nbsp;config)
throws javax.servlet.ServletException</PRE>
<DL>
<DD>Performs initialization of this servlet. Called by the servlet
container on loading.<DD><DL>
<DT><B>Overrides:</B><DD><CODE>init</CODE> in class <CODE>javax.servlet.GenericServlet</CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>config</CODE> - The servlet configuration to apply.<DT><B>Throws:</B><DD><CODE>javax.servlet.ServletException</CODE> - &nbsp;</DL>
</DD>
</DL>
<HR>
<A NAME="initVelocity(javax.servlet.ServletConfig)"><!-- --></A><H3>
initVelocity</H3>
<PRE>
protected void <B>initVelocity</B>(javax.servlet.ServletConfig&nbsp;config)
throws javax.servlet.ServletException</PRE>
<DL>
<DD>Initializes the Velocity runtime, first calling
loadConfiguration(ServletConvig) to get a
java.util.Properties of configuration information
and then calling Velocity.init(). Override this
to do anything to the environment before the
initialization of the singelton takes place, or to
initialize the singleton in other ways.</DL>
<HR>
<A NAME="loadConfiguration(javax.servlet.ServletConfig)"><!-- --></A><H3>
loadConfiguration</H3>
<PRE>
protected java.util.Properties <B>loadConfiguration</B>(javax.servlet.ServletConfig&nbsp;config)
throws java.io.IOException,
java.io.FileNotFoundException</PRE>
<DL>
<DD>Loads the configuration information and returns that
information as a Properties, which will be used to
initialize the Velocity runtime.
<br><br>
Currently, this method gets the initialization parameter
VelocityServlet.INIT_PROPS_KEY, which should be a file containing
the configuration information.
<br><br>
To configure your Servlet Spec 2.2 compliant servlet runner to pass
this to you, put the following in your WEB-INF/web.xml file
<br>
<pre>
&lt;servlet&gt;
&lt;servlet-name&gt; YourServlet &lt/servlet-name&gt;
&lt;servlet-class&gt; your.package.YourServlet &lt;/servlet-class&gt;
&lt;init-param&gt;
&lt;param-name&gt; org.apache.velocity.properties &lt;/param-name&gt;
&lt;param-value&gt; velocity.properties &lt;/param-value&gt;
&lt;/init-param&gt;
&lt;/servlet&gt;
</pre>
Alternately, if you wish to configure an entire context in this
fashion, you may use the following:
<br>
<pre>
&lt;context-param&gt;
&lt;param-name&gt; org.apache.velocity.properties &lt;/param-name&gt;
&lt;param-value&gt; velocity.properties &lt;/param-value&gt;
&lt;description&gt; Path to Velocity configuration &lt;/description&gt;
&lt;/context-param&gt;
</pre>
Derived classes may do the same, or take advantage of this code to do the loading for them via :
<pre>
Properties p = super.loadConfiguration( config );
</pre>
and then add or modify the configuration values from the file.
<br><DD><DL>
<DT><B>Parameters:</B><DD><CODE>config</CODE> - ServletConfig passed to the servlets init() function
Can be used to access the real path via ServletContext (hint)<DT><B>Returns:</B><DD>java.util.Properties loaded with configuration values to be used
to initialize the Velocity runtime.<DT><B>Throws:</B><DD><CODE>java.io.FileNotFoundException</CODE> - if a specified file is not found.<DD><CODE>java.io.IOException</CODE> - I/O problem accessing the specified file, if specified.</DL>
</DD>
</DL>
<HR>
<A NAME="doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
doGet</H3>
<PRE>
public void <B>doGet</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)
throws javax.servlet.ServletException,
java.io.IOException</PRE>
<DL>
<DD>Handles HTTP <code>GET</code> requests by calling <CODE>#doRequest()</CODE>.<DD><DL>
<DT><B>Overrides:</B><DD><CODE>doGet</CODE> in class <CODE>javax.servlet.http.HttpServlet</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
doPost</H3>
<PRE>
public void <B>doPost</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)
throws javax.servlet.ServletException,
java.io.IOException</PRE>
<DL>
<DD>Handles HTTP <code>POST</code> requests by calling <CODE>#doRequest()</CODE>.<DD><DL>
<DT><B>Overrides:</B><DD><CODE>doPost</CODE> in class <CODE>javax.servlet.http.HttpServlet</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
doRequest</H3>
<PRE>
protected void <B>doRequest</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)
throws javax.servlet.ServletException,
java.io.IOException</PRE>
<DL>
<DD>Handles all requests (by default).<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - HttpServletRequest object containing client request<DD><CODE>response</CODE> - HttpServletResponse object for the response</DL>
</DD>
</DL>
<HR>
<A NAME="requestCleanup(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)"><!-- --></A><H3>
requestCleanup</H3>
<PRE>
protected void <B>requestCleanup</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response,
<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;context)</PRE>
<DL>
<DD>A cleanup routine which is called at the end of the <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><CODE>doRequest(HttpServletRequest, HttpServletResponse)</CODE></A>
processing sequence, allowing a derived class to do resource
cleanup or other end of process cycle tasks.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - servlet request from client<DD><CODE>response</CODE> - servlet reponse<DD><CODE>context</CODE> - context created by the createContext() method</DL>
</DD>
</DL>
<HR>
<A NAME="mergeTemplate(org.apache.velocity.Template, org.apache.velocity.context.Context, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
mergeTemplate</H3>
<PRE>
protected void <B>mergeTemplate</B>(<A HREF="../../../../org/apache/velocity/Template.html">Template</A>&nbsp;template,
<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;context,
javax.servlet.http.HttpServletResponse&nbsp;response)
throws <A HREF="../../../../org/apache/velocity/exception/ResourceNotFoundException.html">ResourceNotFoundException</A>,
<A HREF="../../../../org/apache/velocity/exception/ParseErrorException.html">ParseErrorException</A>,
<A HREF="../../../../org/apache/velocity/exception/MethodInvocationException.html">MethodInvocationException</A>,
java.io.IOException,
java.io.UnsupportedEncodingException,
java.lang.Exception</PRE>
<DL>
<DD>merges the template with the context. Only override this if you really, really
really need to. (And don't call us with questions if it breaks :)<DD><DL>
<DT><B>Parameters:</B><DD><CODE>template</CODE> - template object returned by the handleRequest() method<DD><CODE>context</CODE> - context created by the createContext() method<DD><CODE>response</CODE> - servlet reponse (use this to get the output stream or Writer</DL>
</DD>
</DL>
<HR>
<A NAME="setContentType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
setContentType</H3>
<PRE>
protected void <B>setContentType</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</PRE>
<DL>
<DD>Sets the content type of the response, defaulting to <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#defaultContentType"><CODE>defaultContentType</CODE></A> if not overriden. Delegates to <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#chooseCharacterEncoding(javax.servlet.http.HttpServletRequest)"><CODE>chooseCharacterEncoding(HttpServletRequest)</CODE></A> to select the
appropriate character encoding.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The servlet request from the client.<DD><CODE>response</CODE> - The servlet reponse to the client.</DL>
</DD>
</DL>
<HR>
<A NAME="chooseCharacterEncoding(javax.servlet.http.HttpServletRequest)"><!-- --></A><H3>
chooseCharacterEncoding</H3>
<PRE>
protected java.lang.String <B>chooseCharacterEncoding</B>(javax.servlet.http.HttpServletRequest&nbsp;request)</PRE>
<DL>
<DD>Chooses the output character encoding to be used as the value
for the "charset=" portion of the HTTP Content-Type header (and
thus returned by <code>response.getCharacterEncoding()</code>).
Called by <A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#setContentType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><CODE>setContentType(HttpServletRequest,
HttpServletResponse)</CODE></A> if an encoding isn't already specified by
Content-Type. By default, chooses the value of
RuntimeSingleton's <code>output.encoding</code> property.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The servlet request from the client.</DL>
</DD>
</DL>
<HR>
<A NAME="createContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
createContext</H3>
<PRE>
protected <A HREF="../../../../org/apache/velocity/context/Context.html">Context</A> <B>createContext</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response)</PRE>
<DL>
<DD>Returns a context suitable to pass to the handleRequest() method
<br><br>
Default implementation will create a VelocityContext object,
put the HttpServletRequest and HttpServletResponse
into the context accessable via the keys VelocityServlet.REQUEST and
VelocityServlet.RESPONSE, respectively.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - servlet request from client<DD><CODE>response</CODE> - servlet reponse to client<DT><B>Returns:</B><DD>context</DL>
</DD>
</DL>
<HR>
<A NAME="getTemplate(java.lang.String)"><!-- --></A><H3>
getTemplate</H3>
<PRE>
public <A HREF="../../../../org/apache/velocity/Template.html">Template</A> <B>getTemplate</B>(java.lang.String&nbsp;name)
throws <A HREF="../../../../org/apache/velocity/exception/ResourceNotFoundException.html">ResourceNotFoundException</A>,
<A HREF="../../../../org/apache/velocity/exception/ParseErrorException.html">ParseErrorException</A>,
java.lang.Exception</PRE>
<DL>
<DD>Retrieves the requested template.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - The file name of the template to retrieve relative to the
template root.<DT><B>Returns:</B><DD>The requested template.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../org/apache/velocity/exception/ResourceNotFoundException.html">ResourceNotFoundException</A></CODE> - if template not found
from any available source.<DD><CODE><A HREF="../../../../org/apache/velocity/exception/ParseErrorException.html">ParseErrorException</A></CODE> - if template cannot be parsed due
to syntax (or other) error.<DD><CODE>java.lang.Exception</CODE> - if an error occurs in template initialization</DL>
</DD>
</DL>
<HR>
<A NAME="getTemplate(java.lang.String, java.lang.String)"><!-- --></A><H3>
getTemplate</H3>
<PRE>
public <A HREF="../../../../org/apache/velocity/Template.html">Template</A> <B>getTemplate</B>(java.lang.String&nbsp;name,
java.lang.String&nbsp;encoding)
throws <A HREF="../../../../org/apache/velocity/exception/ResourceNotFoundException.html">ResourceNotFoundException</A>,
<A HREF="../../../../org/apache/velocity/exception/ParseErrorException.html">ParseErrorException</A>,
java.lang.Exception</PRE>
<DL>
<DD>Retrieves the requested template with the specified
character encoding.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - The file name of the template to retrieve relative to the
template root.<DD><CODE>encoding</CODE> - the character encoding of the template<DT><B>Returns:</B><DD>The requested template.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../org/apache/velocity/exception/ResourceNotFoundException.html">ResourceNotFoundException</A></CODE> - if template not found
from any available source.<DD><CODE><A HREF="../../../../org/apache/velocity/exception/ParseErrorException.html">ParseErrorException</A></CODE> - if template cannot be parsed due
to syntax (or other) error.<DD><CODE>java.lang.Exception</CODE> - if an error occurs in template initialization<DT><B>Since: </B><DD>Velocity v1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)"><!-- --></A><H3>
handleRequest</H3>
<PRE>
protected <A HREF="../../../../org/apache/velocity/Template.html">Template</A> <B>handleRequest</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response,
<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;ctx)
throws java.lang.Exception</PRE>
<DL>
<DD>Implement this method to add your application data to the context,
calling the <code>getTemplate()</code> method to produce your return
value.
<br><br>
In the event of a problem, you may handle the request directly
and return <code>null</code> or throw a more meaningful exception
for the error handler to catch.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - servlet request from client<DD><CODE>response</CODE> - servlet reponse<DD><CODE>ctx</CODE> - The context to add your data to.<DT><B>Returns:</B><DD>The template to merge with your context or null, indicating
that you handled the processing.<DT><B>Since: </B><DD>Velocity v1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="handleRequest(org.apache.velocity.context.Context)"><!-- --></A><H3>
handleRequest</H3>
<PRE>
protected <A HREF="../../../../org/apache/velocity/Template.html">Template</A> <B>handleRequest</B>(<A HREF="../../../../org/apache/velocity/context/Context.html">Context</A>&nbsp;ctx)
throws java.lang.Exception</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use
<A HREF="../../../../org/apache/velocity/servlet/VelocityServlet.html#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)"><CODE>handleRequest( HttpServletRequest request,
HttpServletResponse response, Context ctx )</CODE></A></I>
<P>
<DD>Implement this method to add your application data to the context,
calling the <code>getTemplate()</code> method to produce your return
value.
<br><br>
In the event of a problem, you may simple return <code>null</code>
or throw a more meaningful exception.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ctx</CODE> - The context to add your data to.<DT><B>Returns:</B><DD>The template to merge with your context.</DL>
</DD>
</DL>
<HR>
<A NAME="error(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Exception)"><!-- --></A><H3>
error</H3>
<PRE>
protected void <B>error</B>(javax.servlet.http.HttpServletRequest&nbsp;request,
javax.servlet.http.HttpServletResponse&nbsp;response,
java.lang.Exception&nbsp;cause)
throws javax.servlet.ServletException,
java.io.IOException</PRE>
<DL>
<DD>Invoked when there is an error thrown in any part of doRequest() processing.
<br><br>
Default will send a simple HTML response indicating there was a problem.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - original HttpServletRequest from servlet container.<DD><CODE>response</CODE> - HttpServletResponse object from servlet container.<DD><CODE>cause</CODE> - Exception that was thrown by some other part of process.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/VelocityServlet.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="VelocityServlet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
Copyright © 2002 Apache Software Foundation. All Rights Reserved.
</BODY>
</HTML>