Class BranchingHttpRequestService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.http.apache5.HttpRequestServiceImpl
-
- com.adaptris.core.http.apache5.BranchingHttpRequestService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Make a HTTP(s) request to a remote server using the Apache HTTP Client", tag="service,http,https,branching", branchSelector=true, metadata="adphttpresponse", author="Adaptris Ltd", since="4.1.0") public class BranchingHttpRequestService extends HttpRequestServiceImplBranch support for HTTP via interrogation of the HTTP status.This service allows you to branch based on the
HTTP status codereturned by the web server. Use a specificStatusEvaluatorto determine the appropriate value forAdaptrisMessage.setNextServiceId(String). It differs from wrappingHttpRequestServicewith aBranchingServiceEnableras it allows you more fine-grained control based on HTTP status codes.Note that this service just wraps a
ApacheHttpProducerinstance but doesn't expose all the possible settings available for the normalApacheHttpProducer. If you need those features, than continue using the producer wrapped as aStandaloneProducerorStandaloneRequestor.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 voiddoService(AdaptrisMessage msg)java.lang.StringgetDefaultServiceId()Set the default service-id in the event that no matches are found (optional).@NonNull java.util.List<StatusEvaluator>getStatusMatches()Set thenextServiceIdbased on these evaluators.booleanisBranching()voidprepare()voidsetDefaultServiceId(java.lang.String defaultServiceId)Set the default service-id in the event that no matches are found (optional).voidsetStatusMatches(@NonNull java.util.List<StatusEvaluator> statusMatches)Set thenextServiceIdbased on these evaluators.-
Methods inherited from class com.adaptris.core.http.apache5.HttpRequestServiceImpl
buildProducer, clientConfig, closeService, getAuthenticator, getClientConfig, getContentType, getMethod, getRequestHeaderProvider, getResponseHeaderHandler, getUrl, initService, setAuthenticator, setClientConfig, setContentType, setMethod, setRequestHeaderProvider, setResponseHeaderHandler, setUrl
-
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
-
prepare
public void prepare() throws CoreException- Specified by:
preparein interfaceComponentLifecycleExtension- Overrides:
preparein classHttpRequestServiceImpl- Throws:
CoreException
-
isBranching
public boolean isBranching()
- Specified by:
isBranchingin interfaceService- Overrides:
isBranchingin classServiceImp
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
- Throws:
ServiceException
-
getStatusMatches
@NonNull public @NonNull java.util.List<StatusEvaluator> getStatusMatches()
Set thenextServiceIdbased on these evaluators.
-
setStatusMatches
public void setStatusMatches(@NonNull @NonNull java.util.List<StatusEvaluator> statusMatches)Set thenextServiceIdbased 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).
-
-