Package com.hexagonkt.http.client
Class HttpClient
-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public final class HttpClient implements CloseableClient to use other REST services.
-
-
Field Summary
Fields Modifier and Type Field Description private List<Cookie>cookiesprivate final HttpClientSettingssettingsprivate final HttpHandlerhandler
-
Constructor Summary
Constructors Constructor Description HttpClient(HttpClientPort adapter, HttpClientSettings settings, HttpHandler handler)
-
Method Summary
Modifier and Type Method Description final List<Cookie>getCookies()final UnitsetCookies(List<Cookie> cookies)final HttpClientSettingsgetSettings()final HttpHandlergetHandler()Unitclose()final Map<String, Cookie>cookiesMap()final Unitstart()final Unitstop()final Booleanstarted()final HttpResponsePortsend(HttpRequest request, Map<String, Object> attributes)Synchronous execution. final Flow.Publisher<ServerEvent>sse(HttpRequest request)final Flow.Publisher<ServerEvent>sse(String path)final WsSessionws(String path, Function1<WsSession, Unit> onConnect, Function2<WsSession, ByteArray, Unit> onBinary, Function2<WsSession, String, Unit> onText, Function2<WsSession, ByteArray, Unit> onPing, Function2<WsSession, ByteArray, Unit> onPong, Function3<WsSession, Integer, String, Unit> onClose)final Unitrequest(Function1<HttpClient, Unit> block)final HttpResponsePortget(String path, Headers headers, Object body, ContentType contentType, List<ContentType> accept)final HttpResponsePorthead(String path, Headers headers)final HttpResponsePortpost(String path, Object body, ContentType contentType, List<ContentType> accept)final HttpResponsePortput(String path, Object body, ContentType contentType, List<ContentType> accept)final HttpResponsePortdelete(String path, Object body, ContentType contentType, List<ContentType> accept)final HttpResponsePorttrace(String path, Object body, ContentType contentType, List<ContentType> accept)final HttpResponsePortoptions(String path, Object body, Headers headers, ContentType contentType, List<ContentType> accept)final HttpResponsePortpatch(String path, Object body, ContentType contentType, List<ContentType> accept)-
-
Constructor Detail
-
HttpClient
HttpClient(HttpClientPort adapter, HttpClientSettings settings, HttpHandler handler)
-
-
Method Detail
-
getCookies
final List<Cookie> getCookies()
-
setCookies
final Unit setCookies(List<Cookie> cookies)
-
getSettings
final HttpClientSettings getSettings()
-
getHandler
final HttpHandler getHandler()
-
close
Unit close()
-
cookiesMap
final Map<String, Cookie> cookiesMap()
-
start
final Unit start()
-
stop
final Unit stop()
-
started
final Boolean started()
-
send
final HttpResponsePort send(HttpRequest request, Map<String, Object> attributes)
Synchronous execution.
-
sse
final Flow.Publisher<ServerEvent> sse(HttpRequest request)
-
sse
final Flow.Publisher<ServerEvent> sse(String path)
-
ws
final WsSession ws(String path, Function1<WsSession, Unit> onConnect, Function2<WsSession, ByteArray, Unit> onBinary, Function2<WsSession, String, Unit> onText, Function2<WsSession, ByteArray, Unit> onPing, Function2<WsSession, ByteArray, Unit> onPong, Function3<WsSession, Integer, String, Unit> onClose)
-
request
final Unit request(Function1<HttpClient, Unit> block)
-
get
final HttpResponsePort get(String path, Headers headers, Object body, ContentType contentType, List<ContentType> accept)
-
head
final HttpResponsePort head(String path, Headers headers)
-
post
final HttpResponsePort post(String path, Object body, ContentType contentType, List<ContentType> accept)
-
put
final HttpResponsePort put(String path, Object body, ContentType contentType, List<ContentType> accept)
-
delete
final HttpResponsePort delete(String path, Object body, ContentType contentType, List<ContentType> accept)
-
trace
final HttpResponsePort trace(String path, Object body, ContentType contentType, List<ContentType> accept)
-
options
final HttpResponsePort options(String path, Object body, Headers headers, ContentType contentType, List<ContentType> accept)
-
patch
final HttpResponsePort patch(String path, Object body, ContentType contentType, List<ContentType> accept)
-
-
-
-