Documentation Archive Developer
Search
[an error occurred while processing this directive] PATH  Documentation > WebObjects 4.5 > WebObjects Reference

Table of Contents

WOHTTPConnection


Inherits from: NSObject
Package: com.apple.yellow.webobjects


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 constructor's host and port parameters, and readResponse allows you to receive WOResponse objects from that same server.




Constructors



WOHTTPConnection

public WOHTTPConnection( String hostName, int portNumber)

Returns a WOHTTPConnection instance initialized with the specified host name and port number.


Instance Methods



connectTimeout

public int connectTimeout()

Returns the connection timeout interval in seconds.

See Also: receiveTimeout, sendTimeout, setConnectTimeout



keepAliveEnabled

public boolean keepAliveEnabled()

Returns whether the socket will be left open after requests are sent.

See Also: setKeepAliveEnabled



readResponse

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



receiveTimeout

public int receiveTimeout()

Returns the receive timeout interval in seconds.

See Also: connectTimeout, sendTimeout, setReceiveTimeout



sendRequest

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



sendTimeout

public int sendTimeout()

Returns the send timeout interval in seconds.

See Also: connectTimeout, receiveTimeout, setSendTimeout



setConnectTimeout

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



setKeepAliveEnabled

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



setReceiveTimeout

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



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




Table of Contents