public abstract class HttpProducer<A,B> extends RequestReplyProducerImp
Modifier and Type | Field and Description |
---|---|
protected static long |
DEFAULT_TIMEOUT |
log
Constructor and Description |
---|
HttpProducer() |
Modifier and Type | Method and Description |
---|---|
protected long |
defaultTimeout()
The default timeout for request messages when not supplied.
|
java.lang.String |
endpoint(AdaptrisMessage msg)
Return the endpoint that will be derived from the message.
|
java.lang.Boolean |
getAllowRedirect()
Automatically handle redirection.
|
@NonNull ContentTypeProvider |
getContentTypeProvider()
Content-Type header associated with the HTTP operation
|
ProduceDestination |
getDestination()
Deprecated.
|
java.lang.Boolean |
getIgnoreServerResponseCode()
Set whether to ignore the server response code.
|
protected RequestMethodProvider.RequestMethod |
getMethod(AdaptrisMessage msg) |
@NonNull RequestMethodProvider |
getMethodProvider()
The request method.
|
@NonNull RequestHeaderProvider<A> |
getRequestHeaderProvider()
Specify how we want to generate the initial set of HTTP Headers.
|
@NonNull ResponseHeaderHandler<B> |
getResponseHeaderHandler()
Specify how we handle headers from the HTTP response.
|
java.lang.String |
getUrl()
The URL endpoint to access.
|
protected boolean |
handleRedirection() |
protected boolean |
ignoreServerResponseCode() |
protected void |
logHeaders(java.lang.String header,
java.lang.String message,
java.util.Set headers) |
void |
prepare()
Prepare for initialisation.
|
void |
setAllowRedirect(java.lang.Boolean allowRedirect)
Automatically handle redirection.
|
void |
setContentTypeProvider(@NonNull ContentTypeProvider contentTypeProvider)
Content-Type header associated with the HTTP operation
|
void |
setDestination(ProduceDestination destination)
Deprecated.
|
void |
setIgnoreServerResponseCode(java.lang.Boolean ignoreServerResponseCode)
Set whether to ignore the server response code.
|
void |
setMethodProvider(@NonNull RequestMethodProvider methodProvider)
The request method.
|
void |
setRequestHeaderProvider(@NonNull RequestHeaderProvider<A> requestHeaderProvider)
Specify how we want to generate the initial set of HTTP Headers.
|
void |
setResponseHeaderHandler(@NonNull ResponseHeaderHandler<B> responseHeaderHandler)
Specify how we handle headers from the HTTP response.
|
void |
setUrl(java.lang.String url)
The URL endpoint to access.
|
<T extends HttpProducer> |
withURL(java.lang.String s) |
doProduce, doRequest, produce, produce, request, request, request, request
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
createName
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
close, init, start, stop
createQualifier, isTrackingEndpoint
protected static final long DEFAULT_TIMEOUT
protected long defaultTimeout()
RequestReplyProducerBase
defaultTimeout
in class RequestReplyProducerBase
RequestReplyProducerBase.defaultTimeout()
protected boolean handleRedirection()
protected boolean ignoreServerResponseCode()
protected RequestMethodProvider.RequestMethod getMethod(AdaptrisMessage msg)
protected void logHeaders(java.lang.String header, java.lang.String message, java.util.Set headers)
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public java.lang.String endpoint(AdaptrisMessage msg) throws ProduceException
AdaptrisMessageProducerImp
The purpose of this method is to mitigate the number of changes that need to happen because
ProduceDestination
is being deprecated; boilerplate code can still be present in the
parent super-classes w/o impacting concrete sub-classes "too much".
endpoint
in class AdaptrisMessageProducerImp
ProduceException
AdaptrisMessageProducer.request(AdaptrisMessage, ProduceDestination)
,
AdaptrisMessageProducer.request(AdaptrisMessage, ProduceDestination, long)
,
AdaptrisMessageSender.produce(AdaptrisMessage)
,
AdaptrisMessageSender.produce(AdaptrisMessage, ProduceDestination)
public <T extends HttpProducer> T withURL(java.lang.String s)
@NonNull public @NonNull RequestMethodProvider getMethodProvider()
The default is 'POST'
public void setMethodProvider(@NonNull @NonNull RequestMethodProvider methodProvider)
The default is 'POST'
@NonNull public @NonNull ContentTypeProvider getContentTypeProvider()
public void setContentTypeProvider(@NonNull @NonNull ContentTypeProvider contentTypeProvider)
@NonNull public @NonNull ResponseHeaderHandler<B> getResponseHeaderHandler()
The default behaviour will be to discard.
public void setResponseHeaderHandler(@NonNull @NonNull ResponseHeaderHandler<B> responseHeaderHandler)
The default behaviour will be to discard.
@NonNull public @NonNull RequestHeaderProvider<A> getRequestHeaderProvider()
The default behaviour is to not have any additional headers
public void setRequestHeaderProvider(@NonNull @NonNull RequestHeaderProvider<A> requestHeaderProvider)
The default behaviour is to not have any additional headers
public java.lang.Boolean getIgnoreServerResponseCode()
In some cases, you may wish to ignore any server response code (such as 500) as this may return meaningful data that you wish to use. If that's the case, make sure this flag is true. It defaults to false.
In all cases the metadata key
CoreConstants.HTTP_PRODUCER_RESPONSE_CODE
is populated with the last
server response.
public void setIgnoreServerResponseCode(java.lang.Boolean ignoreServerResponseCode)
In some cases, you may wish to ignore any server response code (such as 500) as this may return meaningful data that you wish to use. If that's the case, make sure this flag is true. It defaults to false.
In all cases the metadata key
CoreConstants.HTTP_PRODUCER_RESPONSE_CODE
is populated with the last
server response.
public java.lang.Boolean getAllowRedirect()
The default is true if not otherwise specified
public void setAllowRedirect(java.lang.Boolean allowRedirect)
The default is true if not otherwise specified
@Deprecated public ProduceDestination getDestination()
@Deprecated public void setDestination(ProduceDestination destination)
public java.lang.String getUrl()
public void setUrl(java.lang.String url)