AGSRequestOperation Class Reference
Description
This is a concurrent operation.
The request will be asynchronously kicked off from the thread that the operation was created on. The request will execute in the background. If the response size is above a certain threshold, then the operation may decide to parse the response in a child operation that it kicks off. Once the response has been parsed the action selectors will called from the thread that the operation was created on.
- This class encapsulates the logic for accessing secured (token or basic) resources. Including refreshing a token if it has expired. It also has the ability to perform the parsing of the response in a child operation so that the main thread of the application is not bogged down.
- This class, or a subclass thereof, is used by all the tasks execute requests across the wire.
- This class, or a subclass thereof, is also used by most of the layers for retrieving images or tiles.
- This class can be used directly, but you will probably use a subclass of it for getting back the response data in the format that you are looking for.
- Since:
- 1.0
List of all members.
Member Function Documentation
Creates a copy of the current operation to be re-added to the operation queue for resubmission. This is useful if a token expires and the operation needs to be resubmitted with a new token or set of credentials.
- Since:
- 1.0
Simple method to set finished & executing flags on the operation
- Since:
- 1.0
- (id) initWithRequest: |
|
(NSURLRequest *) |
req |
|
|
- (id) initWithURL: |
|
(NSURL *) |
url |
|
|
- (id) initWithURL: |
|
(NSURL *) |
url |
queryParameters: |
|
(NSDictionary *) |
query | |
|
|
| | |
Initialize an AGSRequestOperation
with the specified url and query parameters.
- Parameters:
-
| url | URL to initialize the request operation. |
| query | Query parameters to submit along with the request. |
- Returns:
- Initialized
AGSRequestOperation
.
- Since:
- 1.0
- (id) initWithURL: |
|
(NSURL *) |
url |
resource: |
|
(NSString *) |
resource |
queryParameters: |
|
(NSDictionary *) |
query | |
|
|
| | |
Initialize an AGSRequestOperation
with the specified url, resource, and query parameters.
- Parameters:
-
| url | URL to initialize the request operation. |
| resource | Resource to access off of the url. |
| query | Query parameters to submit along with the request to the resource. |
- Returns:
- Initialized
AGSRequestOperation
- Since:
- 1.0
- (id) initWithURL: |
|
(NSURL *) |
url |
resource: |
|
(NSString *) |
resource |
queryParameters: |
|
(NSDictionary *) |
query |
doPOST: |
|
(BOOL) |
post | |
|
|
| | |
Designated initializer. Initialize an AGSRequestOperation
with the specified url, resource, query parameters, and post flag.
- Parameters:
-
| url | URL to initialize the request operation. |
| resource | Resource to access off of the url. |
| query | Query parameters to submit along with the request to the resource. |
| post | Post flag to determine whether or not to use a GET or POST , |
- Returns:
- Initialized
AGSRequestOperation
- Since:
- 1.0
- (void) invokeActionSelector: |
|
(SEL) |
theSel |
withObject: |
|
(id) |
results | |
|
|
| | |
Derived classes can call this if they need to invoke the action or errorAction directly.
- Parameters:
-
| theSel | Selector to be called |
| results | object to be passed as an argument to theSel |
- Since:
- 1.0
- (NSError *) processError: |
|
(NSError *) |
error |
|
|
Method to override to process the error that results, if any, from a request
- Since:
- 1.0
- (id) processResultData: |
|
(NSData *) |
data |
|
|
Methods to override to process results and errors before sending them to the callbacks
- Parameters:
-
| data | to be processed from the request |
- Since:
- 1.0
- (void) setIsExecuting: |
|
(BOOL) |
executing |
|
|
Sets the executing flag.
- Parameters:
-
| executing | Boolean representing whether or not an operation is executing. |
- Since:
- 1.0
- (void) setIsFinished: |
|
(BOOL) |
finished |
|
|
Sets the finished flag.
- Parameters:
-
| finished | Boolean representing whether or not an operation is finished. |
- Since:
- 1.0
+ (NSOperationQueue *) sharedOperationQueue |
|
|
|
|
Class method to retrieve the shared operation queue that is handling all operations. This is where all AGSRequestOperations
will be queued.
- Since:
- 1.0
- (BOOL) shouldProcessResultDataInBackground: |
|
(NSData *) |
data |
|
|
Subclasses can override this if processing the data will take a long time and the superclass should call the process method on a bg thread.
- Parameters:
-
| data | to be processed in the background |
- Since:
- 1.0
Property Documentation
- (SEL) action [read, write, assign] |
Selector to be called if the operation succeeds.
- Since:
- 1.0
Credentials to access a secured resource.
- Since:
- 1.0
- (SEL) errorAction [read, write, assign] |
Selector to be called if the operation fails.
- Since:
- 1.0
- (BOOL) post [read, assign] |
Flag to determine whether or not the request is a GET
or POST
.
- Since:
- 1.0
- (NSDictionary*) query [read, copy] |
Query parameters to be used in the request to URL.
- Since:
- 1.0
- (NSURLRequest*) request [read, retain] |
Request object to be used instead of generating one on the fly.
- Since:
- 1.0
- (NSString*) resource [read, copy] |
String to append to the end of a url to access a specific resource, such as when exporting an image.
- Since:
- 1.0
- (NSMutableDictionary*) state [read, retain] |
A dictionary that can be filled with objects that need to be retrieved upon completion of an operation and are not passed back as results.
- Since:
- 1.0
- (id) target [read, write, assign] |
Target class to perform the operation from.
- Since:
- 1.0
- (NSURL*) URL [read, copy] |
URL of the resource to make a request from.
- Since:
- 1.0
- (BOOL) waitUntilActionSelectorIsDone [read, write, assign] |
Defaults to NO
, but it is helpful if this operation is a dependency for another operation and the action selector processes some results that the dependent operation needs before it can start.
- Since:
- 1.0