WOHTTPConnection
Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: WebObjects/WOHTTPConnection.h
Class Description
The WOHTTPConnection class is intended to be used as a client for HTTP communications. It gives you direct access to the HTTP contents and headers. WOHTTPConnection's sendRequest: method allows you to send a WORequest object directly to the server specified by the init method's host and port parameters, and readResponse allows you to receive WOResponse objects from that same server.
Instance Methods
connectTimeout
- (int)connectTimeout
Returns the connection timeout interval in seconds.
See Also: - receiveTimeout, - sendTimeout, - setConnectTimeout:
initWithHost:onPort:
- (id)initWithHost:(NSString*)hostName
onPort:(unsigned int)portNumber
keepAliveEnabled
- (BOOL)keepAliveEnabled
Returns whether the socket will be left open after requests are sent.
See Also: - setKeepAliveEnabled:
readResponse
- (WOResponse *)readResponse
Reads a response from the server and returns it as a WOResponse object. This method blocks until the contents of the response have been fully received. Returns nil if an error is detected while reading or interpreting the response.
readResponse sets the keep-alive enabled flag to NO unless the response indicates that the connection should be held open.
See Also: - sendRequest:
receiveTimeout
- (int)receiveTimeout
Returns the receive timeout interval in seconds.
See Also: - connectTimeout, - sendTimeout, - setReceiveTimeout:
sendRequest:
- (BOOL)sendRequest:(WORequest*)aRequest
Opens a socket connection to the server indicated by the receiver's host name and port number and writes aRequest to that socket. Returns YES if the socket is being held open for a subsequent invocation of sendRequest:, or NO if is has been closed. Use the setKeepAliveEnabled: method to control whether the socket is to be held open.
Raises an NSGenericException if the socket connection cannot be established.
See Also: - readResponse
sendTimeout
- (int)sendTimeout
Returns the send timeout interval in seconds.
See Also: - connectTimeout, - receiveTimeout, - setSendTimeout:
setConnectTimeout:
- (void)setConnectTimeout:(int)timeout
Sets the connection timeout interval to timeout seconds. The default value for this timeout is 5 seconds unless overridden by the WOHTTPConnectTimeout user default.
See Also: - setReceiveTimeout:, - setSendTimeout:
setKeepAliveEnabled:
- (void)setKeepAliveEnabled:(BOOL)flag
Specifies according to flag whether the socket is to be left open after each request has been sent so that subsequent requests don't require the socket to be re-opened.
See Also: - keepAliveEnabled, - readResponse, - sendRequest:
setReceiveTimeout:
- (void)setReceiveTimeout:(int)timeout
Sets the receive timeout interval to timeout seconds. The default value for this timeout is 30 seconds unless overridden by the WOHTTPReceiveTimeout user default.
See Also: - setConnectTimeout:, - setSendTimeout:
setSendTimeout:
- (void)setSendTimeout:(int)timeout
Sets the send timeout interval to timeout seconds. The default value for this timeout is 10 seconds unless overridden by the WOHTTPSendTimeout user default.
See Also: - setConnectTimeout:, - setReceiveTimeout: