|
||||||||||
| 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 java.lang.String |
PREFIX_HTTP
the prefix for request properties. |
static java.lang.String |
PROP_DOWNLOAD
the property name for the download url. |
static java.lang.String |
PROP_SERVICE
the property name for the servlet url. |
static java.lang.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,
java.lang.String pServletURL)
Creates a new instance of HttpConnection. |
|
HttpConnection(java.util.Properties pProperties)
Creates a new instance of HttpConnection with
properties instead of many parameters. |
|
HttpConnection(java.lang.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. |
int |
getConnectionTimeout()
Gets the timeout for the connection establishment. |
long |
getContentLength(RemoteFileHandle pFileHandle)
Gets the expected content length. |
java.lang.String |
getDownloadURL()
Gets the download URL. |
java.io.InputStream |
getInputStream(ConnectionInfo pConnectionInfo)
Gets the InputStream for reading the response from the
server. |
java.io.OutputStream |
getOutputStream(ConnectionInfo pConnectionInfo)
Gets the OutputStream for submitting requests to the
server. |
java.lang.String |
getServletURL()
Gets the servlet URL to access the remote server. |
java.lang.String |
getUploadURL()
Gets the upload URL. |
protected java.lang.Object |
initCall(ConnectionInfo pConnectionInfo)
Will be invoked before a call starts. |
protected boolean |
isReadingMagicByteEnabled()
Whether this connection should read the magic byte sequence. |
protected java.lang.Throwable |
prepareAfterRetryException(java.lang.Throwable pThrowable)
Prepares the final exception after last retry. |
protected java.lang.Throwable |
prepareException(java.lang.Throwable pThrowable)
Prepares the given exception if needed. |
java.io.InputStream |
readContent(RemoteFileHandle pFileHandle)
Reads the content from the remote server as stream. |
protected void |
releaseCall(ConnectionInfo pConnectionInfo,
java.lang.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(java.lang.String pURL)
Sets the download URL. |
void |
setUploadURL(java.lang.String pURL)
Sets the upload URL. |
RemoteFileHandle |
writeContent(IFileHandle pFileHandle)
Writes the given file handle to a remote server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PREFIX_HTTP
public static final java.lang.String PROP_SERVICE
public static final java.lang.String PROP_DOWNLOAD
public static final java.lang.String PROP_UPLOAD
| Constructor Detail |
|---|
public HttpConnection(java.util.Properties pProperties)
throws java.net.MalformedURLException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException,
java.lang.ClassNotFoundException
HttpConnection with
properties instead of many parameters. The supported property
keys are:
pProperties - the properties for the connection
java.net.MalformedURLException - if the servlet URL is not valid
java.security.NoSuchAlgorithmException - if the specified protocol is not
available in the default provider package
or any of the other provider packages that
were searched.
java.lang.ClassNotFoundException - if the serializer is defined and could not be created
java.security.KeyManagementException - if ssl operation fails
public HttpConnection(java.lang.String pServletURL)
throws java.net.MalformedURLException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
HttpConnection with the default
serializer.
pServletURL - URL to the remote server
java.net.MalformedURLException - if the servlet URL is not valid
java.security.NoSuchAlgorithmException - if the specified protocol is not
available in the default provider package
or any of the other provider packages that
were searched.
java.security.KeyManagementException - if ssl operation failsAbstractSerializedConnection.AbstractSerializedConnection(ISerializer)
public HttpConnection(ISerializer pSerializer,
java.lang.String pServletURL)
throws java.net.MalformedURLException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
HttpConnection.
pSerializer - the serializer for the communication between client and serverpServletURL - URL to the remote server
java.net.MalformedURLException - if the servlet URL is not valid
java.security.NoSuchAlgorithmException - if the specified protocol is not
available in the default provider package
or any of the other provider packages that
were searched.
java.security.KeyManagementException - if ssl operation failsAbstractSerializedConnection.AbstractSerializedConnection(ISerializer)| Method Detail |
|---|
public java.io.InputStream readContent(RemoteFileHandle pFileHandle)
throws java.io.IOException
readContent in interface IDownloadExecutorpFileHandle - the file handle
java.io.IOException - if creating content stream failed
public long getContentLength(RemoteFileHandle pFileHandle)
throws java.io.IOException
getContentLength in interface IDownloadExecutorpFileHandle - the file handle
-1 if unknown
java.io.IOException - if getting content length failed
public RemoteFileHandle writeContent(IFileHandle pFileHandle)
throws java.io.IOException
writeContent in interface IUploadExecutorpFileHandle - the file handle
RemoteFileHandle
java.io.IOException - if upload failed
public java.io.OutputStream getOutputStream(ConnectionInfo pConnectionInfo)
throws java.io.IOException
OutputStream for submitting requests to the
server.
getOutputStream in class AbstractSerializedConnectionpConnectionInfo - the connection information
java.io.IOException
public java.io.InputStream getInputStream(ConnectionInfo pConnectionInfo)
throws java.io.IOException
InputStream for reading the response from the
server.
getInputStream in class AbstractSerializedConnectionpConnectionInfo - the connection information
java.io.IOExceptionprotected java.lang.Object initCall(ConnectionInfo pConnectionInfo)
initCall in class AbstractSerializedConnectionpConnectionInfo - the connection info
AbstractSerializedConnection.releaseCall(ConnectionInfo, Object)
protected void releaseCall(ConnectionInfo pConnectionInfo,
java.lang.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 connectionsprotected java.lang.Throwable prepareException(java.lang.Throwable pThrowable)
prepareException in class AbstractSerializedConnectionpThrowable - the original exception
protected java.lang.Throwable prepareAfterRetryException(java.lang.Throwable pThrowable)
AbstractSerializedConnection.prepareException(Throwable).
prepareAfterRetryException in class AbstractSerializedConnectionpThrowable - the original exception
public java.lang.String getServletURL()
public void setDownloadURL(java.lang.String pURL)
throws java.net.MalformedURLException
pURL - the URL to the download service
java.net.MalformedURLException - if URL isn't validpublic java.lang.String getDownloadURL()
public void setUploadURL(java.lang.String pURL)
throws java.net.MalformedURLException
pURL - the URL to the upload service
java.net.MalformedURLException - if URL isn't validpublic java.lang.String getUploadURL()
public void setConnectionTimeout(int pTimeout)
pTimeout - the timeout in millis or -1 for the default timeoutpublic int getConnectionTimeout()
public RemoteFileHandle createRemoteFileHandle()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||