abstractpublic class StandardApplication implements Application(Code)
Default application implementation. This class provides standard start/stop
services. This can be used as a base class to derive Application objects.
version: $Revision: 1.5 $ author: Mark Diekhans
Inner Class :public static class ContextMBean implements DynamicMBean
ensureSession(HttpPresentationComms comms) Default method used by requestPreprocessor
to ensure that a session exists and initialize the
session and sessionData fields
in the HttpPresentationComms object.
New sessions are only created on requests to presentation
objects, not requests for other types of files (such as gifs).
This avoids allocating multiple sessions when a browser makes
multiple requests for HREFs.
initializeNewSession(HttpPresentationComms comms) This is called when no valid session is found in an incoming request.
A new session is created and added to comms.
Database manager instance for application. The database manager
manages logical database and is responsible for allocating
connection, create transactions, etc.
Default URL used for application if defined in Config file. This
is used to redirect the user to the preferred start page if a
URL equal to the root of this application is given. By setting
this to index.html, it behaves in the same way as a http server.
Create the database manager to be used by this application. By
default this will return the LutrisStandardDatabaseManager.
This method can be overwritten to create a custom session
manager.
Parameters: databaseMgrConfig - Configuration object containing "DatabaseManager" keys. exception: ApplicationException - If an error occurs in creating a database manager.
Create the response post-processing manager to be used by this application.
This method can be overwritten to create a custom response post-processing
manager.
Parameters: ppConfig - Configuration object containing "ResponsePostProcessor" keys.This can be null to use none.The response post-processor.
Create the request pre-processing manager to be used by this application.
This method can be overwritten to create a custom request pre-processing
manager.
Parameters: ppConfig - Configuration object containing "RequestPreProcessor" keys.This can be null to use none.The request pre-processor.
Create a new session for application. By default this will create
the LutrisStandardSession.
This method can be overwritten to create a custom session.
Parameters: comms - Object containing request, response and redirect objects.Warning: comms.session and comms.sessionData will be null.they are filled in after this method returns.The session. exception: ApplicationException - If an error occurs in creating the session.
Create the session manager to be used by this application. By
default this will return the Lutris standard session manager.
This method can be overwritten to create a custom session
manager.
Parameters: sessionMgrConfig - Configuration object containing "SessionManager" keys.This can be null to use defaults. exception: ApplicationException - If an error occurs in creating a session manager.The session manager.
Default method used by requestPreprocessor
to ensure that a session exists and initialize the
session and sessionData fields
in the HttpPresentationComms object.
New sessions are only created on requests to presentation
objects, not requests for other types of files (such as gifs).
This avoids allocating multiple sessions when a browser makes
multiple requests for HREFs. If the session already exist, it
is alwasy set in comms
This normally looks up the session using a session key from
a cookie.
Parameters: comms - Object containing request, response and redirect objects. exception: ApplicationException - If an error occurs setting up the session.
Initialize Asynchronous DODS Caches!
Parameters: threadNumber - Number of parallel cache loading threads throws: ApplicationException - If an error occurs restart the application.
This is called when no valid session is found in an incoming request.
A new session is created and added to comms. If
sending session cookies is enabled, a cookie is created and
added to the response, so future requests will be associated
with the newly created session. If sending session cookies is
disabled, it is the application's responsibility to include
the session ID in URLs to associate further requests with the
session.
Warning: At first comms.session
and comms.sessionData are null. This method initializes
them both.
Parameters: comms - Object containing request, response and redirect objects. Sessionand SessionData objects are initialized. exception: ApplicationException - If an error occurs setting up the session. See Also:StandardApplication.setCookieForNewSession
Calls application session manager's passivateSession method
for the session associated with this request.
Parameters: comms - Object containing request, response and redirect objects. exception: ApplicationException - If the session manager was unable to "passivate" the session. See Also: com.lutris.appserver.server.session.SessionManager.passivateSession
Default application request preprocessor. This method sets up
a session data structure if a cookie is not set for the application.
It doesn't require a login however. The unauthenticated session is
useful for persistence in simple applications. It is possible to
later force a login. If the URL is not a reference to a presentation
object, then a session will not be allocated if it does not already
exist. This prevents allocation of multiple sessions when a browser
is requesting other objects, such as gifs, in parallel. Thus, after
this function is called, it is possible for session to be null.
N.B. Purposely not syncronized for speed/concurrency.
Parameters: comms - Object containing request, response and redirect objects.Always returns false, as request handling is not done. exception: Exception - May throw any exception, as with a presentation object;including page redirects.
Continue the startup up process with the application is in the
INCOMPLETE state. The default method generates an
error, as the application should never be in the INCOMPLETE
state if it doesn't implment this method.
Parameters: appConfig - The same appConfig object that was passed tostartup. exception: ApplicationException - If an error occurs restarting the application.
This is a hook that allows applications to act on requests before
they enter the Enhydra framework. This implementation always returns
false, so the request is processed normally. Do not override this
unless you absolutly have to. Currently the only application
that needs to is the debugger, because it needs to hand off requests
to other non-Enhydra servlets.
In contrast, the method requestPreprocessor() is commonly overridden.
It provides applications with a centeral place to put code that has
to be run on every request before it is sent to the presentation
objects.
Parameters: servlet - The servlet we are running in. Parameters: context - The ServletContext that was used to initialize our servlet. Parameters: request - The incomming request object. Parameters: response - The incomming response object.True if this method handled the request, in which case nofurther action will be taken. Or false if normal processingshould continue. exception: ServletException - You are allowed to throw the same exceptions that the servlet'sservice() method throws. exception: IOException - You are allowed to throw the same exceptions that the servlet'sservice() method throws.
setCookieForNewSession
public void setCookieForNewSession(boolean flag)(Code)
Tells the application if a cookie is used to bind new sessions
to a client. If no cookie is set, session ID's must be
communicated by means of URL rewriting.
Parameters: flag - indicates whether to send a cookie or not.
Tells the application about the Presentation Manager running it.
This is necessary because the presentation manager is created
before the application.
Parameters: pm - The HTTP presentation manager running this application.
Initializes the Jivan factory object which can be used by application.
Parameters: reload - swich which indicates realoading status of Jivan generatedpages in presentation layer (true = reload is on, false = reload is off)
Start the application. The default method sets the state to
RUNNING.
Parameters: appConfig - Application configuration object. exception: ApplicationException - If an error occurs starting the application.