|
|||||||||
| Home >> All >> com >> lutris >> appserver >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.lutris.appserver.server
Class StandardApplication

java.lang.Objectcom.lutris.appserver.server.StandardApplication
- All Implemented Interfaces:
- Application
- public abstract class StandardApplication
- extends java.lang.Object
- implements Application
- extends java.lang.Object
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.62.8.2 $
| Field Summary | |
protected java.lang.String |
appName
The name of the application; defaults to the unqualified class name. |
protected com.lutris.util.Config |
config
This applications config object. |
protected ApplicationData |
data
Application Data accessable through Jolt Fields. |
protected com.lutris.appserver.server.sql.DatabaseManager |
databaseManager
Database manager instance for application. |
protected java.lang.String |
defaultUrl
Default URL used for application if defined in Config file. |
protected com.lutris.logging.LogChannel |
logChannel
The log channel for this application to write to. |
protected com.lutris.appserver.server.httpPresentation.HttpPresentationManager |
presentationManager
Presentation manager instance for application. |
protected boolean |
sendCookieForNewSession
Determines if a cookie with the session id is sent to the client. |
protected com.lutris.appserver.server.session.SessionManager |
sessionManager
Session manager for all application sessions. |
protected int |
state
Current state of the application. |
protected org.enhydra.xml.xmlc.XMLCFactory |
xmlcFactory
XMLC Factory. |
| Fields inherited from interface com.lutris.appserver.server.Application |
DEAD, HALTED, INCOMPLETE, RUNNING, STOPPED |
| Constructor Summary | |
StandardApplication()
A constructor with no arguments is required. |
|
| Method Summary | |
protected com.lutris.appserver.server.sql.DatabaseManager |
createDatabaseManager(com.lutris.util.Config databaseMgrConfig)
Create the database manager to be used by this application. |
protected com.lutris.appserver.server.session.Session |
createSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Create a new session for application. |
protected com.lutris.appserver.server.session.SessionManager |
createSessionManager(com.lutris.util.Config sessionMgrConfig)
Create the session manager to be used by this application. |
java.lang.String |
encodeUrl(java.lang.String url,
java.lang.String sessionKey)
Returns the specified url rewritten to include the sessionId |
java.lang.String |
encodeUrl(java.lang.String url,
java.lang.String sessionKey,
java.lang.String appName)
Deprecated. Use encodeUrl(String,String) |
protected void |
ensureSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Default method used by requestPreprocessor
to ensure that a session exists and initialize the
session and sessionData fields
in the HttpPresentationComms object. |
ApplicationData |
getApplicationData()
Application Data accessable through Jolt Fields. |
com.lutris.util.Config |
getConfig()
Get the application's config object. |
com.lutris.appserver.server.sql.DatabaseManager |
getDatabaseManager()
Get the DatabaseManager associated with this application. |
com.lutris.appserver.server.httpPresentation.HttpPresentationManager |
getHttpPresentationManager()
Get the HttpPresentationManager associated with this
application. |
com.lutris.logging.LogChannel |
getLogChannel()
Get the LogChannel associated with this application. |
java.lang.String |
getName()
Get the application symbolic name. |
com.lutris.appserver.server.session.SessionManager |
getSessionManager()
Get the SessionManager associated with this application. |
int |
getState()
Get the application state. |
org.enhydra.xml.xmlc.XMLCFactory |
getXMLCFactory()
Get the XMLC factory object being used by the application. |
protected void |
initializeNewSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
This is called when no valid session is found in an incoming request. |
void |
printCopyrightHeader()
|
void |
requestPostProcessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Calls application session manager's passivateSession method for the session associated with this request. |
boolean |
requestPreprocessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Default application request preprocessor. |
void |
restartup(com.lutris.util.Config appConfig)
Continue the startup up process with the application is in the INCOMPLETE state. |
boolean |
servletRequestPreprocessor(javax.servlet.Servlet servlet,
javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This is a hook that allows applications to act on requests before they enter the Enhydra framework. |
void |
setCookieForNewSession(boolean flag)
Tells the application if a cookie is used to bind new sessions to a client. |
void |
setHttpPresentationManager(com.lutris.appserver.server.httpPresentation.HttpPresentationManager pm)
Tells the application about the Presentation Manager running it. |
void |
setLogChannel(com.lutris.logging.LogChannel chan)
Set the LogChannel associated with this application. |
void |
setName(java.lang.String name)
Set the application name. |
void |
setXMLCFactory(boolean enableReload,
boolean enableRecompilation)
Set the XMLC factory based on the recload and recompilation options. |
void |
shutdown()
Shutdown the application. |
void |
startup(com.lutris.util.Config appConfig)
Start the application. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
sendCookieForNewSession
protected boolean sendCookieForNewSession
- Determines if a cookie with the session id is sent to the client.
appName
protected java.lang.String appName
- The name of the application; defaults to the unqualified
class name.
state
protected int state
- Current state of the application. Only modified by the derived
application.
sessionManager
protected com.lutris.appserver.server.session.SessionManager sessionManager
- Session manager for all application sessions. A session manager
manages the creation, deletion and assocation of sessions with
a user.
presentationManager
protected com.lutris.appserver.server.httpPresentation.HttpPresentationManager presentationManager
- Presentation manager instance for application. The presentation
manager handles incomming http requests.
databaseManager
protected com.lutris.appserver.server.sql.DatabaseManager databaseManager
- Database manager instance for application. The database manager
manages logical database and is responsible for allocating
connection, create transactions, etc.
config
protected com.lutris.util.Config config
- This applications config object. Every application has a configuration
object that is created from the application configuration file.
- See Also:
- com.lutris.util.Config
defaultUrl
protected java.lang.String defaultUrl
- 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.
logChannel
protected com.lutris.logging.LogChannel logChannel
- The log channel for this application to write to.
data
protected ApplicationData data
- Application Data accessable through Jolt Fields.
xmlcFactory
protected org.enhydra.xml.xmlc.XMLCFactory xmlcFactory
- XMLC Factory.
| Constructor Detail |
StandardApplication
public StandardApplication()
- A constructor with no arguments is required.
| Method Detail |
getState
public int getState()
- Get the application state.
N.B. Purposely not syncronized for speed.
- Specified by:
getStatein interfaceApplication
setCookieForNewSession
public void setCookieForNewSession(boolean flag)
- 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.
getConfig
public com.lutris.util.Config getConfig()
- Get the application's config object.
- Specified by:
getConfigin interfaceApplication
setName
public void setName(java.lang.String name)
- Set the application name.
- Specified by:
setNamein interfaceApplication
getName
public java.lang.String getName()
- Get the application symbolic name. This is normally the
package name of this application class.
N.B. Purposely not syncronized for speed.
- Specified by:
getNamein interfaceApplication
setLogChannel
public void setLogChannel(com.lutris.logging.LogChannel chan)
- Set the
LogChannelassociated with this application.- Specified by:
setLogChannelin interfaceApplication
getLogChannel
public com.lutris.logging.LogChannel getLogChannel()
- Get the
LogChannelassociated with this application.- Specified by:
getLogChannelin interfaceApplication
startup
public void startup(com.lutris.util.Config appConfig) throws ApplicationException
- Start the application. The default method sets the state to
RUNNING.- Specified by:
startupin interfaceApplication
printCopyrightHeader
public void printCopyrightHeader()
restartup
public void restartup(com.lutris.util.Config appConfig) throws ApplicationException
- Continue the startup up process with the application is in the
INCOMPLETEstate. The default method generates an error, as the application should never be in theINCOMPLETEstate if it doesn't implment this method.- Specified by:
restartupin interfaceApplication
shutdown
public void shutdown()
- Shutdown the application. The default method sets the state to
STOPPED.- Specified by:
shutdownin interfaceApplication
createSessionManager
protected com.lutris.appserver.server.session.SessionManager createSessionManager(com.lutris.util.Config sessionMgrConfig) throws ApplicationException
- 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.
createDatabaseManager
protected com.lutris.appserver.server.sql.DatabaseManager createDatabaseManager(com.lutris.util.Config databaseMgrConfig) throws ApplicationException
- Create the database manager to be used by this application. By
default this will return the Lutris
StandardDatabaseManager. This method can be overwritten to create a custom session manager.
createSession
protected com.lutris.appserver.server.session.Session createSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
- Create a new session for application. By default this will create
the Lutris
StandardSession. This method can be overwritten to create a custom session.
ensureSession
protected void ensureSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
- Default method used by
requestPreprocessorto ensure that a session exists and initialize thesessionandsessionDatafields in theHttpPresentationCommsobject. 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 incommsThis normally looks up the session using a session key from a cookie.
requestPostProcessor
public void requestPostProcessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
- Calls application session manager's passivateSession method
for the session associated with this request.
- Specified by:
requestPostProcessorin interfaceApplication
initializeNewSession
protected void initializeNewSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
- 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.sessionandcomms.sessionDataare null. This method initializes them both.
encodeUrl
public java.lang.String encodeUrl(java.lang.String url, java.lang.String sessionKey) throws ApplicationException
- Returns the specified url rewritten to include the sessionId
encodeUrl
public java.lang.String encodeUrl(java.lang.String url, java.lang.String sessionKey, java.lang.String appName) throws ApplicationException
- Deprecated. Use encodeUrl(String,String)
- Returns the specified url rewritten to include the sessionId
- Returns the specified url rewritten to include the sessionId
getApplicationData
public ApplicationData getApplicationData()
- Application Data accessable through Jolt Fields.
- Specified by:
getApplicationDatain interfaceApplication
requestPreprocessor
public boolean requestPreprocessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws java.lang.Exception
- 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.
- Specified by:
requestPreprocessorin interfaceApplication
getSessionManager
public com.lutris.appserver.server.session.SessionManager getSessionManager()
- Get the
SessionManagerassociated with this application.- Specified by:
getSessionManagerin interfaceApplication
getDatabaseManager
public com.lutris.appserver.server.sql.DatabaseManager getDatabaseManager()
- Get the
DatabaseManagerassociated with this application.- Specified by:
getDatabaseManagerin interfaceApplication
getHttpPresentationManager
public com.lutris.appserver.server.httpPresentation.HttpPresentationManager getHttpPresentationManager()
- Get the
HttpPresentationManagerassociated with this application.- Specified by:
getHttpPresentationManagerin interfaceApplication
setHttpPresentationManager
public void setHttpPresentationManager(com.lutris.appserver.server.httpPresentation.HttpPresentationManager pm)
- Tells the application about the Presentation Manager running it.
This is necessary because the presentation manager is created
before the application.
- Specified by:
setHttpPresentationManagerin interfaceApplication
servletRequestPreprocessor
public boolean servletRequestPreprocessor(javax.servlet.Servlet servlet, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
- 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.
- Specified by:
servletRequestPreprocessorin interfaceApplication
getXMLCFactory
public org.enhydra.xml.xmlc.XMLCFactory getXMLCFactory()
- Get the XMLC factory object being used by the application.
- Specified by:
getXMLCFactoryin interfaceApplication
setXMLCFactory
public void setXMLCFactory(boolean enableReload,
boolean enableRecompilation)
- Set the XMLC factory based on the recload and recompilation options.
- Specified by:
setXMLCFactoryin interfaceApplication
|
|||||||||
| Home >> All >> com >> lutris >> appserver >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.lutris.appserver.server.StandardApplication