fix
Class HttpClient

java.lang.Object
  extended by fix.HttpClient

public class HttpClient
extends java.lang.Object


Field Summary
private  boolean debug
           
private  ErrorWindow er
           
private static boolean error
           
private  long max
           
private  java.lang.String NEWLINE
           
 java.io.DataOutputStream out
           
private  long reached
           
private  java.lang.String response
           
private  java.net.Socket socket
           
private static javax.net.ssl.SSLSocketFactory sslSocketFactory
           
 
Constructor Summary
HttpClient(ErrorWindow e, boolean d)
          The standard constructor for this class.
 
Method Summary
 void connect(java.lang.String host)
          Establishes a connection to the given host URL by using httpConnect() or httpsConnect()
 int getPort(java.lang.String protocol)
          Gets the port number from the given protocol.
 java.net.Socket getSocket()
          Gets the Socket for use in other classes
 javax.net.ssl.SSLSocketFactory getSocketFactory()
          Returns a SSL Factory instance that accepts all server certificates.
 void httpConnect(java.lang.String host, int port)
          Establishes a HTTP-Connection using a Socket
 void httpsConnect(java.lang.String host, int port)
          Establishes a HTTPS-Connection using a Socket.
 void nl()
          Sends a newline (\r\n) to the Server using the send method
 java.lang.String[] parseURL(java.lang.String address)
          Parses the given URL address and returns an array existing of: [0]: Protocol (http, https) [1]: Host-Address [2]: the Host-Port as a String [3]: the Requested File.
 void send(byte[] HTTP)
          Sends a HTTP-MIME-Message to the Server.
 void send(java.lang.String HTTP)
          Sends a HTTP-MIME-Message to the Server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

private java.net.Socket socket

NEWLINE

private java.lang.String NEWLINE

out

public java.io.DataOutputStream out

response

private java.lang.String response

max

private long max

reached

private long reached

er

private ErrorWindow er

error

private static boolean error

sslSocketFactory

private static javax.net.ssl.SSLSocketFactory sslSocketFactory

debug

private boolean debug
Constructor Detail

HttpClient

public HttpClient(ErrorWindow e,
                  boolean d)
The standard constructor for this class.

Parameters:
e - The instance of ErrorWindow the errors are displayed with.
d - The debug value, if true the debugging is enabled.
Method Detail

connect

public void connect(java.lang.String host)
Establishes a connection to the given host URL by using httpConnect() or httpsConnect()

Parameters:
host - URL to connect to

httpConnect

public void httpConnect(java.lang.String host,
                        int port)
Establishes a HTTP-Connection using a Socket

Parameters:
host - The hostname to connect to

httpsConnect

public void httpsConnect(java.lang.String host,
                         int port)
Establishes a HTTPS-Connection using a Socket.

Parameters:
host - The host name to connect to

send

public void send(java.lang.String HTTP)
Sends a HTTP-MIME-Message to the Server.

Parameters:
HTTP - the message to send

send

public void send(byte[] HTTP)
Sends a HTTP-MIME-Message to the Server.

Parameters:
HTTP - the message to send

nl

public void nl()
Sends a newline (\r\n) to the Server using the send method


parseURL

public java.lang.String[] parseURL(java.lang.String address)
Parses the given URL address and returns an array existing of: [0]: Protocol (http, https) [1]: Host-Address [2]: the Host-Port as a String [3]: the Requested File. If the protocol is not http oder https a IllegalArgumentException will be thrown

Parameters:
address - the URL address to be parsed
Returns:
String[] as described above

getPort

public int getPort(java.lang.String protocol)
Gets the port number from the given protocol.

Parameters:
protocol -
Returns:
port 443 if the protocol is https 80 else

getSocket

public java.net.Socket getSocket()
Gets the Socket for use in other classes

Returns:
socket

getSocketFactory

public final javax.net.ssl.SSLSocketFactory getSocketFactory()
Returns a SSL Factory instance that accepts all server certificates. use:
SSLSocket sock =
     (SSLSocket) getSocketFactory.createSocket ( host, port ); 

Returns:
An SSL-specific socket factory.