HttpConfig
Path
com.roma.apic.livedata.config.v1.HttpConfig
Description
This class is used together with HttpClient to configure HTTP requests.
Example
importClass(com.roma.apic.livedata.client.v1.HttpClient); importClass(com.roma.apic.livedata.config.v1.HttpConfig); function execute(data) { var requestConfig = new HttpConfig(); requestConfig.setAccessKey("071fe245-9cf6-4d75-822d-c29945a1e06a"); requestConfig.setSecretKey("c6e52419-2270-****-****-ae7fdd01dcd5"); requestConfig.setMethod('POST'); requestConfig.setUrl("https://30030113-3657-4fb6-a7ef-90764239b038.apigw.exampleRegion.com/app1"); requestConfig.setContent("body"); requestConfig.setContentType('application/json'); var client = new HttpClient(); var resp = client.request(requestConfig); return resp.body().string() }
Constructor Details
public HttpConfig()
Constructs an HttpConfig without parameters.
Method List
Returned Type |
Method and Description |
---|---|
void |
addHeaderToSign(String headerName) Add a request header to be signed. |
String |
Obtain the AccessKey. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing. |
String |
Obtain a CA certificate. |
String |
Obtain the HTTP request encoding format. |
String |
Obtain a client certificate. |
String |
Obtain the encryption algorithm of the client private key. |
String |
Obtain a client private key. |
String |
Obtain the password of a client private key. |
int |
Obtain the connection timeout interval. |
int |
Obtain the connection timeout interval. |
Object |
Obtain the content of an HTTP request. |
String |
Obtain the content format of an HTTP request. |
String |
getHeader(String name) Obtain the HTTP request header with a specified name. |
Set<String> |
Obtain the name of the HTTP request header. |
Map<String,String[]> |
Obtain all request headers. |
String[] |
getHeaders(String name) Obtain all HTTP request headers with a specified name. |
Set<String> |
Obtain a request header to be signed. |
String |
Obtain the HTTP proxy. |
String |
Obtain the HTTPS proxy. |
int |
Obtain the maximum number of concurrent requests. |
int |
Obtain the maximum number of concurrent requests per host. |
String |
Obtain the HTTP method. |
String[] |
Obtain a list of IP addresses that do not use the proxy. |
String |
getParameter(String name) Obtain the HTTP request parameters with a specified name. |
Set<String> |
Obtain all HTTP request parameter names. |
Map<String,String> |
Obtain the HTTP request parameters. |
String |
Obtain the proxy password. |
String |
Obtain the proxy username. |
RequestConfig |
Obtain request configuration information. |
String |
Obtain the request ID. |
int |
Obtain the request timeout. |
long |
Obtain the rolling timeout interval. |
long |
Obtain the scaling timeout interval. |
String |
Obtain the SecretKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing. |
okhttp3.TlsVersion[] |
Obtain the TLS version. |
String |
getUrl() Obtain the URL. |
String |
Obtain the user agent. |
long |
Obtain the WebSocket heartbeat interval. |
long |
Obtain the WebSocket timeout interval. |
boolean |
Allow redirection or not. |
boolean |
isSsl() Check whether HTTPS is used. The default value is false. |
boolean |
Check whether to obtain the value of sslRedirects. The options are true and false. |
boolean |
Check whether all certificates are trusted. The options are true and false. |
void |
setAccessKey(String accessKey) Set the AccessKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing. |
void |
setBodyForm(Map<String,String> content) Set the HTTP request content of the map type. |
void |
setBodyText(String content) Set the HTTP request content of the string type. |
void |
setCaCertData(String caCertData) Set the CA certificate. |
void |
setCharset(String charset) Set the HTTP request encoding format. |
void |
setClientCertData(String clientCertData) Set a client certificate. |
void |
setClientKeyAlgo(String clientKeyAlgo) Set the encryption algorithm of the client private key. |
void |
setClientKeyData(String clientKeyData) Set a client private key. |
void |
setClientKeyPassphrase(String clientKeyPassphrase) Set the password of a client private key. |
void |
setConnectionTimeout(int connectionTimeout) Set the connection timeout interval. |
void |
setConnectTimeout(int connectTimeout) Set the connection timeout interval. |
void |
setContent(Object content) Set the HTTP request content in object format. |
void |
setContentType(String contentType) Set the content type of an HTTP request. |
void |
setHeader(String name, String value) Set the request header with the specified name and value. |
void |
setHeader(String name, String[] value) Set the request header with the specified name and value. |
void |
setHeaders(Map<String,String> headers) Set the request header. |
void |
setHeaderValues(Map<String,String[]> headers) Set the request header. |
void |
setHttpProxy(String httpProxy) Set the HTTP proxy. |
void |
setHttpsProxy(String httpsProxy) Set the HTTPS proxy. |
void |
setMaxConcurrentRequests(int maxConcurrentRequests) Set the maximum number of concurrent requests. |
void |
setMaxConcurrentRequests...(int maxConcurrentRequestsPerHost) Set the maximum number of concurrent requests per host. |
void |
setMethod(String method) Set the HTTP method. |
void |
setNoProxy(String[] noProxy) Set a list of IP addresses that do not use the proxy. |
void |
setParameter(String name, String value) Set the HTTP request parameters. |
void |
setParameters(java.util.Map<String,String> parameters) Set the HTTP request parameters. |
void |
setProxyPassword(String proxyPassword) Set a proxy password. |
void |
setProxyUsername(String proxyUsername) Set a proxy username. |
void |
setRedirects(boolean redirects) Set whether redirection is allowed. |
void |
setRequestId(String requestId) Set the request ID. |
void |
setRequestTimeout(int requestTimeout) Set the request timeout interval. |
void |
setRollingTimeout(long rollingTimeout) Set the rolling timeout interval. |
void |
setScaleTimeout(long scaleTimeout) Set the scaling timeout interval. |
void |
setSecretKey(String secretKey) Set the SecretKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing. |
void |
setSsl(boolean ssl) Set whether HTTPS is used. |
void |
setSslRedirects(boolean sslRedirects) Set the value of sslRedirects. |
void |
setTlsVersions(okhttp3.TlsVersion[] tlsVersions) Set the TLS version. |
void |
setTrustCerts(boolean trustCerts) Set whether all certificates are trusted. |
void |
setUrl(String url) Set the URL. |
void |
setUserAgent(String userAgent) Set the user agent. |
void |
setWebsocketPingInterval(long websocketPingInterval) Set the WebSocket heartbeat interval. |
void |
setWebsocketTimeout(long websocketTimeout) Set the WebSocket timeout interval. |
Method Details
- public void addHeaderToSign(String headerName)
Add the header to the signature.
Input Parameter
headerName indicates the request header name.
- public String getAccessKey()
Obtain the AccessKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing.
Returns
AccessKey of the request signature.
- public String getCaCertData()
Obtain a CA certificate.
Returns
CA certificate.
- public String getCharset()
Obtain the HTTP request encoding format.
Returns
HTTP request encoding format.
- public String getClientCertData()
Obtain a client certificate.
Returns
Client certificate.
- public String getClientKeyAlgo()
Obtain the encryption algorithm of the client private key.
Returns
Encryption algorithm of the client private key.
- public String getClientKeyData()
Obtain a client private key.
Returns
Client private key.
- public String getClientKeyPassphrase()
Obtain the password of a client private key.
Returns
Password of a client private key.
- public int getConnectionTimeout()
Obtain the connection timeout interval.
Returns
Connection timeout interval.
- public int getConnectTimeout()
Obtain the connection timeout interval.
Returns
Connection timeout interval.
- public Object getContent()
Obtain the content of an HTTP request.
Returns
HTTP request content.
- public String getContentType()
Obtain the content format of an HTTP request.
Returns
Content format of an HTTP request.
- public String getHeader(String name)
Obtain the HTTP request header with a specified name.
Input Parameter
name indicates the request header name.
Returns
Request header information with a specified name.
- public Set<String> getHeaderNames()
Obtain the name of the HTTP request header.
Returns
Name of the HTTP request header.
- public Map<String,String[]> getHeaders()
Obtain all request headers.
Returns
All request headers.
- public String[] getHeaders(String name)
Obtain all HTTP request headers with a specified name.
Input Parameter
name indicates the request header name.
Returns
All HTTP request headers with a specified name.
- public Set<String> getHeadersToSign()
Obtain the request header in a signature.
Returns
Request header in a signature.
- public String getHttpProxy()
Obtain the HTTP proxy.
Returns
HTTP proxy.
- public String getHttpsProxy()
Obtain the HTTPS proxy.
Returns
HTTPS proxy.
- public int getMaxConcurrentRequests()
Obtain the maximum number of concurrent requests.
Returns
Maximum number of concurrent requests.
- public int getMaxConcurrentRequestsPerHost()
Obtain the maximum number of concurrent requests per host.
Returns
Maximum number of concurrent requests per host.
- public String getMethod()
Obtain the HTTP method.
Returns
HTTP method.
- public String[] getNoProxy()
Obtain a list of IP addresses that do not use the proxy.
Returns
A list of IP addresses that do not use the proxy.
- public String getParameter(String name)
Obtain the HTTP request parameters with a specified name.
Input Parameter
name indicates the HTTP name.
Returns
HTTP request parameters with a specified name.
- public Set<String> getParameterNames()
Obtain the HTTP request parameters.
Returns
HTTP request parameters.
- public Map<String,String> getParameters()
Obtain the HTTP request parameters.
Returns
HTTP request parameters.
- public String getProxyPassword()
Obtain a proxy password.
Returns
Proxy password.
- public String getProxyUsername()
Obtain a proxy username.
Returns
Proxy username.
- public RequestConfig getRequestConfig()
Obtain the request configuration.
Returns
Boolean value of sslRedirects.
- public String getRequestId()
Obtain the request ID.
Returns
Request ID.
- public int getRequestTimeout()
Obtain the request timeout interval.
Returns
Request timeout interval.
- public long getRollingTimeout()
Obtain the rolling timeout interval.
Returns
Rolling timeout interval.
- public long getScaleTimeout()
Obtain the scaling timeout interval.
Returns
Scaling timeout interval.
- public String getSecretKey()
Obtain the SecretKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing.
Returns
SecretKey of the request signature.
- public okhttp3.TlsVersion[] getTlsVersions()
Obtain the TLS version.
Returns
TLS version.
- public String getUrl()
Obtain the URL.
Returns
URL.
- public String getUserAgent()
Obtain the user agent.
Returns
User agent.
- public long getWebsocketPingInterval()
Obtain the WebSocket heartbeat interval.
Returns
WebSocket heartbeat interval.
- public long getWebsocketTimeout()
Obtain the WebSocket timeout interval.
Returns
WebSocket timeout interval.
- public boolean isRedirects()
Allow redirection or not.
Returns
true or false
- public boolean isSsl()
Check whether HTTPS is used. The default value is false.
Returns
true or false
- public boolean isSslRedirects()
Check whether to obtain the value of sslRedirects. The options are true and false.
Returns
Value of sslRedirects.
- public boolean isTrustCerts()
Check whether all certificates are trusted.
Returns
All trusted certificates
- public void setAccessKey(String accessKey)
Set the AccessKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing.
Input Parameter
accessKey indicates the AccessKey of the request signature.
- public void setBodyForm(Map<String,String> content)
Set the HTTP request content of the map type.
Input Parameter
content indicates the HTTP request content.
- public void setBodyText(String content)
Set the HTTP request content of the string type.
Input Parameter
content indicates the HTTP request content.
- public void setCaCertData(String caCertData)
Set the CA certificate.
Input Parameter
caCertData indicates the CA certificate.
- public void setCharset(String charset)
Set the HTTP request encoding format.
Input Parameter
charset indicates the encoding format of the HTTP request.
- public void setClientCertData(String clientCertData)
Set a client certificate.
Input Parameter
clientCertData indicates a client certificate.
- public void setClientKeyAlgo(String clientKeyAlgo)
Set the encryption algorithm of the client private key.
Input Parameter
clientKeyAlgo indicates the encryption algorithm of the client private key.
- public void setClientKeyData(String clientKeyData)
Set a client private key.
Input Parameter
clientKeyData indicates a client private key.
- public void setClientKeyPassphrase(String clientKeyPassphrase)
Set the password of a client private key.
Input Parameter
clientKeyPassphrase indicates the password of a client private key.
- public void setConnectionTimeout(int connectionTimeout)
Set the connection timeout interval.
Input Parameter
connectionTimeout indicates the connection timeout interval.
- public void setConnectTimeout(int connectTimeout)
Set the connection timeout interval.
Input Parameter
connectTimeout indicates the connection timeout interval.
- public void setContent(Object content)
Set the HTTP request content of the string and file types.
Input Parameter
content indicates the HTTP request content.
- public void setContentType(String contentType)
Set the content type of an HTTP request.
Input Parameter
contentType indicates the content type of an HTTP request.
- public void setHeader(String name, String value)
Set the request header.
Input Parameter
- name indicates the request header name.
- value indicates the request header value.
- public void setHeader(String name, String[] value)
Set the request header.
Input Parameter
- name indicates the request header name.
- value indicates the request header value.
- public void setHeaders(Map<String,String> headers)
Set the request header.
Input Parameter
headers indicates the request header information.
- public void setHeaderValues(Map<String,String[]> headers)
Set the request header.
Input Parameter
headers indicates the request header information.
- public void setHttpProxy(String httpProxy)
Set the HTTP proxy.
Input Parameter
httpProxy indicates the HTTP proxy.
- public void setHttpsProxy(String httpsProxy)
Set the HTTPS proxy.
Input Parameter
httpsProxy indicates the HTTPS proxy.
- public void setMaxConcurrentRequests(int maxConcurrentRequests)
Set the maximum number of concurrent requests.
Input Parameter
maxConcurrentRequests:
- public void setMaxConcurrentRequestsPerHost(int maxConcurrentRequestsPerHost
Set the maximum number of concurrent requests per host.
Input Parameter
maxConcurrentRequestsPerHost:
- public void setMethod(String method)
Set the HTTP method.
Input Parameter
method indicates the HTTP method.
- public void setNoProxy(String[] noProxy)
Set a list of IP addresses that do not use the proxy.
Input Parameter
noProxy indicates a list of IP addresses that do not use the proxy.
- public void setParameter(String name, String value)
Set the HTTP request parameters.
Input Parameter
- name indicates the name of an HTTP request parameter.
- value indicates the value of an HTTP request parameter.
- public void setParameters(Map<String,String> parameters)
Set the HTTP request parameters.
Input Parameter
parameters indicates the HTTP request parameters.
- public void setProxyPassword(String proxyPassword)
Set a proxy password.
Input Parameter
proxyPassword indicates the proxy password.
- public void setProxyUsername(String proxyUsername)
Set a proxy username.
Input Parameter
proxyUsername indicates the proxy username.
- public void setRedirects(boolean redirects)
Set whether redirection is allowed.
Input Parameter
redirects indicates whether redirection is allowed.
- public void setRequestId(String requestId)
Set the request ID.
Input Parameter
requestId indicates the request ID.
- public void setRequestTimeout(int requestTimeout)
Set the request timeout interval.
Input Parameter
requestTimeout indicates the request timeout interval.
- public void setRollingTimeout(long rollingTimeout)
Set the rolling timeout interval.
Input Parameter
rollingTimeout indicates the rolling timeout interval.
- public void setScaleTimeout(long scaleTimeout)
Set the scaling timeout interval.
Input Parameter
scaleTimeout indicates the scale timeout interval.
- public void setSecretKey(String secretKey)
Set the SecretKey of the request signature. Requests for which AccessKey and SecretKey are set use the AK/SK signature algorithm for signing.
Input Parameter
secretKey indicates the SecretKey of the request signature.
- public void setSsl(boolean ssl)
Set whether HTTPS is used.
Input Parameter
ssl indicates whether HTTPS is used.
- public void setSslRedirects(boolean sslRedirects)
Set whether to obtain the value of sslRedirects. The options are true and false.
Input Parameter
sslRedirects indicates whether sslRedirects is set (true/false).
- public void setTlsVersions(okhttp3.TlsVersion[] tlsVersions)
Set the TLS version.
Input Parameter
tlsVersions indicates the TLS version.
- public void setTrustCerts(boolean trustCerts)
Set whether all certificates are trusted.
Input Parameter
trustCerts indicates whether all certificates are trusted.
- public void setUrl(String url)
Set the URL.
Input Parameter
url indicates the URL.
- public void setUserAgent(String userAgent)
Set the user agent.
Input Parameter
userAgent indicates the user agent.
- public void setWebsocketPingInterval(long websocketPingInterval)
Set the WebSocket heartbeat interval.
Input Parameter
websocketPingInterval indicates the WebSocket heartbeat interval.
- public void setWebsocketTimeout(long websocketTimeout)
Set the WebSocket timeout interval.
Input Parameter
websocketTimeout indicates the WebSocket timeout interval.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot