public abstract class HttpProducer<A,B> extends RequestReplyProducerImp
Modifier and Type | Field and Description |
---|---|
protected static long |
DEFAULT_TIMEOUT |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
HttpProducer() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
protected long |
defaultTimeout()
The default timeout for request messages when not supplied.
|
java.lang.Boolean |
getAllowRedirect()
Get the handle redirection flag.
|
ContentTypeProvider |
getContentTypeProvider() |
java.lang.Boolean |
getIgnoreServerResponseCode()
Get the currently configured flag for ignoring server response code.
|
protected RequestMethodProvider.RequestMethod |
getMethod(AdaptrisMessage msg) |
RequestMethodProvider |
getMethodProvider() |
RequestHeaderProvider<A> |
getRequestHeaderProvider() |
ResponseHeaderHandler<B> |
getResponseHeaderHandler() |
void |
init()
Initialises the component.
|
protected void |
logHeaders(java.lang.String header,
java.lang.String message,
java.util.Set headers) |
void |
produce(AdaptrisMessage msg,
ProduceDestination dest)
Produce the
AdaptrisMessage to the supplied ProduceDestination , over-riding any configured destinations. |
void |
setAllowRedirect(java.lang.Boolean b)
Specify whether to automatically handle redirection.
|
void |
setContentTypeProvider(ContentTypeProvider ctp)
Specify the Content-Type header associated with the HTTP operation.
|
void |
setIgnoreServerResponseCode(java.lang.Boolean b)
Set whether to ignore the server response code.
|
void |
setMethodProvider(RequestMethodProvider p)
Specify how the HTTP Request Method is generated.
|
void |
setRequestHeaderProvider(RequestHeaderProvider<A> handler)
Specify how we want to generate the initial set of HTTP Headers.
|
void |
setResponseHeaderHandler(ResponseHeaderHandler<B> handler)
Specify how we handle headers from the HTTP response.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
doRequest, getIgnoreReplyMetadata, produce, request, request, request, request, setIgnoreReplyMetadata, shouldIgnoreReplyMetadata
getDestination, setDestination
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
prepare
createName, createQualifier, isTrackingEndpoint
protected static final long DEFAULT_TIMEOUT
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
sprotected long defaultTimeout()
RequestReplyProducerImp
defaultTimeout
in class RequestReplyProducerImp
RequestReplyProducerImp.defaultTimeout()
public void produce(AdaptrisMessage msg, ProduceDestination dest) throws ProduceException
AdaptrisMessageSender
AdaptrisMessage
to the supplied ProduceDestination
, over-riding any configured destinations.msg
- the AdaptrisMessage
to producedest
- the ProduceDestination
to produce toProduceException
- wrapping any underlying ExceptionsAdaptrisMessageSender.produce(AdaptrisMessage, ProduceDestination)
public void setAllowRedirect(java.lang.Boolean b)
b
- true or false, default is null (true)public java.lang.Boolean getAllowRedirect()
public java.lang.Boolean getIgnoreServerResponseCode()
setIgnoreServerResponseCode(Boolean)
public void setIgnoreServerResponseCode(java.lang.Boolean b)
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.
b
- trueCoreConstants.HTTP_PRODUCER_RESPONSE_CODE
public ContentTypeProvider getContentTypeProvider()
public void setContentTypeProvider(ContentTypeProvider ctp)
ctp
- public ResponseHeaderHandler<B> getResponseHeaderHandler()
public void setResponseHeaderHandler(ResponseHeaderHandler<B> handler)
handler
- the handler, default is a DiscardResponseHeaders
.public RequestHeaderProvider<A> getRequestHeaderProvider()
public void setRequestHeaderProvider(RequestHeaderProvider<A> handler)
handler
- the handler, default is a NoRequestHeaders
public RequestMethodProvider getMethodProvider()
public void setMethodProvider(RequestMethodProvider p)
p
- the request method provider.protected RequestMethodProvider.RequestMethod getMethod(AdaptrisMessage msg)
protected void logHeaders(java.lang.String header, java.lang.String message, java.util.Set headers)