-
public class HttpClient
-
-
Field Summary
Fields Modifier and Type Field Description private final Property<Int>connectionTimeoutprivate final Property<Boolean>connectionIgnoreSslprivate final Property<Boolean>connectionRetriesprivate final Property<Boolean>authorizationPreemptiveprivate final Property<String>baseUrlprivate final Property<String>basicUserprivate final Property<String>basicPasswordprivate Pair<String, String>basicCredentialsprivate final Property<ContentType>multipartTextTypeprivate final Property<ContentType>multipartBinaryTypeprivate final Property<String>proxyHostprivate final Property<Int>proxyPortprivate final Property<String>proxySchemeprivate final Property<Boolean>responseChecks
-
Constructor Summary
Constructors Constructor Description HttpClient(CommonExtension common)
-
Method Summary
-
-
Constructor Detail
-
HttpClient
HttpClient(CommonExtension common)
-
-
Method Detail
-
requestConfigurer
final Unit requestConfigurer(Function1<HttpRequestBase, Unit> configurer)
-
clientBuilder
final Unit clientBuilder(Function1<HttpClientBuilder, Unit> builder)
-
useDefaults
final Unit useDefaults(HttpClientBuilder $self)
-
responseHandler
final Unit responseHandler(Function1<HttpResponse, Unit> handler)
-
responseChecker
final Unit responseChecker(Function1<HttpResponse, Unit> checker)
-
request
final <T extends Any> T request(String method, String uri, Function2<HttpClient, HttpResponse, T> handler)
-
get
final <T extends Any> T get(String uri, Function2<HttpClient, HttpResponse, T> handler)
-
get
final <T extends Any> T get(String uri, Function2<HttpClient, HttpResponse, T> handler, Function1<HttpGet, Unit> options)
-
head
final <T extends Any> T head(String uri, Function2<HttpClient, HttpResponse, T> handler)
-
head
final <T extends Any> T head(String uri, Function2<HttpClient, HttpResponse, T> handler, Function1<HttpHead, Unit> options)
-
delete
final <T extends Any> T delete(String uri, Function2<HttpClient, HttpResponse, T> handler)
-
delete
final <T extends Any> T delete(String uri, Function2<HttpClient, HttpResponse, T> handler, Function1<HttpDelete, Unit> options)
-
put
final <T extends Any> T put(String uri, Function2<HttpClient, HttpResponse, T> handler)
-
put
final <T extends Any> T put(String uri, Function2<HttpClient, HttpResponse, T> handler, Function1<HttpPut, Unit> options)
-
patch
final <T extends Any> T patch(String uri, Function2<HttpClient, HttpResponse, T> handler)
-
patch
final <T extends Any> T patch(String uri, Function2<HttpClient, HttpResponse, T> handler, Function1<HttpPatch, Unit> options)
-
post
final <T extends Any> T post(String uri, Map<String, Any> params, Function2<HttpClient, HttpResponse, T> handler)
-
post
final <T extends Any> T post(String uri, Function2<HttpClient, HttpResponse, T> handler)
-
post
final <T extends Any> T post(String uri, Function2<HttpClient, HttpResponse, T> handler, Function1<HttpPost, Unit> options)
-
postUrlencoded
final <T extends Any> T postUrlencoded(String uri, Map<String, Any> params, Function2<HttpClient, HttpResponse, T> handler)
-
postMultipart
final <T extends Any> T postMultipart(String uri, Map<String, Any> params, Function2<HttpClient, HttpResponse, T> handler)
-
asStream
final InputStream asStream(HttpResponse response)
-
asJson
final JsonNode asJson(HttpResponse response)
-
asHtml
final Document asHtml(HttpResponse response)
-
asXml
final Document asXml(HttpResponse response)
-
asString
final String asString(HttpResponse response)
-
asObjectFromJson
final <T extends Any> T asObjectFromJson(HttpResponse response)
-
asObjectFromJson
final <T extends Any> T asObjectFromJson(HttpResponse response, Class<T> clazz)
-
asMapFromJson
final Map<String, Any> asMapFromJson(HttpResponse response)
-
asMapFromJson
final Map<String, Any> asMapFromJson(HttpResponse response, String jsonPointer)
-
asNodeFromJson
final JsonNode asNodeFromJson(HttpResponse response, String jsonPointer)
-
checkStatus
final Unit checkStatus(HttpResponse response, IntRange statusCodes)
-
checkStatus
final Unit checkStatus(HttpResponse response, Integer statusCode)
-
checkStatus
final Unit checkStatus(HttpResponse response, List<Int> statusCodes)
-
throwStatusException
Unit throwStatusException(HttpResponse response)
-
checkText
final Unit checkText(HttpResponse response, String containedText, Boolean ignoreCase)
-
baseUrl
String baseUrl(String uri)
Fix for HttpClient's: 'escaped absolute path not valid' https://stackoverflow.
-
execute
<T extends Any> T execute(HttpRequestBase method, Function2<HttpClient, HttpResponse, T> handler)
-
execute
final Unit execute(HttpRequestBase method)
-
createEntityUrlencoded
HttpEntity createEntityUrlencoded(Map<String, Any> params)
-
createEntityMultipart
HttpEntity createEntityMultipart(Map<String, Any> params)
-
downloadTo
final File downloadTo(String fileUrl, File dir)
-
getConnectionTimeout
final Property<Int> getConnectionTimeout()
-
getConnectionIgnoreSsl
final Property<Boolean> getConnectionIgnoreSsl()
-
getConnectionRetries
final Property<Boolean> getConnectionRetries()
-
getAuthorizationPreemptive
final Property<Boolean> getAuthorizationPreemptive()
-
getBaseUrl
final Property<String> getBaseUrl()
-
getBasicUser
final Property<String> getBasicUser()
-
getBasicPassword
final Property<String> getBasicPassword()
-
getBasicCredentials
final Pair<String, String> getBasicCredentials()
-
getMultipartTextType
final Property<ContentType> getMultipartTextType()
-
getMultipartBinaryType
final Property<ContentType> getMultipartBinaryType()
-
getProxyHost
final Property<String> getProxyHost()
-
getProxyPort
final Property<Int> getProxyPort()
-
getProxyScheme
final Property<String> getProxyScheme()
-
getResponseChecks
final Property<Boolean> getResponseChecks()
-
setBasicCredentials
final Unit setBasicCredentials(Pair<String, String> basicCredentials)
-
-
-
-