ActiveResourceKit  v1.2 (498.0)
 All Classes Files Functions Variables Typedefs Enumerator Properties Macros Pages
Instance Methods | Properties | List of all members
ARHTTPResponse Class Reference

Wraps HTTP response and body. More...

#import <ARHTTPResponse.h>

Inheritance diagram for ARHTTPResponse:
Inheritance graph
[legend]
Collaboration diagram for ARHTTPResponse:
Collaboration graph
[legend]

Instance Methods

(id) - initWithHTTPURLResponse:body:
 Shortcut for allocating, initialising then setting the URL response and body.
 
(id) - initWithURLResponse:body:
 Creates an Active Resource HTTP response based on a response-data pair, the kind typically delivered by Apple's URL connection programming interface.
 
(NSInteger) - code
 
(NSDictionary *) - headerFields
 

Properties

NSHTTPURLResponse * URLResponse
 The underlying URL response object.
 
id body
 The response body in some form.
 

Detailed Description

Wraps HTTP response and body.

Apple's URL connection programming interface delivers HTTP response information in two separate pieces: a response object and a block of data for the response body. This class combines these two pieces together again. You can pass around a response, ask for its status code, header fields and body. You can also decode and replace the body if required.

Can this class safely sub-class NSHTTPURLResponse? That may be possible since the class does not explicitly belong to a class cluster. Nevertheless, ARHTTPResponse does not sub-class it because the Active Resource response presents a more Ruby-compatible interface. You can still access the underlying Cocoa response object by sending URLResponse.

Definition at line 41 of file ARHTTPResponse.h.

Method Documentation

- (NSInteger) code

Definition at line 56 of file ARHTTPResponse.m.

- (NSDictionary *) headerFields

Definition at line 61 of file ARHTTPResponse.m.

- (id) initWithHTTPURLResponse: (NSHTTPURLResponse *)  URLResponse
body: (id)  body 

Shortcut for allocating, initialising then setting the URL response and body.

Not the designated initialiser.

Definition at line 32 of file ARHTTPResponse.m.

- (id) initWithURLResponse: (NSURLResponse *)  URLResponse
body: (id)  body 

Creates an Active Resource HTTP response based on a response-data pair, the kind typically delivered by Apple's URL connection programming interface.

Returns
Answers a new HTTP response wrapper or nil if the given response is not a HTTP URL response. Answering nil is an expected response from this method if the requests from which the responses derive do not use the HTTP protocol.

Definition at line 43 of file ARHTTPResponse.m.

Property Documentation

- (id) body
readwriteatomicstrong

The response body in some form.

Note that you can rewrite the body, e.g. when handling decompression. Hence the body has generic object type. It always starts out as NSData but can become other types such as NSString after decoding.

Definition at line 54 of file ARHTTPResponse.h.

- (NSHTTPURLResponse*) URLResponse
readwriteatomicstrong

The underlying URL response object.

Definition at line 46 of file ARHTTPResponse.h.


The documentation for this class was generated from the following files: