Package com.santaba.agent.groovyapi.http
Class HTTP
- java.lang.Object
- 
- com.santaba.agent.groovyapi.http.HTTP
 
- 
 public class HTTP extends java.lang.ObjectThis class provides functions to do HTTP related operations. We will try to extract http related credentials from the hostProps if existed.
 The following properties may be used:
 property name property note http.user / httpuser the username for basic authentication http.pass / httppass the password for basic authentication 
- 
- 
Constructor SummaryConstructors Constructor Description HTTP()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringbody(java.lang.String url)do an HTTP GET on the provided url and return only the HTTP bodystatic java.lang.Stringbody(java.lang.String url, java.lang.String username, java.lang.String password)do an HTTP GET on the provided url and return only the HTTP bodystatic java.lang.Stringdelete(java.lang.String url, java.lang.String data)do an HTTP DELETE to the provided url and return the entire responsestatic java.lang.Stringdelete(java.lang.String url, java.lang.String data, java.util.Map headers)do an HTTP DELETE to the provided url and return the entire responsestatic java.lang.Stringdelete(java.lang.String url, java.util.Map headers)do an HTTP DELETE to the provided url and return the entire responsestatic java.lang.Stringget(java.lang.String url)do an HTTP GET on the provided url and return the entire HTTP responsestatic java.lang.Stringget(java.lang.String url, java.lang.String username, java.lang.String password)do an HTTP GET on the provided url and return the entire HTTP responsestatic java.lang.Stringget(java.lang.String url, java.lang.String username, java.lang.String password, java.util.Map headers)do an HTTP GET on the provided url and return the entire HTTP responsestatic java.lang.Stringget(java.lang.String url, java.util.Map headers)do an HTTP GET on the provided url and return the entire HTTP responsestatic java.lang.Stringheaders(java.lang.String url)do an HTTP GET on the provided url and return only the HTTP headersstatic java.lang.Stringheaders(java.lang.String url, java.lang.String username, java.lang.String password)do an HTTP GET on the provided url and return only the HTTP headersstatic Clientopen(java.lang.String host, int port)instantiate a non-ssl HTTP session object for use across multiple HTTP transactions
 Will try to extract http credentials from the related hostProps if existedstatic Clientopen(java.lang.String host, int port, boolean ssl)instantiate an HTTP session object for use across multiple HTTP transactions
 Will try to extract http credentials from the related hostProps if existedstatic java.lang.Stringpost(java.lang.String url, java.lang.String data)do an HTTP POST to the provided url and return the entire responsestatic java.lang.Stringpost(java.lang.String url, java.lang.String data, java.util.Map headers)do an HTTP POST to the provided url and return the entire responsestatic java.lang.Stringput(java.lang.String url, java.lang.String data)do an HTTP PUT to the provided url and return the entire responsestatic java.lang.Stringput(java.lang.String url, java.lang.String data, java.util.Map headers)do an HTTP PUT to the provided url and return the entire response
 
- 
- 
- 
Method Detail- 
openpublic static Client open(java.lang.String host, int port) throws java.io.IOException instantiate a non-ssl HTTP session object for use across multiple HTTP transactions
 Will try to extract http credentials from the related hostProps if existed- Parameters:
- host- The url of http host
- port- The host http port
- Returns:
- Http client
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
openpublic static Client open(java.lang.String host, int port, boolean ssl) throws java.io.IOException instantiate an HTTP session object for use across multiple HTTP transactions
 Will try to extract http credentials from the related hostProps if existed- Parameters:
