public final class HttpCloseableConnection<T> extends java.lang.Object implements CloseableConnection<T>
HttpConnection.RequestField
Constructor and Description |
---|
HttpCloseableConnection(java.lang.String url) |
Modifier and Type | Method and Description |
---|---|
<V> HttpConnection<T> |
addRequestField(java.lang.String field,
V value)
Add header to http request
|
HttpConnection<T> |
addRequestFields(java.util.Map<java.lang.String,java.lang.Object> map)
Add headers to http request
|
void |
close()
Close a resource without catch exception
|
HttpGetRequest<T> |
createGetRequest()
Performs a get request
|
HttpPostRequest<T> |
createPostRequest()
Performs a post request
|
CloseableConnection<T> |
open()
Open a HTTP URL Connection
|
CloseableConnection<T> |
openHandlingException()
Open a HTTP URL Connection
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addRequestField, addRequestFields
public CloseableConnection<T> open()
open
in interface CloseableConnection<T>
public CloseableConnection<T> openHandlingException() throws java.io.IOException
openHandlingException
in interface CloseableConnection<T>
java.io.IOException
- if an I/O exception occurs.public void close()
close
in interface SilentlyTerminable
close
in interface java.lang.AutoCloseable
public <V> HttpConnection<T> addRequestField(java.lang.String field, V value)
addRequestField
in interface HttpConnection<T>
field
- Field that will be added in the headers of the requestvalue
- Value of the field, this will be serialized to stringpublic HttpConnection<T> addRequestFields(java.util.Map<java.lang.String,java.lang.Object> map)
addRequestFields
in interface HttpConnection<T>
map
- Map containing all fields and values, the values will be serialized to stringpublic HttpGetRequest<T> createGetRequest()
HttpConnection
createGetRequest
in interface HttpConnection<T>
public HttpPostRequest<T> createPostRequest()
HttpConnection
createPostRequest
in interface HttpConnection<T>