|
||||||||||
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.aselect.system.servlet.ASelectHttpServlet
public abstract class ASelectHttpServlet
Base servlet for A-Select (core) components.
Description:
This base servlet contains functionality for restartable and initialisable
Servlets. In addition it contains some helpfull methods which are shared
among different A-Select Servlet components.
Concurrency issues:
You must use the isRestartInProgress()
method
in your service()
(or other request handling methods)
to ensure that the servlet is not currently restarting. If it is,
then you should halt processing. It is possible to process events
during a restart, but it is very dangerous since a restart can
potentially change the entire state of your servlet.
Other than that, this class is thread-safe.
Constructor Summary | |
---|---|
ASelectHttpServlet()
|
Method Summary | |
---|---|
protected java.lang.String |
getModuleName()
Retrieve the modulename. |
protected java.lang.String |
getWorkingDir()
Retrieve the working directory. |
protected java.lang.String |
handleRestartRequest(javax.servlet.http.HttpServletRequest oRequest,
java.lang.String sMySharedSecret,
java.io.PrintWriter pwOut,
SystemLogger systemLogger)
Handles the restart request. |
void |
init(javax.servlet.ServletConfig config)
Initialises the Servlet . |
protected boolean |
isReinit()
Determine whether this is a first-time init or a re-initialization Description: This method can be used in your init() method
to check whether it is a first-time initialization, or a
re-initialization after a restart API call. |
protected abstract boolean |
isRestartableServlet()
Determines whether or not a Servlet is restartable. |
protected boolean |
isRestartInProgress()
Check if a restart is currently in progress. |
protected boolean |
restartServlets(SystemLogger logger)
Restart all restartable servlets within this context. |
protected void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method returns a "Server Busy" if restarting is in progress. |
void |
setDisableCachingHttpHeaders(javax.servlet.http.HttpServletRequest oRequest,
javax.servlet.http.HttpServletResponse oResponse)
Set HTTP headers that disable browser caching. |
void |
showErrorPage(java.io.PrintWriter pwOut,
java.lang.String sTemplate,
java.lang.String sError,
java.lang.String sErrorMessage)
Show an HTML error page. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, 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 |
Constructor Detail |
---|
public ASelectHttpServlet()
Method Detail |
---|
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
Servlet
.
ASelectHttpServlet
as a restartable
servlet if applicable
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
Servlet.init(javax.servlet.ServletConfig)
public void setDisableCachingHttpHeaders(javax.servlet.http.HttpServletRequest oRequest, javax.servlet.http.HttpServletResponse oResponse)
oRequest != null
oResponse != null
oResponse
contains caching disable headers.
oRequest
- The HTTP request.oResponse
- The HTTP response.public void showErrorPage(java.io.PrintWriter pwOut, java.lang.String sTemplate, java.lang.String sError, java.lang.String sErrorMessage)
pwOut
- the PrintWriter
that is the target for
displaying the html error page.sTemplate
- The base HTML error template.sError
- The error that should be shown in the error page.sErrorMessage
- The error message that should be shown in the error page.protected abstract boolean isRestartableServlet()
true
if the Servlet
is restartable, false
otherwise.
true
if the Servlet is restartable, otherwise
false
.protected boolean isReinit()
init()
method
to check whether it is a first-time initialization, or a
re-initialization after a restart API call.
true
if this is a re-initialization,
false
otherwise.protected java.lang.String getModuleName()
protected java.lang.String getWorkingDir()
<servlet>
...
<init-param>
<param-name>working_dir</param-name>
<param-value>[param value]</param-value>
</init-param>
...
</servlet>
protected java.lang.String handleRestartRequest(javax.servlet.http.HttpServletRequest oRequest, java.lang.String sMySharedSecret, java.io.PrintWriter pwOut, SystemLogger systemLogger)
restartServlets(SystemLogger)
which restarts
all restartable servlets in the servlet context. Servlet
in the context. oRequest != null
sMySharedSecret != null
pwOut != null
oRequest
- The HTTP request.sMySharedSecret
- The shared secret on which the received Shared_secret is
validated upon.pwOut
- The ouput.systemLogger
- The logger for system logging.
protected boolean restartServlets(SystemLogger logger)
Servlet
context:
logger
- The system logger.
protected boolean isRestartInProgress()
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
isRestartInProgress()
method
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
HttpServlet.service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |