Package com.intellectualsites.http
Class HttpClient.Builder
java.lang.Object
com.intellectualsites.http.HttpClient.Builder
- Enclosing class:
- HttpClient
Builder for
HttpClient. Use HttpClient.newBuilder() to create
an instance of the builder-
Method Summary
Modifier and TypeMethodDescriptionbuild()Create a newHttpClientusing the settings specified in the builderwithBaseURL(@NotNull String baseURL)Set the base URL.withDecorator(@NotNull Consumer<HttpClient.WrappedRequestBuilder> decorator)Add a new request decorator.withEntityMapper(@Nullable EntityMapper entityMapper)Set the default entity mapper that is used by all requests, unless otherwise specified
-
Method Details
-
withBaseURL
Set the base URL. This will be prepended to each request made with the client.- Parameters:
baseURL- Base URL. Cannot be null, but can be empty.- Returns:
- Builder instance
-
withEntityMapper
@NotNull public @NotNull HttpClient.Builder withEntityMapper(@Nullable @Nullable EntityMapper entityMapper)Set the default entity mapper that is used by all requests, unless otherwise specified- Parameters:
entityMapper- Entity mapper- Returns:
- Builder instance
-
withDecorator
@NotNull public @NotNull HttpClient.Builder withDecorator(@NotNull @NotNull Consumer<HttpClient.WrappedRequestBuilder> decorator)Add a new request decorator. This will have the opportunity to decorate every request made by this client- Parameters:
decorator- Decorator- Returns:
- Builder instance
-
build
Create a newHttpClientusing the settings specified in the builder- Returns:
- Created client
-