- host- The url of http host
- port- The host http port
- ssl- Is this a ssl connection
- Returns:
- Http client
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
getpublic static java.lang.String get(java.lang.String url) throws java.io.IOExceptiondo an HTTP GET on the provided url and return the entire HTTP response- Parameters:
- url- The url of http host
- Returns:
- This url content
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
getpublic static java.lang.String get(java.lang.String url, java.util.Map headers) throws java.io.IOExceptiondo an HTTP GET on the provided url and return the entire HTTP response- Parameters:
- url- The url of http host
- headers- The http header with this http request
- Returns:
- This url content
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
getpublic static java.lang.String get(java.lang.String url, java.lang.String username, java.lang.String password) throws java.io.IOExceptiondo an HTTP GET on the provided url and return the entire HTTP response- Parameters:
- url- The url of http host
- username- This http host's username
- password- This http host's password
- Returns:
- This url content
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
getpublic static java.lang.String get(java.lang.String url, java.lang.String username, java.lang.String password, java.util.Map headers) throws java.io.IOExceptiondo an HTTP GET on the provided url and return the entire HTTP response- Parameters:
- url- The url of http host
- username- This http host's username
- password- This http host's password
- headers- The http header with this http request
- Returns:
- This url content
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
headerspublic static java.lang.String headers(java.lang.String url) throws java.io.IOExceptiondo an HTTP GET on the provided url and return only the HTTP headers- Parameters:
- url- Http url
- Returns:
- All http response headers
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
headerspublic static java.lang.String headers(java.lang.String url, java.lang.String username, java.lang.String password) throws java.io.IOExceptiondo an HTTP GET on the provided url and return only the HTTP headers- Parameters:
- url- Http url
- username- Auth username
- password- Auth password
- Returns:
- All http response header
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
bodypublic static java.lang.String body(java.lang.String url) throws java.io.IOExceptiondo an HTTP GET on the provided url and return only the HTTP body- Parameters:
- url- Http url
- Returns:
- Http response body string value
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
bodypublic static java.lang.String body(java.lang.String url, java.lang.String username, java.lang.String password) throws java.io.IOExceptiondo an HTTP GET on the provided url and return only the HTTP body- Parameters:
- url- Http url
- username- Auth username
- password- Auth password
- Returns:
- Http response body string value
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
postpublic static java.lang.String post(java.lang.String url, java.lang.String data) throws java.io.IOExceptiondo an HTTP POST to the provided url and return the entire response- Parameters:
- url- Http url
- data- This http post request data
- Returns:
- Http response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
postpublic static java.lang.String post(java.lang.String url, java.lang.String data, java.util.Map headers) throws java.io.IOExceptiondo an HTTP POST to the provided url and return the entire response- Parameters:
- url- Http url
- data- This http post request data
- headers- This http post request header
- Returns:
- This http post response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
putpublic static java.lang.String put(java.lang.String url, java.lang.String data) throws java.io.IOExceptiondo an HTTP PUT to the provided url and return the entire response- Parameters:
- url- Http url
- data- This http put request data
- Returns:
- Http response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
putpublic static java.lang.String put(java.lang.String url, java.lang.String data, java.util.Map headers) throws java.io.IOExceptiondo an HTTP PUT to the provided url and return the entire response- Parameters:
- url- Http url
- data- This http put request data
- headers- This http put request header
- Returns:
- This http put response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
deletepublic static java.lang.String delete(java.lang.String url, java.util.Map headers) throws java.io.IOExceptiondo an HTTP DELETE to the provided url and return the entire response- Parameters:
- url- Http url
- headers- This http delete request header
- Returns:
- Http response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
deletepublic static java.lang.String delete(java.lang.String url, java.lang.String data) throws java.io.IOExceptiondo an HTTP DELETE to the provided url and return the entire response- Parameters:
- url- Http url
- data- This http delete request data
- Returns:
- Http response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 - 
deletepublic static java.lang.String delete(java.lang.String url, java.lang.String data, java.util.Map headers) throws java.io.IOExceptiondo an HTTP DELETE to the provided url and return the entire response- Parameters:
- url- Http url
- data- This http delete request data
- headers- This http delete request header
- Returns:
- This http delete response string
- Throws:
- java.io.IOException- If some other I/O error occurs
 
 
- 
 
-