|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.rad.remote.AbstractSerializedConnection
com.sibvisions.rad.remote.http.HttpConnection
public class HttpConnection
The HttpConnection communicates with the remote server via http
protocol.
| Field Summary | |
|---|---|
static String |
PREFIX_HTTP
the prefix for request properties. |
static String |
PROP_DOWNLOAD
the property name for the download url. |
static String |
PROP_SERVICE
the property name for the servlet url. |
static String |
PROP_UPLOAD
the property name for the upload url. |
| Fields inherited from class com.sibvisions.rad.remote.AbstractSerializedConnection |
|---|
PROP_SERIALIZER |
| 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 | |
|---|---|
RemoteFileHandle |
createRemoteFileHandle()
Creates a new "empty" remote file handle prepared for downloading content. |
long |
getContentLength(RemoteFileHandle pFileHandle)
Gets the expected content length. |
String |
getDownloadURL()
Gets the download URL. |
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. |
String |
getUploadURL()
Gets the upload URL. |
protected Object |
initCall(ConnectionInfo pConnectionInfo)
Will be invoked before a call starts. |
protected boolean |
isReadingMagicByteEnabled()
Whether this connection should read the magic byte sequence. |
InputStream |
readContent(RemoteFileHandle pFileHandle)
Reads the content from the remote server as stream. |
protected void |
releaseCall(ConnectionInfo pConnectionInfo,
Object pInit)
Will be invoked after a call was executed, if AbstractSerializedConnection.initCall(ConnectionInfo) was successfully invoked. |
void |
setConnectionTimeout(int pTimeout)
Sets the timeout for the connection establishment. |
void |
setDownloadURL(String pURL)
Sets the download URL. |
void |
setUploadURL(String pURL)
Sets the upload URL. |
RemoteFileHandle |
writeContent(IFileHandle pFileHandle)
Writes the given file handle to a remote server. |
| Methods inherited from class com.sibvisions.rad.remote.AbstractSerializedConnection |
|---|
addPropertyChangedListener, call, close, createSerializer, finalize, getProperties, getProperty, getRetryCount, getRetryInterval, getSerializer, isAutoEOFEnabled, isCalling, isOpen, isRetryDuringAliveCheck, isRetryDuringClose, isRetryDuringOpen, isWritingMagicByteEnabled, open, openSub, removePropertyChangedListener, setAndCheckAlive, setNewPassword, setProperty, setRetryCount, setRetryDuringAliveCheck, setRetryDuringClose, setRetryDuringOpen, setRetryInterval |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PREFIX_HTTP
public static final String PROP_SERVICE
public static final String PROP_DOWNLOAD
public static final String PROP_UPLOAD
| Constructor Detail |
|---|
public HttpConnection(Properties pProperties)
throws MalformedURLException,
NoSuchAlgorithmException,
KeyManagementException,
ClassNotFoundException
HttpConnection with
properties instead of many parameters. The supported property
keys are:
pProperties - the properties for the connection
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
public HttpConnection(String pServletURL)
throws MalformedURLException,
NoSuchAlgorithmException,
KeyManagementException
HttpConnection with the default
serializer.
pServletURL - URL to the remote server
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 failsAbstractSerializedConnection.AbstractSerializedConnection(ISerializer)
public HttpConnection(ISerializer pSerializer,
String pServletURL)
throws MalformedURLException,
NoSuchAlgorithmException,
KeyManagementException
HttpConnection.
pSerializer - the serializer for the communication between client and serverpServletURL - URL to the remote server
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 failsAbstractSerializedConnection.AbstractSerializedConnection(ISerializer)| Method Detail |
|---|
public InputStream readContent(RemoteFileHandle pFileHandle)
throws IOException
readContent in interface IDownloadExecutorpFileHandle - the file handle
IOException - if creating content stream failed
public long getContentLength(RemoteFileHandle pFileHandle)
throws IOException
getContentLength in interface IDownloadExecutorpFileHandle - the file handle
-1 if unknown
IOException - if getting content length failed
public RemoteFileHandle writeContent(IFileHandle pFileHandle)
throws IOException
writeContent in interface IUploadExecutorpFileHandle - the file handle
RemoteFileHandle
IOException - if upload failed
public OutputStream getOutputStream(ConnectionInfo pConnectionInfo)
throws IOException
OutputStream for submitting requests to the
server.
getOutputStream in class AbstractSerializedConnectionpConnectionInfo - the connection information
IOException
public InputStream getInputStream(ConnectionInfo pConnectionInfo)
throws IOException
InputStream for reading the response from the
server.
getInputStream in class AbstractSerializedConnectionpConnectionInfo - the connection information
IOExceptionprotected Object initCall(ConnectionInfo pConnectionInfo)
initCall in class AbstractSerializedConnectionpConnectionInfo - the connection info
AbstractSerializedConnection.releaseCall(ConnectionInfo, Object)
protected void releaseCall(ConnectionInfo pConnectionInfo,
Object pInit)
AbstractSerializedConnection.initCall(ConnectionInfo) was successfully invoked.
releaseCall in class AbstractSerializedConnectionpConnectionInfo - the connection infopInit - the object whic was created in AbstractSerializedConnection.initCall(ConnectionInfo)protected boolean isReadingMagicByteEnabled()
isReadingMagicByteEnabled in class AbstractSerializedConnectionfalse because it's not needed for http connectionspublic String getServletURL()
public void setDownloadURL(String pURL)
throws MalformedURLException
pURL - the URL to the download service
MalformedURLException - if URL isn't validpublic String getDownloadURL()
public void setUploadURL(String pURL)
throws MalformedURLException
pURL - the URL to the upload service
MalformedURLException - if URL isn't validpublic String getUploadURL()
public void setConnectionTimeout(int pTimeout)
pTimeout - the timeout in millis or -1 for the default timeoutpublic RemoteFileHandle createRemoteFileHandle()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||