Inherits from: NSObject
Package: com.apple.yellow.webobjects
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 constructor's host and port parameters, and readResponse allows you to receive WOResponse objects from that same server.
public WOHTTPConnection(
String hostName,
int portNumber)
public int connectTimeout()
Returns the connection timeout interval in seconds.
See Also: receiveTimeout, sendTimeout, setConnectTimeout
public boolean keepAliveEnabled()
Returns whether the socket will be left open after requests are sent.
See Also: setKeepAliveEnabled
public 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 null if an error is detected while reading or interpreting the response.
readResponse sets the keep-alive enabled flag to false unless the response indicates that the connection should be held open.
See Also: sendRequest
public int receiveTimeout()
Returns the receive timeout interval in seconds.
See Also: connectTimeout, sendTimeout, setReceiveTimeout
public boolean 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 true if the socket is being held open for a subsequent invocation of sendRequest, or false if is has been closed. Use the setKeepAliveEnabled method to control whether the socket is to be held open.
Throws an exception if the socket connection cannot be established.
See Also: readResponse
public int sendTimeout()
Returns the send timeout interval in seconds.
See Also: connectTimeout, receiveTimeout, setSendTimeout
public void setConnectTimeout(int timeout)
Sets the connection timeout interval to timeout in seconds. The default value for this timeout is 5 seconds unless overridden by the WOHTTPConnectTimeout user default.
See Also: setReceiveTimeout, setSendTimeout
public void setKeepAliveEnabled(boolean 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
public void setReceiveTimeout(int timeout)
Sets the receive timeout interval to timeout in seconds. The default value for this timeout is 30 seconds unless overridden by the WOHTTPReceiveTimeout user default.
See Also: setConnectTimeout, setSendTimeout
public void setSendTimeout(int timeout)
Sets the send timeout interval to timeout in seconds. The default value for this timeout is 10 seconds unless overridden by the WOHTTPSendTimeout user default.
See Also: setConnectTimeout, setReceiveTimeout