- Inherits From:
- NSObject
- Conforms To:
- NSURLHandleClient
- Declared In:
- URLLoader.h
It is created with several parameters:
The "consumer", which is an object that should respond to the informal protocol consisting of
| loadSuccess:handle:parameter: | Method called when the load finishes successfully |
| loadSuccess:parameter: | Alternate method called when the load finishes successfully |
| loadCancelledParameter: | Method called when the load is cancelled via cancelLoadInBackground |
| loadError:parameter: | Method called when the load fails to complete successfully |
Though the above is an informal protocol, failure to respond to the above selectors will be logged as a possible leak, because the consumer must be able to handle the results.
Options is a dictionary holding any of the following keys and values:
| LOAD_OPTION_HEADERS | NSDictionary of additional HTTP headers to use for a request. |
| LOAD_OPTION_DOPOST | NSNumber of what text encoding to use for a request. |
| LOAD_OPTION_DOPOST | Boolean (NSNumber) of whether to force a request to be a POST. |
| LOAD_OPTION_CACHE | Boolean (NSNumber) of whether page should be cached in memory. (Defaults to no) |
| LOAD_OPTION_POSTDICT | NSDictionary of keys and values; if non-nil, request will be an HTTP POST. |
| LOAD_OPTION_POSTSTRING | NSString for a post; if non-nil, request will be an HTTP POST. |
| LOAD_OPTION_COOKIEDICT | Dictionary for a cookie; if non-nil/empty, a cookie will be set. |
| other | Anything else, the key should be a string of the number of the CURLOPT value, and the value will be a string. This is for arbitrary setting of many CURL options. |
If the user defaults contains a non-zero value for the key "DebugURLLoads", the load will be logged (beginning with "+++"), for debugging purposes.
NSProgressIndicator *mProgress;
NSURL *mURL;
NSURLHandle *mURLHandle;
id mConsumer;
id mParameter;
int mBytesRetrievedSoFar;
BOOL mIsURLHandleClient;
mProgress No description. mURL No description. mURLHandle No description. mConsumer No description. mParameter No description. mBytesRetrievedSoFar No description. mIsURLHandleClient No description.
- + loadURL:consumer:options:progress:parameter:
- - initWithURL:consumer:options:progress:parameter:
- - loadInBackground
- - cancelLoadInBackground
- - urlHandle
- - setProgress:
+ (id)loadURL:(NSURL *)inURL consumer:(id)inConsumer options:(NSDictionary *)inOptions progress:(NSProgressIndicator *)inProgress parameter:(id)inParam
Creates an autoreleased instance and starts loading it. The caller must retain the URLLoader so that it is not autoreleased.
- (void)cancelLoadInBackground
Cancel the load.
- (id)initWithURL:(NSURL *)inURL consumer:(id)inConsumer options:(NSDictionary *)inOptions progress:(NSProgressIndicator *)inProgress parameter:(id)inParam
Initialize with the given parameters. Loading will not commence until beginLoadInBackground is invoked.
- (void)loadInBackground
Start loading the URL in the background. This is invoked for you from loadURL:consumer:options:parameter:
- (void)setProgress:(NSProgressIndicator *)inProgress
Canonical setter: retain the new guy; release the old guy; set.
- (NSURLHandle *)urlHandle
Return the NSURLHandle associated with this loading; useful for setting other options before invoking beginLoadInBackground.