Class BranchingHttpRequestService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.http.client.net.HttpRequestServiceImpl
-
- com.adaptris.core.http.client.net.BranchingHttpRequestService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Make a HTTP request to a remote server using standard JRE components", tag="service,http,https,branching", branchSelector=true, metadata="adphttpresponse") public class BranchingHttpRequestService extends HttpRequestServiceImpl
Branch support for HTTP via interrogation of the HTTP status.This service allows you to branch based on the
HTTP status code
returned by the web server. Use a specificStatusEvaluator
to determine the appropriate value forAdaptrisMessage.setNextServiceId(String)
. It differs from wrappingHttpRequestService
with aBranchingServiceEnabler
as it allows you more fine-grained control based on HTTP status codes.Note that this service just wraps a
StandardHttpProducer
instance but doesn't expose all the possible settings available for the normalStandardHttpProducer
. If you need those features, than continue using the producer wrapped as aStandaloneProducer
orStandaloneRequestor
.String parameters in this service will use the
InterlokMessage.resolve(String)
which allows you to specify metadata values as part of a constant string e.g.setUrl("%message{http_url}")
will use the metadata value associated with the keyhttp_url
.In the adapter configuration file this class is aliased as branching-http-request-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description BranchingHttpRequestService()
BranchingHttpRequestService(java.lang.String url)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doService(AdaptrisMessage msg)
Apply the service to the message.java.lang.String
getDefaultServiceId()
Set the default service-id in the event that no matches are found (optional).@NotNull @NonNull java.util.List<StatusEvaluator>
getStatusMatches()
Set thenextServiceId
based on these evaluators.boolean
isBranching()
Returns true if the implementation supports branching.void
setDefaultServiceId(java.lang.String defaultServiceId)
Set the default service-id in the event that no matches are found (optional).void
setStatusMatches(@NotNull @NonNull java.util.List<StatusEvaluator> statusMatches)
Set thenextServiceId
based on these evaluators.BranchingHttpRequestService
withDefaultServiceId(java.lang.String s)
BranchingHttpRequestService
withStatusMatches(StatusEvaluator... matchers)
BranchingHttpRequestService
withStatusMatches(java.util.List<StatusEvaluator> matchers)
-
Methods inherited from class com.adaptris.core.http.client.net.HttpRequestServiceImpl
buildProducer, closeService, getAuthenticator, getContentType, getMethod, getRequestHeaderProvider, getResponseHeaderHandler, getUrl, initService, prepare, setAuthenticator, setContentType, setMethod, setRequestHeaderProvider, setResponseHeaderHandler, setUrl, withAuthenticator, withContentType, withMethod, withRequestHeaderProvider, withResponseHeaderHandler, withUrl
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
isBranching
public boolean isBranching()
Description copied from interface:Service
Returns true if the implementation supports branching.
- Specified by:
isBranching
in interfaceService
- Overrides:
isBranching
in classServiceImp
- Returns:
- true if the implementation supports branching
- See Also:
BranchingServiceCollection
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
withStatusMatches
public BranchingHttpRequestService withStatusMatches(java.util.List<StatusEvaluator> matchers)
- Since:
- 3.9.0
-
withStatusMatches
public BranchingHttpRequestService withStatusMatches(StatusEvaluator... matchers)
- Since:
- 3.9.0
-
withDefaultServiceId
public BranchingHttpRequestService withDefaultServiceId(java.lang.String s)
- Since:
- 3.9.0
-
getStatusMatches
@NotNull @NonNull public @NotNull @NonNull java.util.List<StatusEvaluator> getStatusMatches()
Set thenextServiceId
based on these evaluators.
-
setStatusMatches
public void setStatusMatches(@NotNull @NonNull @NotNull @NonNull java.util.List<StatusEvaluator> statusMatches)
Set thenextServiceId
based on these evaluators.
-
getDefaultServiceId
public java.lang.String getDefaultServiceId()
Set the default service-id in the event that no matches are found (optional).
-
setDefaultServiceId
public void setDefaultServiceId(java.lang.String defaultServiceId)
Set the default service-id in the event that no matches are found (optional).
-
-