|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.melati.servlet.ConfigServlet
org.melati.servlet.PoemServlet
org.melati.servlet.TemplateServlet
public abstract class TemplateServlet
Base class to use Melati with a Template Engine.
To create your own servlet simply extend this class,
overriding the doTemplateRequest method.
| Field Summary | |
|---|---|
protected ServletTemplateEngine |
templateEngine
|
| Fields inherited from class org.melati.servlet.ConfigServlet |
|---|
melatiConfig, sysAdminEmail, sysAdminName |
| Constructor Summary | |
|---|---|
TemplateServlet()
|
|
| Method Summary | |
|---|---|
protected String |
addExtension(String templateName)
The template extension is added in an overridable method to allow the application developer to specify their own template extensions. |
protected void |
doPoemRequest(Melati melati)
Override this method to build up your own output. |
protected abstract String |
doTemplateRequest(Melati melati,
ServletTemplateContext templateContext)
Override this method to build up your own output. |
void |
error(Melati melati,
Exception e)
Send an error message. |
void |
init(javax.servlet.ServletConfig config)
Inititialise the template engine. |
protected void |
prePoemSession(Melati melati)
Set the ServletTemplateEngine and ServletTemplateContext in our Melati. |
| Methods inherited from class org.melati.servlet.PoemServlet |
|---|
_handleException, destroy, doConfiguredRequest, getSysAdminEmail, getSysAdminName, handleException, poemContext, poemContextWithLDB |
| Methods inherited from class org.melati.servlet.ConfigServlet |
|---|
doGet, doPost, httpStatusCode, melatiConfig, setSysAdminEmail, setSysAdminName, writeConnectionPendingException, writeError |
| 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, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ServletTemplateEngine templateEngine
| Constructor Detail |
|---|
public TemplateServlet()
| Method Detail |
|---|
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class ConfigServletconfig - a ServletConfig
javax.servlet.ServletException - if the ServletTemplateEngine has a problem
protected void prePoemSession(Melati melati)
throws Exception
prePoemSession in class PoemServletmelati - the current Melati
Exception - if anything goes wrong
protected void doPoemRequest(Melati melati)
throws Exception
PoemServlet
doPoemRequest in class PoemServletExceptionprotected String addExtension(String templateName)
To obtain nice URLs one method is to call your templates
foo.html.wm for example, your urls can then look like
servlet/db/table/troid/method.html.
public void error(Melati melati,
Exception e)
error in class ConfigServletmelati - the Melatie - the Exception to report
protected abstract String doTemplateRequest(Melati melati,
ServletTemplateContext templateContext)
throws Exception
melati - the current MelatitemplateContext - the current ServletTemplateContext
Exception
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||