public class BasicHttpPoster extends Object
IHttpClientProvider and
HttpPost.| Constructor and Description |
|---|
BasicHttpPoster() |
| Modifier and Type | Method and Description |
|---|---|
static com.helger.httpclient.HttpClientFactory |
createDefaultHttpClientFactory() |
com.helger.httpclient.HttpClientFactory |
getHttpClientFactory() |
com.helger.commons.functional.IConsumer<? super org.apache.http.client.methods.HttpPost> |
getHttpCustomizer() |
boolean |
isQuoteHttpHeaders() |
<T> T |
sendGenericMessage(String sURL,
org.apache.http.HttpEntity aHttpEntity,
com.helger.commons.http.HttpHeaderMap aCustomHeaders,
org.apache.http.client.ResponseHandler<? extends T> aResponseHandler)
Send an arbitrary HTTP POST message to the provided URL, using the
contained HttpClientFactory as well as the customizer.
|
<T> T |
sendGenericMessageWithRetries(com.helger.commons.http.HttpHeaderMap aHttpHeaders,
org.apache.http.HttpEntity aHttpEntity,
String sMessageID,
String sURL,
int nMaxRetries,
long nRetryIntervalMS,
org.apache.http.client.ResponseHandler<? extends T> aResponseHandler,
IAS4OutgoingDumper aOutgoingDumper) |
BasicHttpPoster |
setHttpClientFactory(com.helger.httpclient.HttpClientFactory aHttpClientFactory)
Set the HTTP client provider to be used.
|
BasicHttpPoster |
setHttpCustomizer(com.helger.commons.functional.IConsumer<? super org.apache.http.client.methods.HttpPost> aHttpCustomizer)
Set the HTTP Post Customizer to be used.
|
BasicHttpPoster |
setQuoteHttpHeaders(boolean bQuoteHttpHeaders)
Enable or disable, if HTTP header values should be quoted or not.
|
String |
toString() |
@Nonnull public static com.helger.httpclient.HttpClientFactory createDefaultHttpClientFactory()
HttpClientFactory to be used.@Nonnull public final com.helger.httpclient.HttpClientFactory getHttpClientFactory()
@Nonnull public final BasicHttpPoster setHttpClientFactory(@Nonnull com.helger.httpclient.HttpClientFactory aHttpClientFactory)
createDefaultHttpClientFactory() as the default implementation of
IHttpClientProvider. This factory is used for http sending.aHttpClientFactory - The HTTP client factory to be used. May not be null.@Nullable public final com.helger.commons.functional.IConsumer<? super org.apache.http.client.methods.HttpPost> getHttpCustomizer()
null.@Nonnull public final BasicHttpPoster setHttpCustomizer(@Nullable com.helger.commons.functional.IConsumer<? super org.apache.http.client.methods.HttpPost> aHttpCustomizer)
aHttpCustomizer - The new customizer. May be null.public final boolean isQuoteHttpHeaders()
true if HTTP header values should be quoted if they
contain forbidden characters, false if not.@Nonnull public final BasicHttpPoster setQuoteHttpHeaders(boolean bQuoteHttpHeaders)
bQuoteHttpHeaders - true to quote them, false to not quote
them.@Nullable public final <T> T sendGenericMessage(@Nonnull @Nonempty String sURL, @Nonnull org.apache.http.HttpEntity aHttpEntity, @Nullable com.helger.commons.http.HttpHeaderMap aCustomHeaders, @Nonnull org.apache.http.client.ResponseHandler<? extends T> aResponseHandler) throws javax.mail.MessagingException, IOException
T - Response data typesURL - The URL to send to. May neither be null nor empty.aHttpEntity - The HTTP entity to be send. May not be null.aCustomHeaders - An optional http header map that should be applied. May be
null.aResponseHandler - The Http response handler that should be used to convert the HTTP
response to a domain object.null.javax.mail.MessagingException - In case moving HTTP headers from the Mime part to the HTTP message
failsIOException - In case of IO error@Nonnull public final <T> T sendGenericMessageWithRetries(@Nullable com.helger.commons.http.HttpHeaderMap aHttpHeaders, @Nonnull org.apache.http.HttpEntity aHttpEntity, @Nonnull String sMessageID, @Nonnull String sURL, int nMaxRetries, long nRetryIntervalMS, @Nonnull org.apache.http.client.ResponseHandler<? extends T> aResponseHandler, @Nullable IAS4OutgoingDumper aOutgoingDumper) throws Exception
ExceptionCopyright © 2015–2020 Philip Helger. All rights reserved.