public interface IHttpRequest
HttpRequest, implemented by HttpURLConnection.XMLHttpRequest, implemented by javascript AJAX.HttpRequest,
XMLHttpRequest| Modifier and Type | Interface and Description |
|---|---|
static class |
IHttpRequest.HttpCommand
The enumeration represents the HTTP request command, such as "GET", "POST", "PUT", "DELETE" etc.
The enumeration has a method value(), which can return the string format. |
static class |
IHttpRequest.HttpHeader
The enumeration represents subset of the HTTP header keys
The enumeration has a method value(), which can return the string format. |
static class |
IHttpRequest.HttpResponseStatus
The enumeration represents subset of the HTTP request Response Status Code, such as "200", "403", "404", "500" etc.
The enumeration has a method value(), which can return the "HTTP status code" string format. The enumeration has a method text(), which can return the "HTTP status text" string format. |
static class |
IHttpRequest.Key
The enumeration represents some of XMLHttpRequest Object Properties,
such as "status", "statusText", "responseText" etc.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
execute(IHttpRequest.HttpCommand command,
java.lang.String url,
boolean async,
java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.String data)
Send a HTTP Request and get the response from the server.
Note: If this is performed by "AJAX XMLHttpRequest", it is probable not permitted to request an URL of domain other than the Application under test. |
java.lang.String |
getHttpStatus()
After executing HTTP request, call this method to get the value of
IHttpRequest.Key.RESPONSE_STATUS. |
java.lang.String |
getHttpStatusText()
After executing HTTP request, call this method to get the value of
IHttpRequest.Key.RESPONSE_STATUS_TEXT. |
java.lang.Object |
getResponseHeaders()
After executing HTTP request, call this method to get the value of
IHttpRequest.Key.RESPONSE_HEADERS. |
java.lang.String |
getResponseText()
After executing HTTP request, call this method to get the value of
IHttpRequest.Key.RESPONSE_TEXT. |
java.lang.Object |
getResponseXml()
After executing HTTP request, call this method to get the value of
IHttpRequest.Key.RESPONSE_XML. |
java.util.Map<java.lang.String,java.lang.Object> execute(IHttpRequest.HttpCommand command, java.lang.String url, boolean async, java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String data) throws SAFSException
command - HttpCommand, the method to execute, such as 'GET', 'POST', 'PUT' etc.url - String, the URL to requestasync - boolean, if the HTTP request will be executed asynchronously.headers - Mapdata - String, the data to send with the request.IHttpRequest.Key.READY_STATE: ready state, changes from 0 to 4, ONLY for AJAX XMLHttpRequest execution.
IHttpRequest.Key.RESPONSE_STATUS: HTTP response status number
IHttpRequest.Key.RESPONSE_STATUS_TEXT: HTTP response status text
IHttpRequest.Key.RESPONSE_HEADERS: HTTP response headers
IHttpRequest.Key.RESPONSE_TEXT: HTTP response as string
IHttpRequest.Key.RESPONSE_XML: HTTP response as XML data
IHttpRequest.Key.READY_STATE: ready state, changes from 0 to 4, ONLY for AJAX XMLHttpRequest execution. for other values, they are not in the Map result, we can get them from following methods:#getReadyState()getHttpStatus()getHttpStatusText()getResponseText()getResponseXml()getResponseHeaders()
SAFSException - when there are some error occurs.#getReadyState()}java.lang.Object getResponseHeaders()
IHttpRequest.Key.RESPONSE_HEADERS.
This is more useful for asynchronous execution; for synchronous execution the Map result contains this value.IHttpRequest.Key.RESPONSE_HEADERS.execute(HttpCommand, String, boolean, Map, String)java.lang.String getResponseText()
IHttpRequest.Key.RESPONSE_TEXT.
This is more useful for asynchronous execution; for synchronous execution the Map result contains this value.IHttpRequest.Key.RESPONSE_TEXT.execute(HttpCommand, String, boolean, Map, String)java.lang.Object getResponseXml()
IHttpRequest.Key.RESPONSE_XML.
This is more useful for asynchronous execution; for synchronous execution the Map result contains this value.IHttpRequest.Key.RESPONSE_XML.execute(HttpCommand, String, boolean, Map, String)java.lang.String getHttpStatus()
IHttpRequest.Key.RESPONSE_STATUS.
This is more useful for asynchronous execution; for synchronous execution the Map result contains this value.IHttpRequest.Key.RESPONSE_STATUS.execute(HttpCommand, String, boolean, Map, String)java.lang.String getHttpStatusText()
IHttpRequest.Key.RESPONSE_STATUS_TEXT.
This is more useful for asynchronous execution; for synchronous execution the Map result contains this value.IHttpRequest.Key.RESPONSE_STATUS_TEXT.execute(HttpCommand, String, boolean, Map, String)Copyright © SAS Institute. All Rights Reserved.