com.sibvisions.rad.remote.http
Class HttpConnection

java.lang.Object
  extended by com.sibvisions.rad.remote.AbstractSerializedConnection
      extended by com.sibvisions.rad.remote.http.HttpConnection
All Implemented Interfaces:
IConnection

public class HttpConnection
extends AbstractSerializedConnection

The HttpConnection communicates with the remote server via http protocol.


Field Summary
static String PREFIX_HTTP
          the prefix for request properties.
static String PROP_SERVICE
          the property name for the servlet url.
 
Fields inherited from class com.sibvisions.rad.remote.AbstractSerializedConnection
PROP_SERIALIZER
 
Fields inherited from interface javax.rad.remote.IConnection
COMPRESSION_BYTES, FLAG_ACKNOWLEDGE, FLAG_BROKEN, FLAG_ESTABLISHED, MET_SESSION_CREATE, MET_SESSION_DESTROY, MET_SESSION_GET_PROPERTIES, MET_SESSION_GET_PROPERTY, MET_SESSION_SET_NEW_PASSWORD, MET_SESSION_SET_PROPERTY, MET_SESSION_SETCHECKALIVE, MET_SESSION_SUBSESSION_CREATE, MODE_COMPRESSED, MODE_UNCOMPRESSED, OBJ_SESSION, TYPE_CALL_ERROR, TYPE_CALL_RESULT, TYPE_CALLBACK_ERROR, TYPE_CALLBACK_RESULT, TYPE_PROPERTY_RESULT
 
Constructor Summary
HttpConnection(ISerializer pSerializer, String pServletURL)
          Creates a new instance of HttpConnection.
HttpConnection(Properties pProperties)
          Creates a new instance of HttpConnection with properties instead of many parameters.
HttpConnection(String pServletURL)
          Creates a new instance of HttpConnection with the default serializer.
 
Method Summary
 InputStream getInputStream(ConnectionInfo pConnectionInfo)
          Gets the InputStream for reading the response from the server.
 OutputStream getOutputStream(ConnectionInfo pConnectionInfo)
          Gets the OutputStream for submitting requests to the server.
 String getServletURL()
          Gets the servlet URL to access the remote server.
 void setConnectionTimeout(int pTimeout)
          Sets the timeout for the connection establishment.
 
Methods inherited from class com.sibvisions.rad.remote.AbstractSerializedConnection
call, close, createSerializer, finalize, getProperties, getProperty, isCalling, isOpen, open, openSub, reopen, setAndCheckAlive, setNewPassword, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_HTTP

public static final String PREFIX_HTTP
the prefix for request properties.

See Also:
Constant Field Values

PROP_SERVICE

public static final String PROP_SERVICE
the property name for the servlet url.

See Also:
Constant Field Values
Constructor Detail

HttpConnection

public HttpConnection(Properties pProperties)
               throws MalformedURLException,
                      NoSuchAlgorithmException,
                      KeyManagementException,
                      ClassNotFoundException
Creates a new instance of HttpConnection with properties instead of many parameters. The supported property keys are:

Parameters:
pProperties - the properties for the connection
Throws:
MalformedURLException - if the servlet URL is not valid
NoSuchAlgorithmException - if the specified protocol is not available in the default provider package or any of the other provider packages that were searched.
ClassNotFoundException - if the serializer is defined and could not be created
KeyManagementException - if ssl operation fails

HttpConnection

public HttpConnection(String pServletURL)
               throws MalformedURLException,
                      NoSuchAlgorithmException,
                      KeyManagementException
Creates a new instance of HttpConnection with the default serializer.

Parameters:
pServletURL - URL to the remote server
Throws:
MalformedURLException - if the servlet URL is not valid
NoSuchAlgorithmException - if the specified protocol is not available in the default provider package or any of the other provider packages that were searched.
KeyManagementException - if ssl operation fails
See Also:
AbstractSerializedConnection.AbstractSerializedConnection(ISerializer)

HttpConnection

public HttpConnection(ISerializer pSerializer,
                      String pServletURL)
               throws MalformedURLException,
                      NoSuchAlgorithmException,
                      KeyManagementException
Creates a new instance of HttpConnection.

Parameters:
pSerializer - the serializer for the communication between client and server
pServletURL - URL to the remote server
Throws:
MalformedURLException - if the servlet URL is not valid
NoSuchAlgorithmException - if the specified protocol is not available in the default provider package or any of the other provider packages that were searched.
KeyManagementException - if ssl operation fails
See Also:
AbstractSerializedConnection.AbstractSerializedConnection(ISerializer)
Method Detail

getOutputStream

public OutputStream getOutputStream(ConnectionInfo pConnectionInfo)
                             throws IOException
Gets the OutputStream for submitting requests to the server.

Specified by:
getOutputStream in class AbstractSerializedConnection
Parameters:
pConnectionInfo - the connection information
Returns:
output stream
Throws:
IOException

getInputStream

public InputStream getInputStream(ConnectionInfo pConnectionInfo)
                           throws IOException
Gets the InputStream for reading the response from the server.

Specified by:
getInputStream in class AbstractSerializedConnection
Parameters:
pConnectionInfo - the connection information
Returns:
input stream
Throws:
IOException

getServletURL

public String getServletURL()
Gets the servlet URL to access the remote server.

Returns:
URL to the remote server

setConnectionTimeout

public void setConnectionTimeout(int pTimeout)
Sets the timeout for the connection establishment.

Parameters:
pTimeout - the timeout in millis or -1 for the default timeout


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.