|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet net.wotonomy.web.WOApplication
public class WOApplication
A pure java implementation of WOApplication.
The application is responsible for creating and managing sessions
and dispatching requests to the appropriate handlers.
This implementation extends HttpServlet, so the application itself
is a servlet and can be configured and managed as such by the servlet
container.
Field Summary | |
---|---|
static java.lang.String |
WOApplicationDidFinishLaunchingNotification
|
static java.lang.String |
WOApplicationWillFinishLaunchingNotification
|
static java.lang.String |
WOGarbageCollectionPeriodKey
|
Constructor Summary | |
---|---|
WOApplication()
|
Method Summary | |
---|---|
boolean |
adaptorsDispatchRequestsConcurrently()
Returns whether this application allows request to be handled concurrently. |
boolean |
allowsConcurrentRequestHandling()
Returns whether this application allows request to be handled concurrently. |
void |
appendToResponse(WOResponse aResponse,
WOContext aContext)
Invoked to start the third phase of the request-response cycle, after invokeAction() has completed and returned a WOResponse. |
static WOApplication |
application()
Returns the singleton instance of this application. |
static boolean |
autoOpenInBrowser()
Returns whether this application should attempt to open a web browser on the host machine when launched standalone. |
void |
awake()
Invoked first in the request-response cycle. |
java.lang.String |
baseURL()
Returns the path to the application on the local file system relative to the server's document root. |
static java.lang.String |
componentRequestHandlerKey()
Returns the component request handler key, which is defined by the system property _ComponentRequestHandlerKey. |
WOResourceManager |
createResourceManager()
Called to create the application's resource manager. |
WOSession |
createSessionForRequest(WORequest aRequest)
Called to create a session for a new request. |
WORequestHandler |
defaultRequestHandler()
Returns the default request handler used if the requested handler isn't specified or cannot be found. |
static java.lang.String |
directActionRequestHandlerKey()
Returns the direct action request handler key, which is defined by the system property _DirectActionRequestHandlerKey. |
WOResponse |
dispatchRequest(WORequest aRequest)
Dispatches the request to the appropriate handler. |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Dispatches the request and updates the specified response as appropriate. |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Handles post requests by calling doGet(), since the framework handles both gets and posts similarly. |
WOElement |
dynamicElementWithName(java.lang.String anElementName,
net.wotonomy.foundation.NSDictionary anAssociationMap,
WOElement aBodyElement,
java.util.List aLanguageList)
Returns either a dynamic element or a component for the specified name. |
WOResponse |
handleException(java.lang.Throwable aThrowable,
WOContext aContext)
|
WOResponse |
handlePageRestorationErrorInContext(WOContext aContext)
|
WORequestHandler |
handlerForRequest(WORequest aRequest)
Returns the request handler that would best service the specified request. |
WOResponse |
handleSessionCreationErrorInContext(WOContext aContext)
|
WOResponse |
handleSessionRestorationErrorInContext(WOContext aContext)
|
WOActionResults |
invokeAction(WORequest aRequest,
WOContext aContext)
Invoked to start the second phase of the request-response cycle, after all calls to takeValuesFromRequest have finished. |
static boolean |
isCachingEnabled()
Returns whether templates are cached. |
boolean |
isConcurrentRequestHandlingEnabled()
Returns whether this application allows request to be handled concurrently. |
static boolean |
isDebuggingEnabled()
Returns whether the application is in "debug mode". |
boolean |
isPageRefreshOnBacktrackEnabled()
Returns whether a "backtrack" for an existing page should simply call generateResponse() on the existing page instance. |
static void |
main(java.lang.String[] argv)
Main entry point for applications that do not subclass WOApplication. |
static void |
main(java.lang.String[] argv,
java.lang.Class subclass)
Subclasses may call this method to start a self-hosted web server to serve themselves directly (for testing). |
java.lang.String |
name()
Returns the name of the application. |
int |
pageCacheSize()
Returns the number of pages that will be retained in the user's session. |
WOComponent |
pageWithName(java.lang.String aName,
WOContext aContext)
Called to retrieve a component for the specified context. |
WOComponent |
pageWithName(java.lang.String aName,
WORequest aRequest)
Returns the page component with the specified name. |
java.lang.String |
path()
Returns the absolute path to the application on the local file system. |
int |
permanentPageCacheSize()
Returns the number of pages that will be retained in the longer-term "permanent" page cache in the user's session, which is typically used for navigation bars in frames, etc. |
static java.lang.Number |
port()
Gets the port used when run as a standalone server. |
net.wotonomy.foundation.NSArray |
registeredRequestHandlerKeys()
Returns the keys under which request handlers are registered. |
void |
registerRequestHandler(WORequestHandler aRequestHandler,
java.lang.String aKey)
Registers the specified request handler for the specified key. |
WORequestHandler |
removeRequestHandlerForKey(java.lang.String aKey)
Unregisters any existing request handler for the specified key returning the existing request handler, if any. |
WORequestHandler |
requestHandlerForKey(java.lang.String aKey)
Returns the request handler registered for the specified key, or null if no request handler is registered for that key. |
WOResourceManager |
resourceManager()
Returns the application's current resource manager. |
static java.lang.String |
resourceRequestHandlerKey()
Returns the resource request handler key, which is defined by the system property _ResourceRequestHandlerKey. |
WOSession |
restoreSessionWithID(java.lang.String aSessionID,
WOContext aContext)
Called at the beginning of the request-response cycle to obtain the current session from the user's last request. |
void |
saveSessionForContext(WOContext aContext)
Called at the end of the request-response cycle to persist the current session until the user's next request. |
WOSessionStore |
sessionStore()
Returns the session store used by this application to persist sessions between request-response transactions. |
static void |
setAutoOpenInBrowser(boolean autoOpen)
Sets whether this application should attempt to open a web browser on the host machine when launched standalone. |
static void |
setCachingEnabled(boolean enabled)
Sets whether templates are cached. |
static void |
setComponentRequestHandlerKey(java.lang.String aKey)
Deprecated. Set the system property _ComponentRequestHandlerKey. |
static void |
setDebuggingEnabled(boolean enabled)
Sets whether the application is in "debug mode". |
void |
setDefaultRequestHandler(WORequestHandler aRequestHandler)
Sets the default request handler used if the requested handler isn't specified or cannot be found. |
static void |
setDirectActionRequestHandlerKey(java.lang.String aKey)
Deprecated. Set the system property _DirectActionRequestHandlerKey. |
void |
setPageCacheSize(int aPositiveInt)
Sets the number of pages that will be retained in the user's session. |
void |
setPageRefreshOnBacktrackEnabled(boolean enabled)
Returns whether a "backtrack" for an existing page should simply call generateResponse() on the existing page instance. |
void |
setPermanentPageCacheSize(int aPositiveInt)
Returns the number of pages that will be retained in the longer-term "permanent" page cache in the user's session, which is typically used for navigation bars in frames, etc. |
void |
setResourceManager(WOResourceManager aResourceManager)
Deprecated. Override createResourceManager() instead. |
static void |
setResourceRequestHandlerKey(java.lang.String aKey)
Deprecated. Set the system property _ResourceRequestHandlerKey. |
void |
setSessionStore(WOSessionStore aSessionStore)
Sets the session store used by this application to persist sessions between request-response transactions. |
static void |
setSMTPHost(java.lang.String aHost)
Deprecated. Set the system property WOSMTPHost. |
void |
sleep()
Invoked last in the request-response cycle. |
static java.lang.String |
SMTPHost()
Gets the smtp server that will be used to send email. |
void |
takeValuesFromRequest(WORequest aRequest,
WOContext aContext)
Invoked to start the first phase of the request-response cycle, after all calls to awake() have been completed. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, 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 java.lang.String WOApplicationWillFinishLaunchingNotification
public static final java.lang.String WOApplicationDidFinishLaunchingNotification
public static final java.lang.String WOGarbageCollectionPeriodKey
Constructor Detail |
---|
public WOApplication()
Method Detail |
---|
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
protected void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
public static WOApplication application()
public java.lang.String name()
public java.lang.String path()
public java.lang.String baseURL()
public boolean allowsConcurrentRequestHandling()
public boolean adaptorsDispatchRequestsConcurrently()
public boolean isConcurrentRequestHandlingEnabled()
public void awake()
public void takeValuesFromRequest(WORequest aRequest, WOContext aContext)
public WOActionResults invokeAction(WORequest aRequest, WOContext aContext)
public void appendToResponse(WOResponse aResponse, WOContext aContext)
public void sleep()
public WOResponse dispatchRequest(WORequest aRequest)
public WORequestHandler defaultRequestHandler()
public void setDefaultRequestHandler(WORequestHandler aRequestHandler)
public void registerRequestHandler(WORequestHandler aRequestHandler, java.lang.String aKey)
public WORequestHandler removeRequestHandlerForKey(java.lang.String aKey)
public net.wotonomy.foundation.NSArray registeredRequestHandlerKeys()
public WORequestHandler requestHandlerForKey(java.lang.String aKey)
public WORequestHandler handlerForRequest(WORequest aRequest)
public WOResponse handleSessionCreationErrorInContext(WOContext aContext)
public WOResponse handleSessionRestorationErrorInContext(WOContext aContext)
public WOResponse handlePageRestorationErrorInContext(WOContext aContext)
public WOResponse handleException(java.lang.Throwable aThrowable, WOContext aContext)
public void setPageCacheSize(int aPositiveInt)
public int pageCacheSize()
public int permanentPageCacheSize()
public void setPermanentPageCacheSize(int aPositiveInt)
public void setPageRefreshOnBacktrackEnabled(boolean enabled)
public boolean isPageRefreshOnBacktrackEnabled()
public void setSessionStore(WOSessionStore aSessionStore)
public WOSessionStore sessionStore()
public void saveSessionForContext(WOContext aContext)
public WOSession restoreSessionWithID(java.lang.String aSessionID, WOContext aContext)
public WOSession createSessionForRequest(WORequest aRequest)
public WOComponent pageWithName(java.lang.String aName, WORequest aRequest)
public WOComponent pageWithName(java.lang.String aName, WOContext aContext)
public WOElement dynamicElementWithName(java.lang.String anElementName, net.wotonomy.foundation.NSDictionary anAssociationMap, WOElement aBodyElement, java.util.List aLanguageList)
public WOResourceManager createResourceManager()
public WOResourceManager resourceManager()
public void setResourceManager(WOResourceManager aResourceManager)
public static boolean isDebuggingEnabled()
public static void setDebuggingEnabled(boolean enabled)
public static void setCachingEnabled(boolean enabled)
public static boolean isCachingEnabled()
public static java.lang.String componentRequestHandlerKey()
public static void setComponentRequestHandlerKey(java.lang.String aKey)
public static java.lang.String directActionRequestHandlerKey()
public static void setDirectActionRequestHandlerKey(java.lang.String aKey)
public static java.lang.String resourceRequestHandlerKey()
public static void setResourceRequestHandlerKey(java.lang.String aKey)
public static boolean autoOpenInBrowser()
public static void setAutoOpenInBrowser(boolean autoOpen)
public static java.lang.Number port()
public static java.lang.String SMTPHost()
public static void setSMTPHost(java.lang.String aHost)
public static void main(java.lang.String[] argv)
public static void main(java.lang.String[] argv, java.lang.Class subclass)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |