marquee.xmlrpc
Interface XmlRpcClientConnection


public interface XmlRpcClientConnection

A connection from a client to a server.

The methods in this interface must be called in the following order:

  1. setOutputContentLength, setKeepAlive, setGzip
  2. getOutputStream
  3. getInputStream
  4. getInputContentLength, isServerKeepAlive, isInputGzipped
  5. close

If isServerKeepAlive returns true then the caller can go back to the start rather than calling close

Version:
$Revision: 1.3 $
Author:
Toby Allsopp

Method Summary
 void close()
          Closes the connection to the server.
 int getInputContentLength()
           
 java.io.InputStream getInputStream()
           
 java.io.OutputStream getOutputStream()
          Returns an OutputStream on which the request can be written.
 boolean isInputGzipped()
           
 boolean isServerKeepAlive()
           
 void setGzip(boolean gzip)
          Sets whether or not the server should be informed that the request will be gzip encoded.
 void setKeepAlive(boolean keepAlive)
          Sets whether or not the server will be asked to make the connection persistent.
 void setOutputContentLength(int contentLength)
          Sets the number of bytes that will be written, i.e.
 

Method Detail

setOutputContentLength

void setOutputContentLength(int contentLength)
Sets the number of bytes that will be written, i.e. the size of the request.

Parameters:
contentLength - the number of bytes that will be written

setKeepAlive

void setKeepAlive(boolean keepAlive)
Sets whether or not the server will be asked to make the connection persistent.

Parameters:
keepAlive - true, to make the connection persistent

setGzip

void setGzip(boolean gzip)
Sets whether or not the server should be informed that the request will be gzip encoded. Note that this does not cause the request to be gzip encoded; that must be done by the caller.

Parameters:
gzip - true to gzip!

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns an OutputStream on which the request can be written. The request should be completely written and the OutputStream closed before calling getInputStream.

Returns:
an OutputStream on which the request can be written
Throws:
java.io.IOException - for the same reasons, any Stream causes an IOException

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns:
an InputStream from which the result can be read.
Throws:
java.io.IOException - for the same reasons, any Stream causes an IOException

getInputContentLength

int getInputContentLength()
Returns:
the number of bytes in the response.

isServerKeepAlive

boolean isServerKeepAlive()
Returns:
whether the server has agreed to make the connection persistent. If this returns true then getOutputStream may be called again, otherwise close must be called.

isInputGzipped

boolean isInputGzipped()
Returns:
whether the response is gzip encoded. If it is then the caller must decode it.

close

void close()
           throws java.io.IOException
Closes the connection to the server.

Throws:
java.io.IOException - in case of an IO Error.