Class HttpProducer<A,B>
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageProducerImp
-
- com.adaptris.core.RequestReplyProducerBase
-
- com.adaptris.core.RequestReplyProducerImp
-
- com.adaptris.core.http.client.net.HttpProducer<A,B>
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisMessageProducer,AdaptrisMessageSender,AdaptrisMessageWorker,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator
- Direct Known Subclasses:
StandardHttpProducer
public abstract class HttpProducer<A,B> extends RequestReplyProducerImp
-
-
Field Summary
Fields Modifier and Type Field Description protected static longDEFAULT_TIMEOUT-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description HttpProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longdefaultTimeout()The default timeout for request messages when not supplied.java.lang.Stringendpoint(AdaptrisMessage msg)Return the endpoint that will be derived from the message.java.lang.BooleangetAllowRedirect()Automatically handle redirection.@NotNull @NonNull ContentTypeProvidergetContentTypeProvider()Content-Type header associated with the HTTP operationjava.lang.BooleangetIgnoreServerResponseCode()Set whether to ignore the server response code.protected RequestMethodProvider.RequestMethodgetMethod(AdaptrisMessage msg)@NotNull @NonNull RequestMethodProvidergetMethodProvider()The request method.@NotNull @NonNull RequestHeaderProvider<A>getRequestHeaderProvider()Specify how we want to generate the initial set of HTTP Headers.@NotNull @NonNull ResponseHeaderHandler<B>getResponseHeaderHandler()Specify how we handle headers from the HTTP response.java.lang.StringgetUrl()The URL endpoint to access.protected booleanhandleRedirection()protected booleanignoreServerResponseCode()protected voidlogHeaders(java.lang.String header, java.lang.String message, java.util.Set headers)voidprepare()Prepare for initialisation.voidsetAllowRedirect(java.lang.Boolean allowRedirect)Automatically handle redirection.voidsetContentTypeProvider(@NotNull @NonNull ContentTypeProvider contentTypeProvider)Content-Type header associated with the HTTP operationvoidsetIgnoreServerResponseCode(java.lang.Boolean ignoreServerResponseCode)Set whether to ignore the server response code.voidsetMethodProvider(@NotNull @NonNull RequestMethodProvider methodProvider)The request method.voidsetRequestHeaderProvider(@NotNull @NonNull RequestHeaderProvider<A> requestHeaderProvider)Specify how we want to generate the initial set of HTTP Headers.voidsetResponseHeaderHandler(@NotNull @NonNull ResponseHeaderHandler<B> responseHeaderHandler)Specify how we handle headers from the HTTP response.voidsetUrl(java.lang.String url)The URL endpoint to access.<T extends HttpProducer>
TwithURL(java.lang.String s)-
Methods inherited from class com.adaptris.core.RequestReplyProducerImp
doProduce, doRequest, produce, request, request
-
Methods inherited from class com.adaptris.core.RequestReplyProducerBase
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
-
Methods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createName
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stop
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
-
-
-
Field Detail
-
DEFAULT_TIMEOUT
protected static final long DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
defaultTimeout
protected long defaultTimeout()
Description copied from class:RequestReplyProducerBaseThe default timeout for request messages when not supplied.- Specified by:
defaultTimeoutin classRequestReplyProducerBase- Returns:
- the default timeout.
- See Also:
RequestReplyProducerBase.defaultTimeout()
-
handleRedirection
protected boolean handleRedirection()
-
ignoreServerResponseCode
protected boolean ignoreServerResponseCode()
-
getMethod
protected RequestMethodProvider.RequestMethod getMethod(AdaptrisMessage msg)
-
logHeaders
protected void logHeaders(java.lang.String header, java.lang.String message, java.util.Set headers)
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
endpoint
public java.lang.String endpoint(AdaptrisMessage msg) throws ProduceException
Description copied from class:AdaptrisMessageProducerImpReturn the endpoint that will be derived from the message.The purpose of this method is to mitigate the number of changes that need to happen because
ProduceDestinationis being deprecated; boilerplate code can still be present in the parent super-classes w/o impacting concrete sub-classes "too much".- Specified by:
endpointin classAdaptrisMessageProducerImp- Throws:
ProduceException- See Also:
AdaptrisMessageSender.produce(AdaptrisMessage)
-
withURL
public <T extends HttpProducer> T withURL(java.lang.String s)
-
getMethodProvider
@NotNull @NonNull public @NotNull @NonNull RequestMethodProvider getMethodProvider()
The request method.The default is 'POST'
-
setMethodProvider
public void setMethodProvider(@NotNull @NonNull @NotNull @NonNull RequestMethodProvider methodProvider)The request method.The default is 'POST'
-
getContentTypeProvider
@NotNull @NonNull public @NotNull @NonNull ContentTypeProvider getContentTypeProvider()
Content-Type header associated with the HTTP operation
-
setContentTypeProvider
public void setContentTypeProvider(@NotNull @NonNull @NotNull @NonNull ContentTypeProvider contentTypeProvider)Content-Type header associated with the HTTP operation
-
getResponseHeaderHandler
@NotNull @NonNull public @NotNull @NonNull ResponseHeaderHandler<B> getResponseHeaderHandler()
Specify how we handle headers from the HTTP response.The default behaviour will be to discard.
-
setResponseHeaderHandler
public void setResponseHeaderHandler(@NotNull @NonNull @NotNull @NonNull ResponseHeaderHandler<B> responseHeaderHandler)Specify how we handle headers from the HTTP response.The default behaviour will be to discard.
-
getRequestHeaderProvider
@NotNull @NonNull public @NotNull @NonNull RequestHeaderProvider<A> getRequestHeaderProvider()
Specify how we want to generate the initial set of HTTP Headers.The default behaviour is to not have any additional headers
-
setRequestHeaderProvider
public void setRequestHeaderProvider(@NotNull @NonNull @NotNull @NonNull RequestHeaderProvider<A> requestHeaderProvider)Specify how we want to generate the initial set of HTTP Headers.The default behaviour is to not have any additional headers
-
getIgnoreServerResponseCode
public java.lang.Boolean getIgnoreServerResponseCode()
Set whether to ignore the server response code.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_CODEis populated with the last server response.
-
setIgnoreServerResponseCode
public void setIgnoreServerResponseCode(java.lang.Boolean ignoreServerResponseCode)
Set whether to ignore the server response code.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_CODEis populated with the last server response.
-
getAllowRedirect
public java.lang.Boolean getAllowRedirect()
Automatically handle redirection.The default is true if not otherwise specified
-
setAllowRedirect
public void setAllowRedirect(java.lang.Boolean allowRedirect)
Automatically handle redirection.The default is true if not otherwise specified
-
getUrl
public java.lang.String getUrl()
The URL endpoint to access.
-
setUrl
public void setUrl(java.lang.String url)
The URL endpoint to access.
-
-