com.bankframe.ei.channel.client
Class HttpClient

java.lang.Object
  extended bycom.bankframe.ei.channel.client.HttpClient
All Implemented Interfaces:
ChannelClient
Direct Known Subclasses:
CookieClient, HttpsClient, StoreAndForwardHttpClient

public class HttpClient
extends java.lang.Object
implements ChannelClient

This class is used by fat clients (Java apps, applets etc to communicate with BankFrameMCA over HTTP connections. The communication takes place between this client and a servlet (of type com.bankframe.ei.channel.server.HttpServer). The servlet is a HttpServer object that will process the request. This client and the corresponding server both share a codec that is used to allow data to be sent over the HTTP connection. Data that is sent over the wire is converted to a string representation by using this specified codec class. The properties (server url, content-type) are specified in the BankFrameResource.properties file.


Field Summary
 java.lang.String separator
          Get the character used to seperate key value pairs.
 
Constructor Summary
HttpClient()
          HttpClient constructor.
HttpClient(java.lang.String urlString, java.lang.String contentTypeParam)
          Constructor
 
Method Summary
 Codec getCodec()
           
 java.lang.String getContentType()
           
 java.net.URL getURL()
           
 java.util.Vector send(DataPacket dp)
          This is a convenience method to send a single DataPacket without having to wrap it in a Vector.
 java.util.Vector send(java.util.Vector dataPackets)
          All ChannelManagers must support this method.
 void setContentType(java.lang.String contentType)
          This method sets the MIME content-type for this client.
 void setURL(java.net.URL u)
          This method sets the URL of the http server
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

separator

public java.lang.String separator
Get the character used to seperate key value pairs. By convention this will be semi-colon.

Constructor Detail

HttpClient

public HttpClient()
           throws java.net.MalformedURLException,
                  ProcessingErrorException
HttpClient constructor. Retieves its parameters from the bankframeresource.properties file.

Throws:
java.net.MalformedURLException - if the server URL is invalid
ProcessingErrorException - if the codec cannot be created

HttpClient

public HttpClient(java.lang.String urlString,
                  java.lang.String contentTypeParam)
           throws java.net.MalformedURLException,
                  ProcessingErrorException
Constructor

Parameters:
urlString - the url of the Http Server
Throws:
java.net.MalformedURLException - If the server URL is invalid
ProcessingErrorException - if the codec object cannot be created
Method Detail

getCodec

public Codec getCodec()
Returns:
A reference to the codec object being used

getContentType

public java.lang.String getContentType()
Returns:
The MIME content-type for this client

getURL

public java.net.URL getURL()
Returns:
The Http Server URL

send

public java.util.Vector send(DataPacket dp)
This is a convenience method to send a single DataPacket without having to wrap it in a Vector.

Parameters:
dp - The request datapacket.
Returns:
A vector of datapackets containing the server response, or a vector of datapackets containing the details of any exception that occured during communication with the server

send

public java.util.Vector send(java.util.Vector dataPackets)
All ChannelManagers must support this method. It sends one or more request datapackets to the HTTP server.

Specified by:
send in interface ChannelClient
Returns:
A vector of datapackets containing the server response, or a vector of datapackets containing the details of any exception that occured during communication with the server

setContentType

public void setContentType(java.lang.String contentType)
                    throws ProcessingErrorException
This method sets the MIME content-type for this client. This will also use the mapping properties to create a codec object that corresponds to the MIME type.

Throws:
ProcessingErrorException - If the MIME type is not mapped to a codec

setURL

public void setURL(java.net.URL u)
This method sets the URL of the http server



Copyright © 2005, 2007, Oracle. All rights reserved.