Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: WebObjects/WOApplication.h
The primary role of the WOApplication class is to coordinate the handling of HTTP requests. Each application must have exactly one WOApplication object (or, simply, application object). The application object receives client requests from an HTTP server adaptor, manages the processing that generates a response, and returns that response-typically an object representing a web page-to the adaptor. The adaptor, in turn, forwards the response in a suitable form to the HTTP server that originated the request.
In handling requests, an application object creates and manages one or more sessions; a session (represented by a WOSession object) dedicates resources to a period of access by a single user and stores persistent state during that period. Conceptually, each cycle of the request-response loop (or transaction) takes place within a session.
Besides acting as a facilitator between the adaptor and the rest of the application during request handling, WOApplication performs many secondary functions. It returns pages based on component name, caches page instances and component definitions, provides some facilities for error handling and script debugging, coordinates the different levels of multi-threaded execution, and furnishes a variety of data.
Typical deployment schemes balance the processing load by having multiple application instances per server adaptor. A single application, in turn, can interact with multiple adaptors; for example, an application can simultaneously communicate with secure-socket and Distributed Object adaptors as well as HTTP adaptors.
You can instantiate ready-made application objects from the WOApplication class or you can obtain the application object from a custom subclass of WOApplication. Custom WOApplication subclasses are common in WebObjects applications since there is often a need to override the awake, sleep, init, and request-handling methods. Compiled WOApplication subclasses can take any name, but if the name is anything other than "Application" you must implement your own main function to instantiate the application object from this class. However, if the class name is "Application," you don't need to modify main. In scripted applications, the code in the Application.wos file becomes the implementation logic of a WOApplication subclass automatically created at run time; the application object is instantiated from this subclass.
NSLocking- lock - unlock
- Creating
- - init
- + application
- Obtaining attributes
- - adaptorsDispatchRequestsConcurrently
- - allowsConcurrentRequestHandling
- - isConcurrentRequestHandlingEnabled
- - baseURL
- - name
- - number
- - path
- Locking
- - lock
- - unlock
- - lockRequestHandling
- - unlockRequestHandling
- Managing adaptors
- - adaptorWithName:arguments:
- - adaptors
- Managing cache
- - setCachingEnabled:
- - isCachingEnabled
- Managing sessions
- - setSessionStore:
- - sessionStore
- - saveSessionForContext:
- - restoreSessionWithID:inContext:
- - createSessionForRequest:
- Managing pages
- - setPageCacheSize:
- - pageCacheSize
- - permanentPageCacheSize
- - setPermanentPageCacheSize:
- - setPageRefreshOnBacktrackEnabled:
- - isPageRefreshOnBacktrackEnabled
- - pageWithName:forRequest:
- - pageWithName:inContext:
- Creating elements
- - dynamicElementWithName:associations:template:languages:
- Running
- - runLoop
- - run
- - setTimeOut:
- - timeOut
- - defaultRequestHandler
- - terminate
- - terminateAfterTimeInterval:
- Handling requests
- - appendToResponse:inContext:
- - awake
- - createContextForRequest:
- - createSessionForRequest:
- - defaultRequestHandler
- - defaultRequestHandlerClassName
- - dispatchRequest:
- - handlerForRequest:
- - invokeActionForRequest:inContext:
- - registeredRequestHandlerKeys
- - registerRequestHandler:forKey:
- - removeRequestHandlerForKey:
- - requestHandlerForKey:
- - setDefaultRequestHandler:
- - sleep
- - takeValuesFromRequest:inContext:
- Handling errors
- - handleSessionCreationErrorInContext:
- - handlePageRestorationErrorInContext:
- - handleSessionRestorationErrorInContext:
- - handleException:inContext:
- Backward compatibility
- - requiresWOF35RequestHandling
- - requiresWOF35TemplateParser
- Scripted class support
- - scriptedClassWithPath:
- - scriptedClassWithPath:encoding
- Script debugging
- - logWithFormat:
- - debugWithFormat:
- - printsHTMLParserDiagnostics
- - setPrintsHTMLParserDiagnostics:
- - traceAll:
- Statistics report
- - setStatisticsStore:
- - statisticsStore
- - statistics
- Monitor support
- - monitoringEnabled
- - activeSessionsCount
- - refuseNewSessions:
- - isRefusingNewSessions
- - setMinimumActiveSessionsCount:
- - minimumActiveSessionsCount
- - terminateAfterTimeInterval:
- Resource manager support
- - setResourceManager:
- - resourceManager
- User defaults
- + loadFrameworks
- + setLoadFrameworks:
- + isDebuggingEnabled
- + setDebuggingEnabled:
- + autoOpenInBrowser
- + setAutoOpenInBrowser:
- + isDirectConnectEnabled
- + setDirectConnectEnabled:
- + cgiAdaptorURL
- + setCGIAdaptorURL:
- + isCachingEnabled
- + setCachingEnabled:
- + applicationBaseURL
- + setApplicationBaseURL:
- + frameworksBaseURL
- + setFrameworksBaseURL:
- + recordingPath
- + setRecordingPath:
- + projectSearchPath
- + setProjectSearchPath:
- + isMonitorEnabled
- + setMonitorEnabled:
- + monitorHost
- + setMonitorHost:
- + SMTPHost
- + setSMTPHost:
- + adaptor
- + setAdaptor:
- + port
- + setPort:
- + listenQueueSize
- + setListenQueueSize:
- + workerThreadCount
- + setWorkerThreadCount:
- + additionalAdaptors
- + setAdditionalAdaptors:
- + includeCommentsInResponses
- + setIncludeCommentsInResponses:
- + componentRequestHandlerKey
- + setComponentRequestHandlerKey:
- + directActionRequestHandlerKey
- + setDirectActionRequestHandlerKey:
- + resourceRequestHandlerKey
- + setResourceRequestHandlerKey:
- + sessionTimeout
- + setSessionTimeOut:
- Convenience Methods
- - sharedEditingContext
+ (NSString *)adaptor
See Also: + setAdaptor:
+ (NSArray *)additionalAdaptors
See Also: + setAdditionalAdaptors:
+ (WOApplication *)application
A exception is raised if initialization does not succeed.
You may call this method, but do not override it.
+ (NSString *)applicationBaseURL
See Also: + setApplicationBaseURL:
+ (BOOL)autoOpenInBrowser
+ (NSString *)cgiAdaptorURL
See Also: + setCGIAdaptorURL:
+ (NSString *)componentRequestHandlerKey
+ (NSString *)directActionRequestHandlerKey
+ (NSString *)frameworksBaseURL
See Also: + setFrameworksBaseURL:
+ (BOOL)includeCommentsInResponses
See Also: + setIncludeCommentsInResponses:
+ (BOOL)isCachingEnabled
See Also: + setCachingEnabled:, - pageCacheSize, - isCachingEnabled
+ (BOOL)isDebuggingEnabled
See Also: - setDebuggingEnabled:, - debugWithFormat:
+ (BOOL)isDirectConnectEnabled
See Also: + cgiAdaptorURL
+ (BOOL)isMonitorEnabled
See Also: + setMonitorEnabled:, + monitorHost, + setMonitorHost:
+ (NSNumber *)listenQueueSize
See Also: + setListenQueueSize:
+ (NSArray *)loadFrameworks
See Also: + setLoadFrameworks:
+ (NSString *)monitorHost
See Also: + setMonitorHost:, + isMonitorEnabled
+ (NSNumber *)port
See Also: + setPort:
+ (NSArray *)projectSearchPath
See Also: + setProjectSearchPath:
+ (NSString *)recordingPath
If this method returns a path, all requests and responses are recorded in the HTTP format in numbered files (0000-request, 0000-response, 0001-request, 0001-response, and so on), and saved under the recording path specified. This directory is then used by the Playback tool to test the application. You will most likely set this as a command line argument (-WORecordingPath pathname), exercise your application to record a scenario you would like to test, and then stop the application. Afterward you can restart the application without the WORecordingPath argument, and point Playback to the recording directory just created to replay your sequence of requests and compare the responses received with the ones recorded.
See Also: + setRecordingPath:
+ (NSString *)resourceRequestHandlerKey
See Also: + setResourceRequestHandlerKey:
+ (NSNumber*)sessionTimeOut
See Also: + setSessionTimeOut:
+ (void)setAdaptor:(NSString
*)anAdaptorName
See Also: + adaptor
+ (void)setAdditionalAdaptors:(NSArray
*)anAdaptorPlist
See Also: + additionalAdaptors
+ (void)setApplicationBaseURL:(NSString
*)aBaseURL
See Also: + applicationBaseURL
+ (void)setAutoOpenInBrowser:(BOOL)isEnabled
To disable web browser launching, you must send this message in the init method of your application subclass (or application script).
See Also: + autoOpenInBrowser
+ (void)setCGIAdaptorURL:(NSString
*)aURL
See Also: + cgiAdaptorURL
+ (void)setCachingEnabled:(BOOL)flag
See Also: + isCachingEnabled, - pageCacheSize, - setCachingEnabled:
+ (void)setComponentRequestHandlerKey:(NSString
*)key
See Also: + componentRequestHandlerKey
+ (void)setDebuggingEnabled:(BOOL)flag
See Also: + isDebuggingEnabled, - debugWithFormat:
+ (void)setDirectActionRequestHandlerKey:(NSString
*)key
See Also: + directActionRequestHandlerKey
+ (void)setDirectConnectEnabled:(BOOL)flag
Direct connect actually transforms your application in a simple web server of its own. In particular, it is then able to find and return its images and resources as if it were a web server. It is very useful in development mode: You don't need a web server. Just point your URL to the port where your application is listening, and the application will handle all urls.
If this flag is YES, the following happens:
See Also: + isDirectConnectEnabled, + cgiAdaptorURL
+ (void)setFrameworksBaseURL:(NSString
*)aString
See Also: + frameworksBaseURL
+ (void)setIncludeCommentsInResponses:(BOOL)flag
See Also: + includeCommentsInResponses
+ (void)setListenQueueSize:(NSNumber
*)aListenQueueSize
See Also: + listenQueueSize
+ (void)setLoadFrameworks:(NSArray
*)frameworkList
See Also: + loadFrameworks
+ (void)setMonitorEnabled:(BOOL)flag
See Also: + isMonitorEnabled
+ (void)setMonitorHost:(NSString
*)hostName
See Also: + monitorHost, + isMonitorEnabled
+ (void)setPort:(NSNumber
*)port
See Also: + port
+ (void)setProjectSearchPath:(NSArray)searchPath
See Also: + projectSearchPath
+ (void)setRecordingPath:(NSString
*)path
If you save recording information, all requests and responses are recorded in the HTTP format in numbered files (0000-request, 0000-response, 0001-request, 0001-response, and so on), and saved under the recording path specified. This directory is then used by the Playback tool to test the application. You will most likely set this as a command line argument (-WORecordingPath pathname), exercise your application to record a scenario you would like to test, and then stop the application. Afterward you can restart the application without the WORecordingPath argument, and point Playback to the recording directory just created to replay your sequence of requests and compare the responses received with the ones recorded.
See Also: + recordingPath
+ (void)setResourceRequestHandlerKey:(NSString
*)key
See Also: + resourceRequestHandlerKey
+ (void)setSessionTimeOut:(NSNumber*)aTimeOut
See Also: + sessionTimeout
+ (void)setSMTPHost:(NSString
*)hostName
See Also: + SMTPHost
+ (void)setWorkerThreadCount:(NSNumber
*)aWorkerThreadCount
See Also: + workerThreadCount
+ (NSString *)SMTPHost
See Also: + setSMTPHost:
+ (NSNumber *)workerThreadCount
See Also: + setWorkerThreadCount:
- (int)activeSessionsCount
The number returned here is only accurate if the application stores state in memory in the server, which is the default. If you use a custom state-storage strategy, there may be no way to tell how many sessions are active for a given application instance.
See Also: - minimumActiveSessionsCount, - setMinimumActiveSessionsCount:
- (WOAdaptor *)adaptorWithName:(NSString
*)aName
arguments:(NSDictionary *)someArguments
See Also: - adaptors
- (NSArray *)adaptors
- (BOOL)adaptorsDispatchRequestsConcurrently
- (BOOL)allowsConcurrentRequestHandling
See Also: - isConcurrentRequestHandlingEnabled
- (void)appendToResponse:(WOResponse
*)aResponse
inContext:(WOContext *)aContext
See Also: - invokeActionForRequest:inContext:
- (void)awake
See Also: - sleep
- (NSString *)baseURL
WebObjects/Examples/HelloWorld.woa.
- (WOContext *)createContextForRequest:(WORequest
*)aRequest
- (WOSession *)createSessionForRequest:(WORequest
*)aRequest
The method then returns an allocated and initialized (using the default WOSession initializer) session instance of the selected class. It raises an exception if it is unable to create a new session.
An implication of the foregoing description is that the names of compiled WOSession subclasses should be "Session"; if not, you will have to override this method to use the proper class to create the session object. |
The global variable "WOApp" is initialized in this method. Your subclasses of WOApplication (including Application.wos) should be sure to call super's init method as their first line of code. |