public class ASUploadConnection extends Object
getOutputStream() an write their content to the returned OutputStreamfinishUpload() to actually upload the contentcancelUpload()
instead of finishUpload() if, for example, an IOException occured while writing their content
to the OutputStream.
Original code taken from https://github.com/jbossas/jboss-as/blob/master/testsuite/smoke/src/test/java/org/jboss/as/test/surefire/servermodule/HttpDeploymentUploadUnitTestCase.java| Constructor and Description |
|---|
ASUploadConnection(ASConnection asConnection)
Deprecated.
as of 4.6. This class is not reusable so there is no reason not to provide the filename to the
constructor. Use
ASUploadConnection(ASConnection, String) instead. |
ASUploadConnection(ASConnectionParams params,
String filename)
Creates a new
ASUploadConnection for a remote http management interface. |
ASUploadConnection(ASConnection asConnection,
String fileName) |
ASUploadConnection(String host,
int port,
String user,
String password)
Deprecated.
as of 4.6. This class is not reusable so there is no reason not to provide the filename to the
constructor. Use
ASUploadConnection(ASConnectionParams, String) instead. |
ASUploadConnection(String host,
int port,
String user,
String password,
String fileName)
Deprecated.
as of RHQ 4.10. Use
ASUploadConnection(ASConnectionParams, String) instead. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelUpload()
To be called instead of
finishUpload() if one doesn't want to upload the cached content. |
org.codehaus.jackson.JsonNode |
finishUpload()
Triggers the real upload to the AS7 instance.
|
static String |
getFailureDescription(org.codehaus.jackson.JsonNode jsonNode)
Inspects the supplied
JsonNode instance and returns the json 'failure-description' node value as text. |
OutputStream |
getOutputStream()
Gives an outpustream where callers should write the content which will be uploaded to AS7
when
finishUpload() will be called. |
OutputStream |
getOutputStream(String fileName)
Deprecated.
as of 4.6. Instances of this class should be created with fileName supplied to the constructor.
If the caller does that there is no reason for late initialization of fileName. Then use
getOutputStream() instead. |
int |
getTimeout()
Deprecated.
there is no reason to expose this attribute
|
static boolean |
isErrorReply(org.codehaus.jackson.JsonNode jsonNode)
Inspects the supplied
JsonNode instance to determine if it represents an error outcome. |
static ASUploadConnection |
newInstanceForServerPluginConfiguration(ServerPluginConfiguration pluginConfig,
String fileName)
Deprecated.
as of RHQ 4.10. Use
ASUploadConnection(ASConnectionParams, String) instead. |
void |
setTimeout(int timeout)
Deprecated.
there is no reason to expose this attribute
|
@Deprecated public ASUploadConnection(String host, int port, String user, String password)
ASUploadConnection(ASConnectionParams, String) instead.@Deprecated public ASUploadConnection(String host, int port, String user, String password, String fileName)
ASUploadConnection(ASConnectionParams, String) instead.@Deprecated public ASUploadConnection(ASConnection asConnection)
ASUploadConnection(ASConnection, String) instead.public ASUploadConnection(ASConnection asConnection, String fileName)
asConnection - the object which will provide the ASConnectionParamsfileName - ASUploadConnection(ASConnectionParams, String)public ASUploadConnection(ASConnectionParams params, String filename)
ASUploadConnection for a remote http management interface.
It's the responsibility of the caller to make sure either finishUpload() or cancelUpload()
will be called to free resources this class helds.params - @Deprecated public static ASUploadConnection newInstanceForServerPluginConfiguration(ServerPluginConfiguration pluginConfig, String fileName)
ASUploadConnection(ASConnectionParams, String) instead.@Deprecated public OutputStream getOutputStream(String fileName)
getOutputStream() instead.public OutputStream getOutputStream()
finishUpload() will be called.OutputStream or null if it could not be created.public void cancelUpload()
finishUpload() if one doesn't want to upload the cached content.
It's important to call this method if not actually uploading as it frees resources this class helds.public org.codehaus.jackson.JsonNode finishUpload()
OutputStream given by getOutputStream().JsonNode instance read from the upload response body or null if something went wrong.public static String getFailureDescription(org.codehaus.jackson.JsonNode jsonNode)
JsonNode instance and returns the json 'failure-description' node value as text.jsonNode - public static boolean isErrorReply(org.codehaus.jackson.JsonNode jsonNode)
JsonNode instance to determine if it represents an error outcome.jsonNode - @Deprecated public int getTimeout()
@Deprecated public void setTimeout(int timeout)
timeout - upload timeout in secondsCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.