TTURLRequest Class Reference
The Three20 network request object, built to work with the Three20 cache and co. More...
#import <TTURLRequest.h>
Public Member Functions | |
| (id) | - initWithURL:delegate: |
| (void) | - setValue:forHTTPHeaderField: |
| (void) | - addFile:mimeType:fileName: |
| Add a file whose data will be posted. | |
| (BOOL) | - send |
| Attempt to send a request. | |
| (BOOL) | - sendSynchronously |
| Attempt to send a synchronous request. | |
| (void) | - cancel |
| Cancel the request. | |
| (NSURLRequest *) | - createNSURLRequest |
Static Public Member Functions | |
| (TTURLRequest *) | + request |
| (TTURLRequest *) | + requestWithURL:delegate: |
Protected Attributes | |
| NSString * | _urlPath |
| NSString * | _httpMethod |
| NSData * | _httpBody |
| NSMutableDictionary * | _parameters |
| NSMutableDictionary * | _headers |
| NSString * | _contentType |
| NSStringEncoding | _charsetForMultipart |
| NSMutableArray * | _files |
| id< TTURLResponse > | _response |
| TTURLRequestCachePolicy | _cachePolicy |
| NSTimeInterval | _cacheExpirationAge |
| NSString * | _cacheKey |
| NSDate * | _timestamp |
| NSInteger | _totalBytesLoaded |
| NSInteger | _totalBytesExpected |
| NSInteger | _totalBytesDownloaded |
| NSInteger | _totalContentLength |
| id | _userInfo |
| BOOL | _isLoading |
| BOOL | _shouldHandleCookies |
| BOOL | _respondedFromCache |
| BOOL | _filterPasswordLogging |
| NSMutableArray * | _delegates |
Properties | |
| NSString * | urlPath |
| The URL path to be loaded by the request. | |
| NSString *URL | __TTDEPRECATED_METHOD |
| The URL path to be loaded by the request. | |
| NSString * | httpMethod |
| id< TTURLResponse > | response |
| An object that handles the response data and may parse and validate it. | |
| NSData * | httpBody |
| The HTTP body to send with the request. | |
| NSString * | contentType |
| The content type of the data in the request. | |
| NSMutableDictionary * | parameters |
| Parameters to use for an HTTP POST/PUT. | |
| NSMutableDictionary * | headers |
| Custom HTTP headers. | |
| TTURLRequestCachePolicy | cachePolicy |
| TTURLRequestCachePolicyDefault | |
| NSTimeInterval | cacheExpirationAge |
| The maximum age of cached data that can be used as a response. | |
| NSString * | cacheKey |
| If no cache key is provided, a unique key is generated from the request data. | |
| id | userInfo |
| A dummy object used to uniquely identify this request object once it's been sent into the fray. | |
| NSDate * | timestamp |
| BOOL | isLoading |
| Whether or not the request is currently active. | |
| BOOL | shouldHandleCookies |
| Decide whether default cookie handling will happen for this request. | |
| NSInteger | totalBytesLoaded |
| The number of bytes loaded by this request. | |
| NSInteger | totalBytesExpected |
| The number of expected bytes from this request. | |
| NSInteger | totalBytesDownloaded |
| The number of downloaded bytes from server. | |
| NSInteger | totalContentLength |
| The number of content length of request. | |
| BOOL | respondedFromCache |
| Whether or not the request was loaded from the cache. | |
| BOOL | filterPasswordLogging |
| Whether parameters named "password" should be suppressed in log messages. | |
| NSStringEncoding | charsetForMultipart |
| Charset to use when creating multipart/form-data data. | |
| NSMutableArray * | delegates |
| An array of non-retained objects that receive messages about the progress of the request. | |
Detailed Description
The Three20 network request object, built to work with the Three20 cache and co.
Allows customization of the http method, body, and parameters, as well as natural response processing using TTURLResponse objects.
Member Function Documentation
| - (void) cancel |
Cancel the request.
If there are multiple requests going to the same URL as this request, the others will not be cancelled.
| - (BOOL) send |
Attempt to send a request.
If the request can be resolved by the cache, it will happen synchronously. Otherwise, the request will respond to its delegate asynchronously.
- Returns:
- YES if the request was loaded synchronously from the cache.
| - (BOOL) sendSynchronously |
Attempt to send a synchronous request.
The request will happen synchronously, regardless of whether the data is being grabbed from the network or from the cache.
- Returns:
- YES if the request was loaded from the cache.
Property Documentation
- (NSString* URL) __TTDEPRECATED_METHOD [read, write, copy] |
The URL path to be loaded by the request.
Deprecated due to name ambiguity. Use urlPath instead. Remove after May 6, 2010.
- (NSTimeInterval) cacheExpirationAge [read, write, assign] |
The maximum age of cached data that can be used as a response.
TT_DEFAULT_CACHE_EXPIRATION_AGE (1 week)
- (NSString *) cacheKey [read, write, copy] |
If no cache key is provided, a unique key is generated from the request data.
If the request is a POST/PUT request, then the POST/PUT parameters are also used to generate the cache key.
By setting the cacheKey, you may override the default cache key generator with your own.
- (NSStringEncoding) charsetForMultipart [read, write, assign] |
Charset to use when creating multipart/form-data data.
NSUTF8StringEncoding to remain backwards compatible.
- (NSString *) contentType [read, write, copy] |
The content type of the data in the request.
If not provided and httpMethod is POST/PUT, then contentType is "multipart/form-data".
- (NSData *) httpBody [read, write, retain] |
The HTTP body to send with the request.
If provided, will always be used. Please consider this when using POST/PUT methods: if httpBody is provided, then the POST/PUT data generated from the parameters property will not be used.
- (BOOL) respondedFromCache [read, write, assign] |
Whether or not the request was loaded from the cache.
This is only valid after the request has completed.
- (id<TTURLResponse>) response [read, write, retain] |
An object that handles the response data and may parse and validate it.
- (BOOL) shouldHandleCookies [read, write, assign] |
Decide whether default cookie handling will happen for this request.
- Parameters:
-
YES if cookies should be sent with and set for this request; otherwise NO. The default is YES - in other words, cookies are sent from and stored to the cookie manager by default.
YES
- (id) userInfo [read, write, retain] |
A dummy object used to uniquely identify this request object once it's been sent into the fray.
Generally TTUserInfo objects are used here.
- See also:
- TTUserInfo
The documentation for this class was generated from the following files:
- Three20Network/Headers/TTURLRequest.h
- Three20Network/Sources/TTURLRequest.m
