public class HttpRequest extends Object
Modifier | Constructor and Description |
---|---|
protected |
HttpRequest() |
|
HttpRequest(URL url,
HttpMethod method,
byte[] body)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
HttpResponse |
send()
Executes the HTTPS request.
|
HttpRequest |
setHeaderField(String field,
String value)
Sets the header field to the given value.
|
HttpRequest |
setReadTimeoutMillis(int timeout)
Sets the read timeout, in milliseconds, for the request.
|
HttpRequest |
setSSLContext(SSLContext sslContext) |
public HttpRequest(URL url, HttpMethod method, byte[] body) throws IOException
url
- The URL for the request.method
- The HTTPS request method (i.e. GET).body
- The request body. Must be an array of size 0 if the request method is GET or DELETE.IOException
- This exception thrown if an IOException occurs
in setting up the HTTPS connection.IllegalArgumentException
- This exception thrown if the endpoint
given does not use the HTTPS protocol.protected HttpRequest()
public HttpResponse send() throws IOException
IOException
- This exception thrown if the connection could not be
established, or the input/output streams could not be accessed.public HttpRequest setHeaderField(String field, String value)
field
- The header field name.value
- The header field value.public HttpRequest setReadTimeoutMillis(int timeout)
timeout
- The read timeout.public HttpRequest setSSLContext(SSLContext sslContext)
Copyright © 2022. All rights reserved.