org.histpop.server
Class TestServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.histpop.server.TestServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- Direct Known Subclasses:
- OHPRServlet
public class TestServlet
- extends javax.servlet.http.HttpServlet
- See Also:
- Serialized Form
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 |
pageFactory
protected PageFactory pageFactory
repository
protected SQLRepository repository
TestServlet
public TestServlet()
destroy
public void destroy()
- Specified by:
destroy
in interface javax.servlet.Servlet
- Overrides:
destroy
in class javax.servlet.GenericServlet
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Servlet
- Overrides:
init
in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
addMethod
public void addMethod(java.lang.String name,
java.lang.String class_str)
applicationInit
public void applicationInit(javax.servlet.ServletContext ctx)
- Method for implementing special servlet startup code.
This method can be overridden by sub classes
for application specific initialisation.
For example it can be used to add generic methods to the executor.
- Parameters:
ctx
- The servlet context with request, response, and session objects.
doGet
public void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
doPost
public void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
processRequest
public void processRequest(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
- The main method for processing a request.
This method implements among others also an access control SUSPEND algorithm.
If an action is allowed conditional access, the current ServerContext
is suspended automatically.
After an action has been taken a suspended context is resumed automatically if
1. The user explicitly asked to resume the previous context by sending
the 'resume' parameter in the HTML request.
2. The action itself successfully completed and explicitly set the
'resumeAllowed' flag to TRUE.
3. The context is in a suspended state.
- Parameters:
req
- The http requestresp
- The http response
connectionToRepositoryIsClosed
public boolean connectionToRepositoryIsClosed(ServerContext ctx)
- Check if connection to repository is still there.
This method can be overridden so as to provide more features
such as clearing caches or freeing up resources when the
connection is closed.
executeRequest
protected void executeRequest(ServerContext ctx)
throws java.lang.Exception
- Throws:
java.lang.Exception
getStackTrace
protected static java.lang.String getStackTrace(java.lang.Throwable e,
boolean html)
displayError
protected HTMLHandler displayError(java.lang.String result,
ServerContext ctx)
- Standard error handler which can be overridden by subclasses
to fill in more stuff into a standard error template.
displayException
protected void displayException(ServerContext ctx,
java.lang.Throwable ex)
throws java.lang.Exception
- Throws:
java.lang.Exception
displayResult
protected void displayResult(ServerContext ctx,
java.lang.Object result)
throws java.lang.Exception
- Throws:
java.lang.Exception
write
protected void write(ServerContext ctx,
HTMLHandler data)
throws java.lang.Exception
- Throws:
java.lang.Exception