|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.melati.servlet.ConfigServlet org.melati.servlet.PoemServlet
public abstract class PoemServlet
Base class to use Poem with Servlets.
Simply extend this class and override the doPoemRequest method. If you are going to use a template engine look at TemplateServlet.
http://h/s/db/and the following components are broken out of the path info and passed to your application code in the melati parameter (which is also copied automatically into context so that it is easily available in templates):
http://h/s/db/meth
http://h/s/db/tbl/meth
http://h/s/db/tbl/troid/meth
http://h/s/db/tbl/troid/meth/other
h | host name, such as www.melati.org |
s | servlet-determining part, such as melati/org.melati.admin.Admin |
db | The first element of the path info is taken to be the `logical name' of the Melati POEM database to which the servlet should connect. It is mapped onto JDBC connection details via the config file org.melati.LogicalDatabase.properties, of which there is an example in the source tree. This is automatically made available in templates as $melati.Database. |
tbl | The DBMS name of a table with which the servlet is concerned: perhaps it is meant to list its contents. This is automatically made available in templates as $melati.Table. |
troid | The POEM `troid' (table row identifier, or row-unique integer) of a row within tbl with which the servlet is concerned: perhaps it is meant to display it. This is automatically made available in templates as $melati.Object. |
meth | A freeform string telling your servlet what it is meant to do. This is automatically made available in templates as $melati.Method. |
other | Any other information you wish to put in the pathinfo. This is useful, for instance, if you wish to specify the "filename" of your servlet. For instance, if you call /db/myfiles/0/Download/afile.html and return a stream with a content-type of application/octet-stream most browsers will prompt you to save the "file" as afile.html |
Database.guestAccessToken()
,
PoemThread.commit()
,
PoemThread.rollback()
,
poemContext(org.melati.Melati)
,
AccessHandler
,
HttpSessionAccessHandler
,
Login
,
HttpBasicAuthenticationAccessHandler
,
Serialized FormField Summary |
---|
Fields inherited from class org.melati.servlet.ConfigServlet |
---|
melatiConfig, sysAdminEmail, sysAdminName |
Constructor Summary | |
---|---|
PoemServlet()
|
Method Summary | |
---|---|
protected void |
_handleException(Melati melati,
Exception exception)
|
void |
destroy()
|
protected void |
doConfiguredRequest(Melati melati)
Process the request. |
protected abstract void |
doPoemRequest(Melati melati)
Override this method to build up your own output. |
String |
getSysAdminEmail()
Override this to provide a different administrator's details to the database admin user. |
String |
getSysAdminName()
Override this to provide a different administrator's details to the database admin user. |
protected void |
handleException(Melati melati,
Exception exception)
Default method to handle an exception without a template engine. |
protected PoemContext |
poemContext(Melati melati)
|
protected PoemContext |
poemContextWithLDB(Melati melati,
String logicalDatabase)
|
protected void |
prePoemSession(Melati melati)
A place to do things before entering the session of the user, here is a good place to use root access token. |
Methods inherited from class org.melati.servlet.ConfigServlet |
---|
doGet, doPost, error, httpStatusCode, init, 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 |
Constructor Detail |
---|
public PoemServlet()
Method Detail |
---|
protected void prePoemSession(Melati melati) throws Exception
melati
- org.melati.Melati A source of information about the Melati
database context (database, table, object) and utility objects
such as error handlers.
Exception
public void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
Servlet.destroy()
protected void doConfiguredRequest(Melati melati) throws javax.servlet.ServletException, IOException
doConfiguredRequest
in class ConfigServlet
javax.servlet.ServletException
IOException
public String getSysAdminName()
getSysAdminName
in class ConfigServlet
public String getSysAdminEmail()
getSysAdminEmail
in class ConfigServlet
protected void handleException(Melati melati, Exception exception) throws Exception
melati
- the Melatiexception
- the exception to handle
Exception
protected final void _handleException(Melati melati, Exception exception) throws Exception
Exception
protected PoemContext poemContext(Melati melati) throws PathInfoException
poemContext
in class ConfigServlet
PathInfoException
protected PoemContext poemContextWithLDB(Melati melati, String logicalDatabase) throws PathInfoException
PathInfoException
protected abstract void doPoemRequest(Melati melati) throws Exception
melati
-
Exception
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |