Class TeaServlet

All Implemented Interfaces:, javax.servlet.Servlet, javax.servlet.ServletConfig

public class TeaServlet
extends javax.servlet.http.HttpServlet

The TeaServlet allows Tea templates to define dynamic web pages. The URI that is passed into the servlet determines what template will be called. Within the template, custom functions can be called that return JavaBeans. These functions are accessed via Applications that are configured to run in the TeaServlet.

The TeaServlet accepts the following initialization parameters:

103 , 01/07/13
Reece Wilton
See Also:
Serialized Form

Constructor Summary
Method Summary
protected  java.lang.Object convertParameter(java.lang.String value, java.lang.Class toType)
          Converts the given HTTP parameter value to the requested type so that it can be passed directly as a template parameter.
 void destroy()
          Destroys the TeaServlet and the user's application.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process the user's http get request.
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process the user's http post request.
 java.lang.String getServletInfo()
          Returns information about the TeaServlet.
 void init(javax.servlet.ServletConfig config)
          Initializes the TeaServlet.
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public TeaServlet()
Method Detail


public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initializes the TeaServlet. Creates the logger and loads the user's application.
init in class javax.servlet.GenericServlet
config - the servlet config


public void destroy()
Destroys the TeaServlet and the user's application.
destroy in class javax.servlet.GenericServlet


public java.lang.String getServletInfo()
Returns information about the TeaServlet.
getServletInfo in class javax.servlet.GenericServlet


protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
Process the user's http post request.
doPost in class javax.servlet.http.HttpServlet


protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
Process the user's http get request. Process the template that maps to the URI that was hit.
doGet in class javax.servlet.http.HttpServlet
request - the user's http request
response - the user's http response


protected java.lang.Object convertParameter(java.lang.String value,
                                            java.lang.Class toType)
Converts the given HTTP parameter value to the requested type so that it can be passed directly as a template parameter. This method is called if the template that is directly requested accepts non-String parameters, and the request provides non-null values for those parameters. The template may request an array of values for a parameter, in which case this method is called not to create the array, but rather to convert any elements put into the array.

This implementation supports converting parameters of the following types, and returns null for all others. If a conversion fails, null is returned.

When converting to Number, an instance of Integer, Long or Double is returned, depending on which parse succeeds first. A request for an Object returns either a Number or a String, depending on the success of a number parse.
value - non-null HTTP parameter value to convert
toType - Type to convert to
an instance of toType or null