com.ibm.integration.admin.http
Class HttpClient
- java.lang.Object
-
- com.ibm.integration.admin.http.HttpClient
-
public class HttpClient extends java.lang.ObjectA local HTTP client for connecting to local integration nodes and servers using local communications
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringCLIENT_NAMEstatic java.lang.StringproductVersionstatic java.lang.StringX_IBM_BIP_Clientstatic java.lang.StringX_IBM_BIP_Client_Version
-
Constructor Summary
Constructors Constructor and Description HttpClient(java.lang.String nodeName)Asks the IBM Integration API to construct a local HTTP client for your Integration Node.HttpClient(java.lang.String hostname, int port, java.lang.String userId, java.lang.String password, boolean useSSL)Asks the IBM Integration API to construct a remote HTTP client for your Integration Server.HttpClient(java.lang.String serverName, java.lang.String workPath)Asks the IBM Integration API to construct a local HTTP client for your Integration Server.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description HttpResponsedeleteMethod(java.lang.String urlPath)Call this method with a url on your HTTP client to remove a resource using DELETE The urlPath will be encoded before the request is sent.HttpResponsedeleteMethod(java.lang.String urlPath, boolean encodePath)Call this method with a url on your HTTP client to remove a resource using DELETEintgetConnectionTimeout()Get the connection timeout (seconds) that is used for connecting to a remote Integration Node or Integration ServerHttpResponsegetMethod(java.lang.String urlPath)Call this method with a url on your HTTP client to access a resource using GET The urlPath will be encoded before the request is sent.HttpResponsegetMethod(java.lang.String urlPath, boolean encodePath)Call this method with a url on your HTTP client to access a resource using GETbooleanisLocalClient()HttpResponsepatchMethod(java.lang.String urlPath, java.lang.String body)Call this method with a url and body to update a resource using PATCH The urlPath will be encoded before the request is sent.HttpResponsepatchMethod(java.lang.String urlPath, java.lang.String body, boolean encodePath)Call this method with a url and body to update a resource using PATCHHttpResponsepostMethod(java.lang.String urlPath, java.io.File file)Call this method with a url and POST a file on your HTTP client This can be used for deploying a BAR file to an Integration Server The urlPath will be encoded before the request is sent.HttpResponsepostMethod(java.lang.String urlPath, java.io.File file, boolean encodePath)Call this method with a url and POST a file on your HTTP clientHttpResponsepostMethod(java.lang.String urlPath, java.io.InputStream inputStream, java.lang.String fileName)Call this method with a url and POST a file via a InputStream to your HTTP client This can be used for deploying a BAR file to an Integration Server The urlPath will be encoded before the request is sent.HttpResponsepostMethod(java.lang.String urlPath, java.io.InputStream inputStream, java.lang.String fileName, boolean encodePath)Call this method with a url and POST a file via a InputStream to your HTTP client This can be used for deploying a BAR file to an Integration ServerHttpResponsepostMethod(java.lang.String urlPath, java.lang.String body)Call this method with a url and body to create a resource using POST The urlPath will be encoded before the request is sent.HttpResponsepostMethod(java.lang.String urlPath, java.lang.String body, boolean encodePath)Call this method with a url and body to create a resource using POSTvoidsetConnectionTimeout(int connectionTimeout)Set the connection timeout (seconds) that is used for connecting to a remote Integration Node or Integration Server
-
-
-
Field Detail
-
X_IBM_BIP_Client_Version
public static final java.lang.String X_IBM_BIP_Client_Version
- See Also:
- Constant Field Values
-
X_IBM_BIP_Client
public static final java.lang.String X_IBM_BIP_Client
- See Also:
- Constant Field Values
-
CLIENT_NAME
public static final java.lang.String CLIENT_NAME
- See Also:
- Constant Field Values
-
productVersion
public static java.lang.String productVersion
-
-
Constructor Detail
-
HttpClient
public HttpClient(java.lang.String nodeName)
Asks the IBM Integration API to construct a local HTTP client for your Integration Node. No active connection will be made until your first http method call- Parameters:
nodeName- The local integration node name HttpClient an object that represents the local HTTP client which can be used to communicate with an Integration Node using getMethod, postMethod and deleteMethod
-
HttpClient
public HttpClient(java.lang.String serverName, java.lang.String workPath)Asks the IBM Integration API to construct a local HTTP client for your Integration Server. No active connection will be made until your first HTTP method call- Parameters:
serverName- The local integration server nameworkPath- The workPath for your integration server (currently /tmp/mqsi for linux) ("" for Windows) HttpClient an object that represents the local HTTP client which can be used to communicate with an Integration Server using getMethod, postMethod and deleteMethod
-
HttpClient
public HttpClient(java.lang.String hostname, int port, java.lang.String userId, java.lang.String password, boolean useSSL)Asks the IBM Integration API to construct a remote HTTP client for your Integration Server. No active connection will be made until your first HTTP method call- Parameters:
hostname- The hostname of the machine where the Integration Node or Integration Server is runningport- The port of the machine where the Integration Node or Integration Server is runninguserId- The userId for performing administrative tasks if Admin Security is enabled. Use "" if Admin Security is not enabled.password- The password for the userId if Admin Security is enabled.useSSL- Set to true if SSL is enabled on the Integration Node or Integration Server. HttpClient an object that represents the local HTTP client which can be used to communicate with an Integration Server using getMethod, postMethod and deleteMethod
-
-
Method Detail
-
isLocalClient
public boolean isLocalClient()
-
getConnectionTimeout
public int getConnectionTimeout()
Get the connection timeout (seconds) that is used for connecting to a remote Integration Node or Integration Server- Returns:
- connectionTimeout
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
Set the connection timeout (seconds) that is used for connecting to a remote Integration Node or Integration Server- Parameters:
connectionTimeout-
-
getMethod
public HttpResponse getMethod(java.lang.String urlPath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url on your HTTP client to access a resource using GET The urlPath will be encoded before the request is sent.- Parameters:
urlPath- to call eg. /apiv2/servers- Returns:
- The HttpResponse
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
getMethod
public HttpResponse getMethod(java.lang.String urlPath, boolean encodePath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url on your HTTP client to access a resource using GET- Parameters:
urlPath- the path to call eg. /apiv2/serversencodePath- whether to encode the path or not. true will cause the path to be encoded. false will cause the path to not be encoded. use false if the path is already encoded.- Returns:
- The HttpResponse
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
postMethod
public HttpResponse postMethod(java.lang.String urlPath, java.lang.String body) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and body to create a resource using POST The urlPath will be encoded before the request is sent.- Parameters:
urlPath- eg /apiv2/serversbody- eg {"name": "IS1"} to create integration server called IS1- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
postMethod
public HttpResponse postMethod(java.lang.String urlPath, java.lang.String body, boolean encodePath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and body to create a resource using POST- Parameters:
urlPath- eg /apiv2/serversbody- eg {"name": "IS1"} to create integration server called IS1encodePath- whether to encode the path or not. true will cause the path to be encoded. false will cause the path to not be encoded. use false if the path is already encoded.- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
postMethod
public HttpResponse postMethod(java.lang.String urlPath, java.io.File file) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and POST a file on your HTTP client This can be used for deploying a BAR file to an Integration Server The urlPath will be encoded before the request is sent.- Parameters:
urlPath- to call eg. /apiv2/servers/is1/deployfile- eg /home/myBAR.bar to deploy a bar file- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
postMethod
public HttpResponse postMethod(java.lang.String urlPath, java.io.File file, boolean encodePath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and POST a file on your HTTP client- Parameters:
urlPath- to call eg. /apiv2/servers/is1/deployfile- eg /home/myBAR.bar to deploy a bar fileencodePath- whether to encode the path or not. true will cause the path to be encoded. false will cause the path to not be encoded. use false if the path is already encoded.- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
postMethod
public HttpResponse postMethod(java.lang.String urlPath, java.io.InputStream inputStream, java.lang.String fileName) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and POST a file via a InputStream to your HTTP client This can be used for deploying a BAR file to an Integration Server The urlPath will be encoded before the request is sent.- Parameters:
urlPath- to call eg. /apiv2/servers/is1/deployinputStream- contains the contents to deploy- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
postMethod
public HttpResponse postMethod(java.lang.String urlPath, java.io.InputStream inputStream, java.lang.String fileName, boolean encodePath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and POST a file via a InputStream to your HTTP client This can be used for deploying a BAR file to an Integration Server- Parameters:
urlPath- to call eg. /apiv2/servers/is1/deployinputStream- contains the contents to deployencodePath- whether to encode the path or not. true will cause the path to be encoded. false will cause the path to not be encoded. use false if the path is already encoded.- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
patchMethod
public HttpResponse patchMethod(java.lang.String urlPath, java.lang.String body) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and body to update a resource using PATCH The urlPath will be encoded before the request is sent.- Parameters:
urlPath- eg /apiv2/servers/myserver/statistics/snapshotbody- eg {"properties": {"publicationOn": "active"}} to turn on publication statistics on myserver- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
patchMethod
public HttpResponse patchMethod(java.lang.String urlPath, java.lang.String body, boolean encodePath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url and body to update a resource using PATCH- Parameters:
urlPath- eg /apiv2/servers/myserver/statistics/snapshotbody- eg {"properties": {"publicationOn": "active"}} to turn on publication statistics on myserverencodePath- whether to encode the path or not. true will cause the path to be encoded. false will cause the path to not be encoded. use false if the path is already encoded.- Returns:
- The complete HTTP response including status code
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
deleteMethod
public HttpResponse deleteMethod(java.lang.String urlPath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url on your HTTP client to remove a resource using DELETE The urlPath will be encoded before the request is sent.- Parameters:
urlPath- to remove a resource /apiv2/servers/server1- Returns:
- The HttpResponse
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
deleteMethod
public HttpResponse deleteMethod(java.lang.String urlPath, boolean encodePath) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException, java.net.ConnectException, java.net.MalformedURLException, java.net.SocketTimeoutException
Call this method with a url on your HTTP client to remove a resource using DELETE- Parameters:
urlPath- to remove a resource /apiv2/servers/server1encodePath- whether to encode the path or not. true will cause the path to be encoded. false will cause the path to not be encoded. use false if the path is already encoded.- Returns:
- The HttpResponse
- Throws:
java.io.IOExceptionjava.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionjava.lang.InterruptedExceptionjava.net.ConnectExceptionjava.net.MalformedURLExceptionjava.net.SocketTimeoutException
-
-