Inherits from: NSObject
Package: com.apple.yellow.webobjects
WOResourceManager manages an application's resources. It defines methods that retrieve resources from standard directories. Each WebObjects application contains a resource manager object, which you can access by sending resourceManager to the WOApplication class
- Retrieving resources
- pathForResourceNamed
- urlForResourceNamed
- Retrieving localized strings
- stringForKey
- Managing the application-wide data cache
- flushDataCache
- removeDataForKey
- setData
- Controlling access
- lock
- unlock
public void flushDataCache()
Access to the WOResourceManager object is locked at the beginning of this method and unlocked at the end.
See Also: removeDataForKey, setData
public void lock()
Usually, you don't need to invoke this method in your own code. All messages that you send to a WOResourceManager object lock access to the object at the beginning of the method and unlock access at the end. You only need to use this method if you're subclassing WOResourceManager. In that case, you should lock access to the WOResourceManager object in methods that load resources.
See Also: unlock
public String pathForResourceNamed(
String aResourceFile,
String aFrameworkName,
NSArray languagesList)
This method always returns a path like /Local/Library/WebObjects/Applications/MyApp.woa/WebServerResources/MyResource. It does not return the path relative to the HTTP server's document root unless the entire application is located in the document root.
Access to the WOResourceManager object is locked at the beginning of this method and unlocked at the end.
See Also: urlForResourceNamed
public void removeDataForKey(
String key,
WOSession aSession)
This method is used by default when a dynamic element requests an image or embedded object from a database and the key attribute is not set for that dynamic element. If the key attribute isn't set, the data retrieved from the database is stored in the cache using setData, sent to the dynamic element, and then removed from the cache using removeDataForKey. If the key attribute is set, removeDataForKey is not invoked.
You rarely need to invoke this method yourself. Use it only if you need to limit the amount of memory your application uses, if your application has data stored in the cache, and you know that the data is no longer needed.
Access to the WOResourceManager object is locked at the beginning of this method and unlocked at the end.
See Also: flushDataCache
public void setData(
NSData someData,
String key,
String mimeType,
WOSession aSession)
This method is invoked any time a dynamic element requests an image or embedded object from a database. You rarely need to invoke it yourself.
By default when a dynamic element requests an image from the database, WOResourceManager fetches the image, stores it in the cache using setData, sends it to the dynamic element, and then removes it from the cache using removeDataForKey. However, if the dynamic element has a key attribute defined, then the image is stored in the database under that key, and it is not removed from the database.
Access to the WOResourceManager object is locked at the beginning of this method and unlocked at the end.
See Also: flushDataCache
public String stringForKey(
String aKey,
String aTableName,
String aDefaultValue,
String aFrameworkName,
NSArray languagesList)
public void unlock()
Usually, you don't need to invoke this method in your own code. All messages that you send to a WOResourceManager object lock access to the object at the beginning of the method and unlock access at the end. You only need to use this method if you're subclassing WOResourceManager. In that case, you should lock access to the WOResourceManager object in methods that load resources and unlock when the method is finished accessing the WOResourceManager object.
See Also: lock
public String urlForResourceNamed(
String aResourceFile,
String aFrameworkName,
NSArray languagesList,
WORequest aRequest)
WebObjects/MyApp.woa/WebServerResources/English.lproj/aResourceFile
Include the file's extension when specifying aResourceFile. If the file is in the application, specify null for the framework argument.
This method locates resources under the application or framework. The URL returned is computed by concatenating the application's base URL (returned by WOApplication's baseURL method and settable using the WOApplicationBaseURL user default) and the relative path of the resource. This method does not check to see if the file is actually under the document root. For example, if your application is installed in /Local/Library/WebObjects/Applications, and the method finds aResourceFile in the Resources directory, it returns:
/WebObjects/MyApp.woa/Resources/aResourceFile
even though the Resources directory is not under the document root.
Access to the WOResourceManager object is locked at the beginning of this method and unlocked at the end.
See Also: pathForResourceNamed