WebObjects 5.2.3

com.webobjects.eodistribution.client
Class EOHTTPChannel

java.lang.Object
  extended bycom.webobjects.eodistribution.client.EODistributionChannel
      extended bycom.webobjects.eodistribution.client.EOHTTPChannel

public class EOHTTPChannel
extends EODistributionChannel

An EOHTTPChannel is a concrete implementation of an EODistributionChannel which handles communication between the client and server in distributed Java Client applications using the HTTP protocol (POST commands).

EOHTTPChannels use regular sockets to establish the connection. You can subclass EOHTTPChannel and override the createSocket method if you want to use different kinds of sockets, for example to implement an SSL channel.


Nested Class Summary
 
Nested classes inherited from class com.webobjects.eodistribution.client.EODistributionChannel
EODistributionChannel.Delegate
 
Field Summary
static String ApplicationURLKey
          The name of the applicationURL connection key.
static String ComponentURLKey
          The name of the componentURL connection key.
static String PageKey
          The name of the page connection key.
static String SessionIDKey
          The name of the sessionID connection key.
 
Constructor Summary
EOHTTPChannel()
          Creates a new HTTP channel.
 
Method Summary
 NSArray connectionKeys()
          Returns the connection keys for EOHTTPChannels.
 Socket createSocket(String protocol, String hostName, int portNumber)
          Creates and returns a new socket to communicate with the server.
 void establishConnection()
          Establishes a connection with the server and begins communication using the HTTP protocol.
 Object responseToMessage(Object message, NSCoder coder)
          Sends the message message from the client to the server using the HTTP POST command.
 
Methods inherited from class com.webobjects.eodistribution.client.EODistributionChannel
channelWithName, connectionDictionary, delegate, setConnectionDictionary, setDelegate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ApplicationURLKey

public static final String ApplicationURLKey
The name of the applicationURL connection key. The application URL is the URL of the server application.


ComponentURLKey

public static final String ComponentURLKey
The name of the componentURL connection key. The component URL identifies the WOJavaClientComponent component used on the server side to represent the client.


PageKey

public static final String PageKey
The name of the page connection key. If specified, the channel connects to a WOJavaClientComponent on the page specified by name with this connection key (the default is the Main page).


SessionIDKey

public static final String SessionIDKey
The name of the sessionID connection key. The session ID identifies the session used on the server side for the client.

Constructor Detail

EOHTTPChannel

public EOHTTPChannel()
Creates a new HTTP channel.

Method Detail

connectionKeys

public NSArray connectionKeys()

Returns the connection keys for EOHTTPChannels. Not all the keys have to be specified, usually the application URL is sufficient:

applicationURL The URL of the server application.
componentURL The component URL of the WOJavaClientComponent on the server side.
sessionID The Session ID of the session on the server side.
page The page to connect to.

Specified by:
connectionKeys in class EODistributionChannel
Returns:
an array of the HTTP channel connection keys
See Also:
EODistributionChannel.setConnectionDictionary(NSDictionary)

createSocket

public Socket createSocket(String protocol,
                           String hostName,
                           int portNumber)
                    throws IOException
Creates and returns a new socket to communicate with the server. You can override this method if you wish to use different kinds of sockets, for example to implement an SSL channel.

Parameters:
protocol - the communication protocol to use
hostName - the name of the host to connect to
portNumber - the port number to connect to
Returns:
the socket
Throws:
IOException

establishConnection

public void establishConnection()
Establishes a connection with the server and begins communication using the HTTP protocol. The method retrieves host, port, and URL information from the connection dictionary (application URL). Throws an NSForwardException containing an IOException if a communication problem occurs and an IllegalArgumentException if required information is missing from the connection dictionary.

Specified by:
establishConnection in class EODistributionChannel
See Also:
EODistributionChannel.responseToMessage(Object, NSCoder)

responseToMessage

public Object responseToMessage(Object message,
                                NSCoder coder)
Sends the message message from the client to the server using the HTTP POST command. The message is encoded before it is sent using the coder coder. Synchronously receives, decodes, and returns the response to the message. Throws an IllegalStateException if the method is re-entered or an NSForwardException containing an IOException if a communication problem occurs.

Specified by:
responseToMessage in class EODistributionChannel
Parameters:
message - the message object to be sent to the server
coder - the coder to be used to encode the message object
Returns:
the message return value
See Also:
EODistributionChannel.establishConnection()

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.