at.spardat.xma.boot.transport
Class HTTPTransport

java.lang.Object
  extended byat.spardat.xma.boot.transport.Transport
      extended byat.spardat.xma.boot.transport.HTTPTransport

public class HTTPTransport
extends Transport

This class implements low level transport on http transport using suns UrlConnection implementation.


Constructor Summary
HTTPTransport()
          Constructs a HTTPTransport.
 
Method Summary
 byte[] callServerEvent(IRtXMASessionClient session, XMA_URI eventHandler, byte[] input)
          Calls a server side event.
 org.apache.commons.httpclient.Cookie[] getCookies(java.net.URL url)
          Returns all cookies which are stored for the given url.
 Result getResource(IRtXMASessionClient session, XMA_URI resource, long modifiedSince, java.lang.String etag)
          Loads a resource from a server if it has been changed since modifiedSince.
static java.lang.String httpDate(java.util.Date date)
          Converts a java.util.Date to a String using the encoding specified by the HTTP-Specification.
static java.lang.String httpDate(long ldate)
          Converts a long containing a date to a String using the encoding specified by the HTTP-Specification.
static void init(java.util.Properties prop)
          Initializes the underlaying http-protocol-provider from the given Propterties.
 
Methods inherited from class at.spardat.xma.boot.transport.Transport
getTransport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPTransport

public HTTPTransport()
Constructs a HTTPTransport.

Method Detail

init

public static void init(java.util.Properties prop)
Initializes the underlaying http-protocol-provider from the given Propterties. This sets the tcp-timeouts, the proxy-settings and ssl-settings.

Parameters:
prop - containing properties for http and https protocol

httpDate

public static java.lang.String httpDate(java.util.Date date)
Converts a java.util.Date to a String using the encoding specified by the HTTP-Specification. We have to wrap this task, cause we may have to change it.

see also SUN-Bug_ID: 4397096

Parameters:
date - the date to be formated
Returns:
String the formated representation

httpDate

public static java.lang.String httpDate(long ldate)
Converts a long containing a date to a String using the encoding specified by the HTTP-Specification. We have to wrap this task, cause we may have to change it.

see also SUN-Bug_ID: 4397096

Parameters:
ldate - the milliseconds since January 1, 1970, 00:00:00 GMT.
Returns:
String the formated representation

getResource

public Result getResource(IRtXMASessionClient session,
                          XMA_URI resource,
                          long modifiedSince,
                          java.lang.String etag)
                   throws CommunicationException
Description copied from class: Transport
Loads a resource from a server if it has been changed since modifiedSince.

Specified by:
getResource in class Transport
Parameters:
session - the session this event belongs to. may be null.
resource - unique identification of the resource.
modifiedSince - timestamp of last modification.
Returns:
a result that indicates the server response. If a new resource is loaded, the data is stored within the result. the content-length is set, and the buffer can be read by using the method getContent. If no resource is loaded, the result will only contain informational data about the request. e.g. a new expiration date.
Throws:
CommunicationException

callServerEvent

public byte[] callServerEvent(IRtXMASessionClient session,
                              XMA_URI eventHandler,
                              byte[] input)
                       throws CommunicationException
Description copied from class: Transport
Calls a server side event.

Specified by:
callServerEvent in class Transport
Parameters:
session - the session this event belongs to.
eventHandler - unique identification of the eventhandler.
input - All data that can be read from this InputStream is propagated to the eventhandler.
Returns:
an InputStream pointing to the data send back by the enventhandler.
Throws:
CommunicationException

getCookies

public org.apache.commons.httpclient.Cookie[] getCookies(java.net.URL url)
Returns all cookies which are stored for the given url.