|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--org.locomotive.servlets.MultiThreadedHttpServlet | +--org.locomotive.loco.servlet.MultiThreadedLocoServlet
The MultiThreadedLocoServlet class is a Servlet class you can subclass
if you want to write a servlet for use with the Locomotive (maybe one
that uses STEAM).
WARNING: Servlets that are written as subclasses of this class
will not run on any servlet containers other than the Locomotive!
Only subclass this class if you're sure that you (nor anyone else) will
ever need/want to run your servlet in another servlet container.
Notice that as a subclass of MultiThreadedHttpServlet, this class
does not implement SingleThreadModel, which means that subclasses
of this class will be treated as multithreaded servlets. Only one
instance of each kind of multithreaded servlet will be instantiated
in the Locomotive, and that one instance will serve any/all requests
simultaneously.
MultiThreadedHttpServlet
, Serialized FormField Summary | |
static int |
DEBUG
Log level to use for debugging |
static int |
ERROR
Log level to use for serious errors; e.g. |
static int |
NORMAL
Log level to use for normal activities |
static int |
WARNING
Log level to use for warnings |
Constructor Summary | |
MultiThreadedLocoServlet()
|
Method Summary | |
java.lang.String |
displayPage(java.lang.String document_path,
java.util.Hashtable steam_vars,
javax.servlet.http.HttpServletResponse response)
Loads a Steam document, inserts the values of Steam variables into that document, and then writes the result back to the Web server. |
java.sql.Connection |
getConnection(javax.servlet.http.HttpServletRequest request)
Pass this method the ServletRequest Object, and it returns the Locomotive's database Connection for this request (if it is defined in the request attributes under the key "locomotive.connection"). |
FormData |
getFormData(javax.servlet.http.HttpServletRequest request)
Pass this method the ServletRequest Object, and it returns the Locomotive's FormData for this request (if it is defined in the request attributes under the key "locomotive.form_data"). |
java.util.Hashtable |
getSteamVars(javax.servlet.http.HttpServletRequest request)
Pass this method the ServletRequest Object, and it returns the Locomotive's SteamVars Hashtable for this request (if it is defined in the request attributes under the key "locomotive.steam_vars"). |
java.lang.String[] |
getURLTokens(javax.servlet.http.HttpServletRequest request)
Pass this method the ServletRequest Object, and it returns the Locomotive's URL tokens (if they are defined in the request attributes under the key "locomotive.url_tokens"). |
User |
getUser(javax.servlet.http.HttpServletRequest request)
Pass this method the ServletRequest Object, and it returns the Locomotive's User Object for this request (if it is defined in the request's session values under the key "locomotive.user"). |
void |
log(int log_level,
java.lang.String log_message)
Writes a message to the Locomotive's global server log. |
void |
logEvent(java.lang.String major,
java.lang.String minor,
java.lang.String data,
javax.servlet.http.HttpServletRequest request)
Write one event to the global Locomotive event log. |
void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
The service method is the main entry point for Servlets. |
Methods inherited from class org.locomotive.servlets.MultiThreadedHttpServlet |
displayString,
exceptionStackTrace,
handleException,
sayBadURL |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete,
doGet,
doOptions,
doPost,
doPut,
doTrace,
getLastModified,
service |
Methods inherited from class javax.servlet.GenericServlet |
destroy,
getInitParameter,
getInitParameterNames,
getServletConfig,
getServletContext,
getServletInfo,
init,
init,
log,
log |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int ERROR
public static final int WARNING
public static final int NORMAL
public static final int DEBUG
Constructor Detail |
public MultiThreadedLocoServlet()
Method Detail |
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
If you choose to override this method in a sub class, don't forget to call the setup() method at the beginning of your version.
#setup
,
javax.servlet.http.HttpServlet.html#service
public void log(int log_level, java.lang.String log_message)
log_level
- 0 is most severe. The higher, the less severe.
Messages with log_levels higher than the config variable
LOG_LEVEL will be suppressed from being written to the log.log_message
- the message to write to the log.public void logEvent(java.lang.String major, java.lang.String minor, java.lang.String data, javax.servlet.http.HttpServletRequest request)
example:
logEvent(5, "login", "submit_form", user.getUsername());
major
- the major event region or code sectionminor
- the minor event codedata
- event specific datarequest
- the HttpServletRequest for this Threadpublic java.lang.String displayPage(java.lang.String document_path, java.util.Hashtable steam_vars, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
document_path
- the file path of that document, relative
to the template root.steam_vars
- a Hashtable containing STEAM variables to insert
into the template.response
- the HttpServletResponse for this Threadpublic java.lang.String[] getURLTokens(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest for this Threadpublic FormData getFormData(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest for this Threadpublic java.util.Hashtable getSteamVars(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest for this Threadpublic java.sql.Connection getConnection(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest for this Threadpublic User getUser(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest for this Thread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |