public final class CompositeClientHttpRequestFactoryProcessor extends AbstractProcessor<Values,ClientHttpFactoryProcessorParam> implements HttpProcessor<Values>
A processor that wraps several AbstractClientHttpRequestFactoryProcessors.
This makes it more convenient to configure multiple processors that modify
MfClientHttpRequestFactory objects.
Consider the case where you need to:
In this case the !mapUri processor must execute before the !restrictUris processor but it is difficult to enforce this, the inputMapping and outputMapping must be carefully designed in order to do it. The following should work but compare it with the example below:
- !mapUri
mapping:
(http)://localhost(.*) : "$1://127.0.0.1$2"
outputMapper: {clientHttpRequestFactory: clientHttpRequestFactoryMapped}
- !forwardHeaders
all: true
inputMapper: {clientHttpRequestFactoryMapped :clientHttpRequestFactory}
outputMapper: {clientHttpRequestFactory: clientHttpRequestFactoryWithHeaders}
- !restrictUris
matchers: [!localMatch {}]
inputMapper: {clientHttpRequestFactoryWithHeaders:clientHttpRequestFactory}
The recommended way to write the above configuration is as follows:
- !configureHttpRequests
httpProcessors:
- !mapUri
mapping:
(http)://localhost(.*) : "$1://127.0.0.1$2"
- !forwardHeaders
all: true
- !restrictUris
matchers: [!localMatch {}]
[[examples=http_processors]]AbstractProcessor.ContextProcessor.ExecutionContext| Modifier | Constructor and Description |
|---|---|
protected |
CompositeClientHttpRequestFactoryProcessor()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
MfClientHttpRequestFactory |
createFactoryWrapper(Values values,
MfClientHttpRequestFactory requestFactory)
Create the
MfClientHttpRequestFactory to use. |
Values |
createInputParameter()
Returns a new/clean instance of a parameter object.
|
ClientHttpFactoryProcessorParam |
execute(Values values,
Processor.ExecutionContext context)
Perform the process on the input attributes.
|
protected void |
extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
Perform any extra validation a subclass may need to perform.
|
void |
setHttpProcessors(java.util.List<HttpProcessor> httpProcessors)
Sets all the http processors that will executed by this processor.
|
checkCancelState, getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputTypevalidateprotected CompositeClientHttpRequestFactoryProcessor()
public void setHttpProcessors(java.util.List<HttpProcessor> httpProcessors)
httpProcessors - the sub processorspublic MfClientHttpRequestFactory createFactoryWrapper(Values values, MfClientHttpRequestFactory requestFactory)
HttpProcessorMfClientHttpRequestFactory to use.createFactoryWrapper in interface HttpProcessor<Values>values - extra parameters required to create the updated request factoryrequestFactory - the basic request factory. It should be unmodified and just wrapped with a proxy class.protected void extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
AbstractProcessorextraValidation in class AbstractProcessor<Values,ClientHttpFactoryProcessorParam>validationErrors - a list to add errors to so that all validation errors are reported as one.configuration - the containing configuration@Nullable public Values createInputParameter()
ProcessorValues object.
The way the properties will be looked up is to
Values object using the mapped property name
HasDefaultValue annotation is on the field for the property.
createInputParameter in interface Processor<Values,ClientHttpFactoryProcessorParam>@Nullable public ClientHttpFactoryProcessorParam execute(Values values, Processor.ExecutionContext context) throws java.lang.Exception
Processorexecute in interface Processor<Values,ClientHttpFactoryProcessorParam>values - A Java object whose public fields are populated from the Values object
(which is used for transferring properties between processors).context - The execution context for a print task.Values object. The
key in the Values object is the name of the field or if there is a mapping in the
Processor.getOutputMapperBiMap() map, the mapped name. The key is determined in a similar way as for the input object.java.lang.Exception