HttpRequest Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. transport. http. HttpRequest
- com.
public class HttpRequest
Field Summary
Modifier and Type | Field and Description |
---|---|
final String | IF_MATCH |
final String | REQUEST_ID |
Constructor Summary
Constructor | Description | |
---|---|---|
HttpRequest() | ||
HttpRequest(URL url, HttpMethod method, byte[] body, String authorizationToken) |
Constructor. Takes a URL as an argument and returns an HTTPS request that is ready to be sent. |
|
HttpRequest(URL url, HttpMethod method, byte[] body, String authorizationToken, Proxy proxy) |
Constructor. Takes a URL as an argument and returns an HTTPS request that is ready to be sent through an optional proxy. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Http |
send()
Executes the HTTPS request. |
Http |
setConnectTimeoutSeconds(int timeout)
Set the connect timeout, in seconds, for the request. The connect timeout is the allowed amount of time for the http connection to be established. |
Http |
setHeaderField(String field, String value)
Sets the header field to the given value. |
Http |
setHeaders(Map<String, String> headers)
Sets the header field to the given value. |
Http |
setReadTimeoutSeconds(int timeout)
Sets the read timeout, in seconds, for the request. The read timeout is the number of milliseconds after the server receives a request and before the server sends data back. |
Field Details
IF_MATCH
public static final String IF_MATCH= "If-Match"
REQUEST_ID
public static final String REQUEST_ID= "Request-Id"
Constructor Details
HttpRequest
protected HttpRequest()
HttpRequest
public HttpRequest(URL url, HttpMethod method, byte[] body, String authorizationToken)
Constructor. Takes a URL as an argument and returns an HTTPS request that is ready to be sent.
Parameters:
Throws:
HttpRequest
public HttpRequest(URL url, HttpMethod method, byte[] body, String authorizationToken, Proxy proxy)
Constructor. Takes a URL as an argument and returns an HTTPS request that is ready to be sent through an optional proxy.
Parameters:
Throws:
Method Details
send
public HttpResponse send()
Executes the HTTPS request.
Returns:
Throws:
setConnectTimeoutSeconds
public HttpRequest setConnectTimeoutSeconds(int timeout)
Set the connect timeout, in seconds, for the request. The connect timeout is the allowed amount of time for the http connection to be established.
Parameters:
Returns:
setHeaderField
public HttpRequest setHeaderField(String field, String value)
Sets the header field to the given value.
Parameters:
Returns:
setHeaders
public HttpRequest setHeaders(Map
Sets the header field to the given value.
Parameters:
Returns:
setReadTimeoutSeconds
public HttpRequest setReadTimeoutSeconds(int timeout)
Sets the read timeout, in seconds, for the request. The read timeout is the number of milliseconds after the server receives a request and before the server sends data back.
Parameters:
Returns:
Applies to
Azure SDK for Java