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 |
---|---|
protected final
Http |
connection
The underlying HTTPS connection stream. |
Constructor Summary
Modifier | Constructor | Description | |
---|---|---|---|
protected | HttpRequest() | ||
HttpRequest(URL url, HttpMethod method, byte[] body) |
Constructor. |
||
HttpRequest(URL url, HttpMethod method, byte[] body, Proxy proxy) |
Constructor. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Http |
send()
Executes the HTTPS request. |
Http |
setConnectTimeoutMillis(int timeout)
Set the connect timeout, in milliseconds, for the request. |
Http |
setHeaderField(String field, String value)
Sets the header field to the given value. |
Http |
setReadTimeoutMillis(int timeout)
Sets the read timeout, in milliseconds, for the request. |
Methods inherited from java.lang.Object
Field Details
connection
protected final HttpConnection connection
The underlying HTTPS connection stream.
Constructor Details
HttpRequest
protected HttpRequest()
HttpRequest
public HttpRequest(URL url, HttpMethod method, byte[] body)
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, 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:
setConnectTimeoutMillis
public HttpRequest setConnectTimeoutMillis(int timeout)
Set the connect timeout, in milliseconds, 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:
setReadTimeoutMillis
public HttpRequest setReadTimeoutMillis(int timeout)
Sets the read timeout, in milliseconds, 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: