|
||||||||||
| 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
public abstract class ConfigServlet
Config Servlet is the simplest way to use Melati. All a ConfigServlet does is to configure a melati and combine the doGet and doPost methods. Importantly it does not establish a poem session leaving you to do this for yourself. If you want a poem session established, please extend PoemServlet. ConfigServlet does set up a basic PoemContext with the Method set, but not the POEM logicaldatabase, table or troid. The URL is expected to take one of the following form:
http://h/s/meththe method is broken out of the path info and passed to your application code in the Melati and PoemContext parameter
| h | host name, such as www.melati.org |
| s | servlet-determining part, such as melati/org.melati.admin.Admin |
| meth | A freeform string telling your servlet what it is meant to do. This is automatically made available in templates as $melati.Method. |
| Field Summary | |
|---|---|
protected MelatiConfig |
melatiConfig
|
protected String |
sysAdminEmail
|
protected String |
sysAdminName
|
| Constructor Summary | |
|---|---|
ConfigServlet()
|
|
| Method Summary | |
|---|---|
protected abstract void |
doConfiguredRequest(Melati melati)
Instantiate this method to build up your own output. |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles GET. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle a POST. |
void |
error(Melati melati,
Exception e)
Send an error message. |
String |
getSysAdminEmail()
This method SHOULD be overidden. |
String |
getSysAdminName()
This method SHOULD be overidden. |
protected int |
httpStatusCode(Exception e)
|
void |
init(javax.servlet.ServletConfig config)
Inititialise Melati. |
protected MelatiConfig |
melatiConfig()
To override any setting from org.melati.MelatiConfig.properties, simply override this method and return a valid MelatiConfig. |
protected PoemContext |
poemContext(Melati melati)
|
protected void |
setSysAdminEmail(String sysAdminEmail)
|
protected void |
setSysAdminName(String sysAdminName)
|
void |
writeConnectionPendingException(PrintWriter out,
Exception e)
Print the ConnectionPendingException directly to the client. |
void |
writeError(PrintWriter out,
Exception e)
Print an error directly to the client. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, 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 MelatiConfig melatiConfig
protected String sysAdminName
protected String sysAdminEmail
| Constructor Detail |
|---|
public ConfigServlet()
| Method Detail |
|---|
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletconfig - a ServletConfig
javax.servlet.ServletException - is anything goes wrong
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
doGet in class javax.servlet.http.HttpServletrequest - the incoming HttpServletRequestresponse - the outgoing HttpServletResponse
public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
doPost in class javax.servlet.http.HttpServletrequest - the incoming HttpServletRequestresponse - the outgoing HttpServletResponse
public void error(Melati melati,
Exception e)
melati - the Melatie - the Exception to reportprotected int httpStatusCode(Exception e)
public void writeError(PrintWriter out,
Exception e)
out - the PrintWriter to print toe - the Exception to report
public void writeConnectionPendingException(PrintWriter out,
Exception e)
ConnectionPendingException directly to the client.
This is called if a request is made whilst the system is
still being initialised.
out - the PrintWriter to print toe - the Exception to reportpublic String getSysAdminName()
public String getSysAdminEmail()
protected void setSysAdminEmail(String sysAdminEmail)
sysAdminEmail - The sysAdminEmail to set.protected void setSysAdminName(String sysAdminName)
sysAdminName - The sysAdminName to set.
protected PoemContext poemContext(Melati melati)
throws PathInfoException
PathInfoExceptionprotected MelatiConfig melatiConfig()
protected MelatiConfig melatiConfig() throws MelatiException {
MelatiConfig config = super.melatiConfig();
config.setAccessHandler(new YourAccessHandler());
return config;
}
MelatiConfig
protected abstract void doConfiguredRequest(Melati melati)
throws Exception
melati -
Exception - if anything goes wrong
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||