#import <BLIPRequest.h>
Inherits BLIPMessage.
Public Member Functions | |
| (BLIPResponse *) | - send |
| Sends this request over its connection. | |
| (void) | - deferResponse |
| Call this when a request arrives, to indicate that you want to respond to it later. | |
| (void) | - respondWithData:contentType: |
| Shortcut to respond to this request with the given data. | |
| (void) | - respondWithString: |
| Shortcut to respond to this request with the given string (which will be encoded in UTF-8). | |
| (void) | - respondWithError: |
| Shortcut to respond to this request with an error. | |
| (void) | - respondWithErrorCode:message: |
| Shortcut to respond to this request with the given error code and message. | |
| (void) | - respondWithException: |
| Shortcut to respond to this message with an error indicating that an exception occurred. | |
Static Public Member Functions | |
| (BLIPRequest *) | + requestWithBody: |
| Creates an outgoing request. | |
| (BLIPRequest *) | + requestWithBody:properties: |
| Creates an outgoing request. | |
Properties | |
| retain BLIPConnection * | connection |
| BLIPRequest extends the -connection property to be settable. | |
| BOOL | noReply |
| Does this request not need a response? This property can only be set before sending the request. | |
| readonly BOOL | repliedTo |
| Returns YES if you've replied to this request (by accessing its -response property. | |
| readonly BLIPResponse * | response |
| The request's response. | |
| + (BLIPRequest *) requestWithBody: | (NSData*) | body |
Creates an outgoing request.
The body may be nil. The request is not associated with any BLIPConnection yet, so you must either set its connection property before calling -send, or pass the request as a parameter to -[BLIPConnection sendRequest:].
| + (BLIPRequest *) requestWithBody: | (NSData*) | body | ||
| properties: | (NSDictionary*) | properties | ||
Creates an outgoing request.
The body or properties may be nil. The request is not associated with any BLIPConnection yet, so you must either set its connection property before calling -send, or pass the request as a parameter to -[BLIPConnection sendRequest:].
| - (BLIPResponse *) send |
Sends this request over its connection.
(Actually, the connection queues it to be sent; this method always returns immediately.) Its matching response object will be returned, or nil if the request couldn't be sent. If this request has not been assigned to a connection, an exception will be raised.
| - (void) deferResponse |
Call this when a request arrives, to indicate that you want to respond to it later.
It will prevent a default empty response from being sent upon return from the request handler.
| - (void) respondWithData: | (NSData*) | data | ||
| contentType: | (NSString*) | contentType | ||
Shortcut to respond to this request with the given data.
The contentType, if not nil, is stored in the "Content-Type" property.
| - (void) respondWithString: | (NSString*) | string |
Shortcut to respond to this request with the given string (which will be encoded in UTF-8).
| - (void) respondWithError: | (NSError*) | error |
Shortcut to respond to this request with an error.
| - (void) respondWithErrorCode: | (int) | code | ||
| message: | (NSString*) | message | ||
Shortcut to respond to this request with the given error code and message.
The BLIPErrorDomain is assumed.
| - (void) respondWithException: | (NSException*) | exception |
Shortcut to respond to this message with an error indicating that an exception occurred.
| - (BLIPConnection *) connection |
BLIPRequest extends the -connection property to be settable.
This allows a request to be created without a connection (i.e. before the connection is created). It can later be sent by setting the connection property and calling -send.
Reimplemented from BLIPMessage.
| - (BOOL) noReply |
Does this request not need a response? This property can only be set before sending the request.
| - (BOOL) repliedTo |
Returns YES if you've replied to this request (by accessing its -response property.
)
| - (BLIPResponse *) response |
The request's response.
This can be accessed at any time, even before sending the request, but the contents of the response won't be filled in until it arrives, of course.
1.5.4