kom.tools.web
Class HTTPClient

java.lang.Object
  |
  +--kom.tools.ipc.IPCClient
        |
        +--kom.tools.web.HTTPClient

public class HTTPClient
extends IPCClient

This is a subclass of IPCClient, used to communicate with other HTTP servers.


Field Summary
(package private)  java.lang.String boundary
           
static java.lang.String CL
           
protected  HTTPConfig config
          Configuration instance
protected  IPCConnection connection
          IP connection
(package private) static java.lang.String fSeparator
           
(package private) static char sepChar
           
protected  java.io.File tmpFile
           
 
Fields inherited from class kom.tools.ipc.IPCClient
connection
 
Constructor Summary
HTTPClient(java.lang.String host, int port, HTTPConfig config)
          Class constructor
 
Method Summary
 void close()
          Closes connection to remote host
private  int conn(boolean write, java.lang.String arg)
          Sends data over the wire to the remote host, or just counts bytes.
private  int handle(java.util.Hashtable data, boolean write)
          Converts data to lines according to protocol, counts characters and may send the data.
private  int handlefile(java.lang.String source, java.lang.String filename, boolean write)
          Converts file contents to HTTP data and counts bytes, may send contents.
 void receive()
          Receives data from remote host
 void send(java.util.Hashtable data)
          Sends data to remote host
private  void sendFile(java.io.File in)
          Sends contents of file over the wire
 java.io.File tempFile()
          Defines tmpFile
 
Methods inherited from class kom.tools.ipc.IPCClient
connect
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

config

protected HTTPConfig config
Configuration instance

connection

protected IPCConnection connection
IP connection

tmpFile

protected java.io.File tmpFile

boundary

java.lang.String boundary

fSeparator

static java.lang.String fSeparator

sepChar

static char sepChar

CL

public static final java.lang.String CL
Constructor Detail

HTTPClient

public HTTPClient(java.lang.String host,
                  int port,
                  HTTPConfig config)
Class constructor
Parameters:
host - Remote host address
port - Port on remote host
config - Configuration for this server
Method Detail

tempFile

public java.io.File tempFile()
Defines tmpFile

send

public void send(java.util.Hashtable data)
Sends data to remote host
Parameters:
data - Table of data to be sent

handle

private int handle(java.util.Hashtable data,
                   boolean write)
Converts data to lines according to protocol, counts characters and may send the data.
Parameters:
data - Table of data
write - true if data should be sent, not just counted
Returns:
Length of data in line form

handlefile

private int handlefile(java.lang.String source,
                       java.lang.String filename,
                       boolean write)
Converts file contents to HTTP data and counts bytes, may send contents.
Parameters:
source - File path except for filename
filename - Last part of file path
write - true if data should be sent, not just counted
Returns:
length of data

sendFile

private void sendFile(java.io.File in)
Sends contents of file over the wire
Parameters:
in - File to be sent

conn

private int conn(boolean write,
                 java.lang.String arg)
Sends data over the wire to the remote host, or just counts bytes.
Parameters:
write - true if data should be sent, otherwise the bytes are just counted
arg - String to be sent
Returns:
count of bytes in string

receive

public void receive()
Receives data from remote host

close

public void close()
Closes connection to remote host