WLResourceRequest Class Reference
| Inherits from | NSObject |
| Declared in | WLResourceRequest.h |
Overview
This class encapsulates a resource request. The resource may be an adapter on the MobileFirst server, or an external resource. The class provides several ‘send’ methods, with different inputs for the body of a request.
Tasks
-
urlproperty -
scopeproperty -
httpMethodproperty -
queryParametersproperty -
headersproperty -
timeoutIntervalproperty -
stringEncodingproperty -
+ requestWithURL:method: -
+ requestWithURL:method:scope: -
+ requestWithURL:method:timeout: -
+ requestWithURL:method:timeout:scope: -
– setQueryParameterValue:forName: -
– getQueryString -
– headerNames -
– headersForName: -
– headerForName: -
– setHeaderValue:forName: -
– addHeaderValue:forName: -
– removeHeadersForName: -
– sendWithCompletionHandler: -
– sendWithCompletionHandler:completionHandler: -
– sendWithDelegate: -
– sendWithDelegate:responseQueue: -
– sendWithBody:completionHandler: -
– sendWithBody:responseQueue:completionHandler: -
– sendWithBody:delegate: -
– sendWithBody:delegate:responseQueue: -
– sendWithFormParameters:completionHandler: -
– sendWithFormParameters:responseQueue:completionHandler: -
– sendWithFormParameters:delegate: -
– sendWithFormParameters:delegate:responseQueue: -
– sendWithJSON:completionHandler: -
– sendWithJSON:responseQueue:completionHandler: -
– sendWithJSON:delegate: -
– sendWithJSON:delegate:responseQueue: -
– sendWithData:completionHandler: -
– sendWithData:responseQueue:completionHandler: -
– sendWithData:delegate: -
– sendWithData:delegate:responseQueue:
Properties
headers
Array of request headers
@property (nonatomic) NSArray *headersDeclared In
WLResourceRequest.hhttpMethod
HTTP method of the request
@property (readonly) NSString *httpMethodDeclared In
WLResourceRequest.hqueryParameters
Dictionary of query parameters
@property (nonatomic) NSDictionary *queryParametersDeclared In
WLResourceRequest.hscope
Scope protecting the request
@property (readonly) NSString *scopeDeclared In
WLResourceRequest.hstringEncoding
Request string encoding
@property (nonatomic, assign) NSStringEncoding stringEncodingDeclared In
WLResourceRequest.hClass Methods
requestWithURL:method:
Creates an instance of WLresourceRequest with the specified URL and method
+ (WLResourceRequest *)requestWithURL:(NSURL *)url method:(NSString *)methodParameters
- url
URL of the request (full or relative to MobileFirst Server)
- method
Method of the request (POST, GET,…)
Declared In
WLResourceRequest.hrequestWithURL:method:scope:
Creates an instance of WLresourceRequest with the specified URL and method
+ (WLResourceRequest *)requestWithURL:(NSURL *)url method:(NSString *)method scope:(NSString *)scopeParameters
- url
URL of the request (full or relative to MobileFirst Server)
- method
Method of the request (POST, GET,…)
- scope
the scope that this protected resource requires
Declared In
WLResourceRequest.hrequestWithURL:method:timeout:
Creates an instance of WLresourceRequest with the specified URL, method, and timeout
+ (WLResourceRequest *)requestWithURL:(NSURL *)url method:(NSString *)method timeout:(NSTimeInterval)timeoutParameters
- url
URL of the request (full or relative to MobileFirst Server)
- method
Method of the request (POST, GET,…)
- timeout
Timeout of the request in seconds
Declared In
WLResourceRequest.hrequestWithURL:method:timeout:scope:
Creates an instance of WLresourceRequest with the specified URL, method, and timeout
+ (WLResourceRequest *)requestWithURL:(NSURL *)url method:(NSString *)method timeout:(NSTimeInterval)timeout scope:(NSString *)scopeParameters
- url
URL of the request (full or relative to MobileFirst Server)
- method
Method of the request (POST, GET,…)
- timeout
Timeout of the request in seconds
- scope
the scope that this protected resource requires
Declared In
WLResourceRequest.hInstance Methods
addHeaderValue:forName:
Adds the header to the request
- (void)addHeaderValue:(NSObject *)value forName:(NSString *)nameParameters
- value
Header value
- name
Header name
Discussion
If a header with the same name already exists, the values are concatenated and separated by commas.
Note: The header name is case insensitive.
Declared In
WLResourceRequest.hgetQueryString
Returns the query parameters as string
- (NSString *)getQueryStringDeclared In
WLResourceRequest.hheaderForName:
Returns first header with matching name
- (NSString *)headerForName:(NSString *)nameParameters
- name
name of the header
Declared In
WLResourceRequest.hheaderNames
Returns header names as an array of strings
- (NSArray *)headerNamesDeclared In
WLResourceRequest.hheadersForName:
Returns header name as an array of strings
- (NSArray *)headersForName:(NSString *)nameParameters
- name
Header name
Discussion
For a single header name, there can be several values separated by commas. If there is only one value, the method returns an array with one element.
Declared In
WLResourceRequest.hremoveHeadersForName:
Removes the header from the request
- (void)removeHeadersForName:(NSString *)nameParameters
- name
Header name
Declared In
WLResourceRequest.hsendWithBody:completionHandler:
Sends a request with the provided text as a request body and uses a completionHandler block to handle the response
- (void)sendWithBody:(NSString *)body completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- body
Request body
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithBody:delegate:
Sends a request with the provided text as a request body and uses a delegate to handle the response
- (void)sendWithBody:(NSString *)body delegate:(id)delegateParameters
- body
Request body
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols Note: The delegate must implement bothNSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithBody:delegate:responseQueue:
Sends a request with the provided text as a request body and uses a delegate to handle the response
- (void)sendWithBody:(NSString *)body delegate:(id)delegate responseQueue:(dispatch_queue_t)queueParameters
- body
Request body
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols
- queue
private queue to specify callback queue for delegate Note: The delegate must implement both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithBody:responseQueue:completionHandler:
Sends a request with the provided text as a request body and uses a completionHandler block to handle the response
- (void)sendWithBody:(NSString *)body responseQueue:(dispatch_queue_t)queue completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- body
Request body
- queue
private queue to specify callback queue for completionHandler block
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithCompletionHandler:
Sends a request and uses the completionHandler block to handle the response
- (void)sendWithCompletionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received.
Declared In
WLResourceRequest.hsendWithCompletionHandler:completionHandler:
Sends a request and uses the completionHandler block to handle the response
- (void)sendWithCompletionHandler:(dispatch_queue_t)queue completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- queue
private queue to specify callback queue for completionHandler block
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received.
Declared In
WLResourceRequest.hsendWithData:completionHandler:
Sends a request with the provided request data and uses completionHandler block to handle the response
- (void)sendWithData:(NSData *)data completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- data
Request data
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithData:delegate:
Sends a request with the provided request data and uses a delegate to handle the response
- (void)sendWithData:(NSData *)data delegate:(id)delegateParameters
- data
Request data
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols Note: The delegate must implement bothNSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body
Declared In
WLResourceRequest.hsendWithData:delegate:responseQueue:
Sends a request with the provided request data and uses a delegate to handle the response
- (void)sendWithData:(NSData *)data delegate:(id)delegate responseQueue:(dispatch_queue_t)queueParameters
- data
Request data
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols
- queue
private queue to specify callback queue for delegate Note: The delegate must implement both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body
Declared In
WLResourceRequest.hsendWithData:responseQueue:completionHandler:
Sends a request with the provided request data and uses completionHandler block to handle the response
- (void)sendWithData:(NSData *)data responseQueue:(dispatch_queue_t)queue completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- data
Request data
- queue
private queue to specify callback queue for completionHandler block
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithDelegate:
Sends a request and uses a delegate to handle the response
- (void)sendWithDelegate:(id)delegateParameters
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols Note: The delegate must implement bothNSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols.
Declared In
WLResourceRequest.hsendWithDelegate:responseQueue:
Sends a request and uses a delegate to handle the response
- (void)sendWithDelegate:(id)delegate responseQueue:(dispatch_queue_t)queueParameters
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols
- queue
private queue to specify callback queue for delegate Note: The delegate must implement both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols.
Declared In
WLResourceRequest.hsendWithFormParameters:completionHandler:
Sends a request with form parameters as a request body and uses a completionHandler block to handle the response
- (void)sendWithFormParameters:(NSDictionary *)formParameters completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
- bodyParameters
Dictionary of form parameters
Declared In
WLResourceRequest.hsendWithFormParameters:delegate:
Sends a request with form parameters as a request body and uses a delegate to handle the response
- (void)sendWithFormParameters:(NSDictionary *)formParameters delegate:(id)delegateParameters
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols Note: The delegate must implement bothNSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body.
- bodyParameters
Dictionary of form parameters
Declared In
WLResourceRequest.hsendWithFormParameters:delegate:responseQueue:
Sends a request with form parameters as a request body and uses a delegate to handle the response
- (void)sendWithFormParameters:(NSDictionary *)formParameters delegate:(id)delegate responseQueue:(dispatch_queue_t)queueParameters
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols
- queue
private queue to specify callback queue for delegate Note: The delegate must implement both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body.
- bodyParameters
Dictionary of form parameters
Declared In
WLResourceRequest.hsendWithFormParameters:responseQueue:completionHandler:
Sends a request with form parameters as a request body and uses a completionHandler block to handle the response
- (void)sendWithFormParameters:(NSDictionary *)formParameters responseQueue:(dispatch_queue_t)queue completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- queue
private queue to specify callback queue for completionHandler block
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
- bodyParameters
Dictionary of form parameters
Declared In
WLResourceRequest.hsendWithJSON:completionHandler:
Sends a request with the provided JSON and uses a completionHandler block to handle the response
- (void)sendWithJSON:(NSDictionary *)json completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- json
JSON as a dictionary
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithJSON:delegate:
Sends a request with the provided JSON and uses a delegate to handle the response
- (void)sendWithJSON:(NSDictionary *)json delegate:(id)delegateParameters
- json
JSON as a dictionary
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols Note: The delegate must implement bothNSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithJSON:delegate:responseQueue:
Sends a request with the provided JSON and uses a delegate to handle the response
- (void)sendWithJSON:(NSDictionary *)json delegate:(id)delegate responseQueue:(dispatch_queue_t)queueParameters
- json
JSON as a dictionary
- delegate
Delegate that conforms to both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols
- queue
private queue to specify callback queue for delegate Note: The delegate must implement both
NSURLSessionDataDelegateandNSURLSessionTaskDelegateprotocols. Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsendWithJSON:responseQueue:completionHandler:
Sends a request with the provided JSON and uses a completionHandler block to handle the response
- (void)sendWithJSON:(NSDictionary *)json responseQueue:(dispatch_queue_t)queue completionHandler:(void ( ^ ) ( WLResponse *response , NSError *error ))completionHandlerParameters
- json
JSON as a dictionary
- queue
private queue to specify callback queue for completionHandler block
- completionHandler
(void(^) (WLResponse response, NSError error)) Block that is triggered when a response has been received Note: Using methods other than POST or PUT will omit the request body.
Declared In
WLResourceRequest.hsetHeaderValue:forName:
Sets the header for the request
- (void)setHeaderValue:(NSObject *)value forName:(NSString *)nameParameters
- value
Header value
- name
Header name
Discussion
If a header with the same name already exists, it is overridden.
Note: The header name is case insensitive.
Declared In
WLResourceRequest.hsetQueryParameterValue:forName:
Sets query parameter value
- (void)setQueryParameterValue:(NSString *)parameterValue forName:(NSString *)parameterNameParameters
- parameterValue
Parameter value
- parameterName
Parameter name
Discussion
If the query parameter with the same name already exists, it is overridden.
Declared In
WLResourceRequest.h