public final class DefaultHttpConnection extends Object implements HttpConnection
| Constructor and Description |
|---|
DefaultHttpConnection(HttpURLConnection con) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
header(String key,
String value) |
void |
output(Consumer<? super OutputStream> consumer,
String contentType,
Optional<String> contentEncoding,
boolean chunked)
When a consumer is defined (when this method is called), this class is
expected to set the Content-Type and Content-Length fields (and support
chunking if requested).
|
Response |
response() |
void |
setConnectTimeoutMs(long connectTimeoutMs) |
void |
setReadTimeoutMs(long readTimeoutMs) |
public DefaultHttpConnection(HttpURLConnection con)
public void header(String key, String value)
header in interface HttpConnectionpublic void output(Consumer<? super OutputStream> consumer, String contentType, Optional<String> contentEncoding, boolean chunked)
HttpConnectionoutput in interface HttpConnectionconsumer - action to be performed on the OutputStreamcontentType - Content-Type header valuecontentEncoding - if present is appended to the Content-Type valuepublic Response response() throws IOException
response in interface HttpConnectionIOExceptionpublic void close()
throws IOException
close in interface HttpConnectionIOExceptionpublic void setConnectTimeoutMs(long connectTimeoutMs)
setConnectTimeoutMs in interface HttpConnectionpublic void setReadTimeoutMs(long readTimeoutMs)
setReadTimeoutMs in interface HttpConnectionCopyright © 2023. All rights reserved.