Package com.github.alexdlaird.http
Interface HttpClient
- All Known Implementing Classes:
DefaultHttpClient
public interface HttpClient
A simple client for executing HTTP requests.
-
Method Summary
Modifier and Type Method Description default Response<java.util.Map>delete(java.lang.String uri, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders)<B> Response<B>delete(java.lang.String uri, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform DELETE operation against an endpoint.<B> Response<B>get(java.lang.String uri, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform GET operation against an endpoint.default voidmodifyConnection(java.net.HttpURLConnection httpUrlConnection)Override this method if you could like to extendDefaultHttpClientand perform customer HTTP operations beforeURLConnection.connect()is called on the instance of the passed in connection.<R, B> Response<B>post(java.lang.String uri, R request, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform POST operation against an endpoint.<R, B> Response<B>put(java.lang.String uri, R request, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform PUT operation against an endpoint.
-
Method Details
-
get
<B> Response<B> get(java.lang.String uri, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform GET operation against an endpoint.- Parameters:
uri- The URL relative to the base URL on which to perform the operation.parameters- An arbitrary number of parameters to add to the URL.additionalHeaders- Additional headers for the request.clazz- The class for the Response's body.- Returns:
- The results of the query.
-
post
<R, B> Response<B> post(java.lang.String uri, R request, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform POST operation against an endpoint.- Parameters:
uri- The URL relative to the base URL on which to perform the operation.request- The element to be serialized into the request body.parameters- An arbitrary number of parameters to add to the URL.additionalHeaders- Additional headers for the request.clazz- The class for the Response's body.- Returns:
- The results of the query.
-
put
<R, B> Response<B> put(java.lang.String uri, R request, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform PUT operation against an endpoint.- Parameters:
uri- The URL relative to the base URL on which to perform the operation.request- The element to be serialized into the request body.parameters- An arbitrary number of parameters to add to the URL.additionalHeaders- Additional headers for the request.clazz- The class for the Response's body.- Returns:
- The results of the query.
-
delete
<B> Response<B> delete(java.lang.String uri, java.util.List<Parameter> parameters, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.Class<B> clazz)Perform DELETE operation against an endpoint.- Parameters:
uri- The URL relative to the base URL on which to perform the operation.parameters- An arbitrary number of parameters to add to the URL.additionalHeaders- Additional headers for the request.clazz- The class for the Response's body.- Returns:
- The results of the query.
-
delete
-
modifyConnection
default void modifyConnection(java.net.HttpURLConnection httpUrlConnection)Override this method if you could like to extendDefaultHttpClientand perform customer HTTP operations beforeURLConnection.connect()is called on the instance of the passed in connection.- Parameters:
httpUrlConnection- The URL connection to modify.
-