RKRequest Class Reference
Inherits from | NSObject |
Declared in | RKRequest.h RKRequest.m |
Overview
Background Request Policy
On iOS 4.x and higher, UIKit provides support for continueing activities for a limited amount of time in the background. RestKit provides simple support for continuing a request when in the background.
Tasks
-
URL
The URL this request is loading
property -
resourcePath
The resourcePath portion of this loader’s URL
property -
method
The HTTP verb the request is sent via
property -
params
A serializable collection of parameters sent as the HTTP Body of the request
property -
delegate
The delegate to inform when the request is completed
property -
additionalHTTPHeaders
A Dictionary of additional HTTP Headers to send with the request
property -
userData
An opaque pointer to associate user defined data with the request.
property -
backgroundPolicy
The policy to take on transition to the background (iOS 4.x and higher only)
property -
username
Credentials for HTTP AUTH Challenge
property -
URLRequest
The underlying NSMutableURLRequest sent for this request
property -
HTTPMethod
The HTTP method as a string used for this request
property -
+ requestWithURL:delegate:
Return a REST request that is ready for dispatching
-
– initWithURL:
Initialize a synchronous request
-
– initWithURL:delegate:
Initialize a REST request and prepare it for dispatching
-
– prepareURLRequest
Setup the NSURLRequest. The request must be prepared right before dispatching
-
– send
Send the request asynchronously. It will be added to the queue and dispatched as soon as possible.
-
– sendAsynchronously
Immediately dispatch a request asynchronously, skipping the request queue
-
– sendSynchronously
Send the request synchronously and return a hydrated response object
-
– didFailLoadWithError:
Callback performed to notify the request that the underlying NSURLConnection has failed with an error.
-
– didFinishLoad:
Callback performed to notify the request that the underlying NSURLConnection has completed with a response.
-
– cancel
Cancels the underlying URL connection. This will send the requestDidCancel: delegate method if your delegate responds to it. It then nils out the delegate to ensure no more messages are sent to it.
-
– isGET
Returns YES when this is a GET request
-
– isPOST
Returns YES when this is a POST request
-
– isPUT
Returns YES when this is a PUT request
-
– isDELETE
Returns YES when this is a DELETE request
-
– isLoading
Returns YES when this request is in-progress
-
– isLoaded
Returns YES when this request has been completed
-
– wasSentToResourcePath:
Returns YES when the request was sent to the specified resource path
Properties
HTTPMethod
The HTTP method as a string used for this request
@property (nonatomic, readonly) NSString *HTTPMethod
Declared In
RKRequest.h
URL
The URL this request is loading
@property (nonatomic, readonly) NSURL *URL
Declared In
RKRequest.h
URLRequest
The underlying NSMutableURLRequest sent for this request
@property (nonatomic, readonly) NSMutableURLRequest *URLRequest
Declared In
RKRequest.h
additionalHTTPHeaders
A Dictionary of additional HTTP Headers to send with the request
@property (nonatomic, retain) NSDictionary *additionalHTTPHeaders
Declared In
RKRequest.h
backgroundPolicy
The policy to take on transition to the background (iOS 4.x and higher only)
@property (nonatomic, assign) RKRequestBackgroundPolicy backgroundPolicy
Discussion
Default: RKRequestBackgroundPolicyCancel
Declared In
RKRequest.h
delegate
The delegate to inform when the request is completed
@property (nonatomic, assign) NSObject<RKRequestDelegate> *delegate
Discussion
If the object implements the RKRequestDelegate protocol, it will receive request lifecycle event messages.
Declared In
RKRequest.h
method
The HTTP verb the request is sent via
@property (nonatomic, assign) RKRequestMethod method
Discussion
@default RKRequestMethodGET
Declared In
RKRequest.h
params
A serializable collection of parameters sent as the HTTP Body of the request
@property (nonatomic, retain) NSObject<RKRequestSerializable> *params
Declared In
RKRequest.h
resourcePath
The resourcePath portion of this loader’s URL
@property (nonatomic, readonly) NSString *resourcePath
Declared In
RKRequest.h
Instance Methods
cancel
Cancels the underlying URL connection. This will send the requestDidCancel: delegate method if your delegate responds to it. It then nils out the delegate to ensure no more messages are sent to it.
- (void)cancel
Declared In
RKRequest.h
didFailLoadWithError:
Callback performed to notify the request that the underlying NSURLConnection has failed with an error.
- (void)didFailLoadWithError:(NSError *)error
Declared In
RKRequest.h
didFinishLoad:
Callback performed to notify the request that the underlying NSURLConnection has completed with a response.
- (void)didFinishLoad:(RKResponse *)response
Declared In
RKRequest.h
initWithURL:
Initialize a synchronous request
- (id)initWithURL:(NSURL *)URL
Declared In
RKRequest.h
initWithURL:delegate:
Initialize a REST request and prepare it for dispatching
- (id)initWithURL:(NSURL *)URL delegate:(id)delegate
Declared In
RKRequest.h
prepareURLRequest
Setup the NSURLRequest. The request must be prepared right before dispatching
- (void)prepareURLRequest
Declared In
RKRequest.h
send
Send the request asynchronously. It will be added to the queue and dispatched as soon as possible.
- (void)send
Declared In
RKRequest.h
sendAsynchronously
Immediately dispatch a request asynchronously, skipping the request queue
- (void)sendAsynchronously
Declared In
RKRequest.h