public final class ForwardHeadersProcessor extends AbstractProcessor<ForwardHeadersProcessor.Param,ClientHttpFactoryProcessorParam> implements HttpProcessor<ForwardHeadersProcessor.Param>
This processor forwards all the headers from the print request (from the Mapfish Print client) to each http request made for the particular print job. All headers can be forwarded (if forwardAll is set to true) or the specific headers to forward can be specified.
Example 1: Forward all headers from print request
- !forwardHeaders
all: true
Example 2: Forward specific headers (header1 and header2 will be forwarded)
- !forwardHeaders
headers: [header1, header2]
Can be applied conditionally using matchers, like in RestrictUrisProcessor
(!restrictUris).
| Modifier and Type | Class and Description |
|---|---|
static class |
ForwardHeadersProcessor.Param
The parameters required by this processor.
|
AbstractProcessor.ContextProcessor.ExecutionContext| Constructor and Description |
|---|
ForwardHeadersProcessor()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
MfClientHttpRequestFactory |
createFactoryWrapper(ForwardHeadersProcessor.Param param,
MfClientHttpRequestFactory requestFactory)
Create the
MfClientHttpRequestFactory to use. |
ForwardHeadersProcessor.Param |
createInputParameter()
Returns a new/clean instance of a parameter object.
|
ClientHttpFactoryProcessorParam |
execute(ForwardHeadersProcessor.Param 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 |
setAll(boolean all)
If set to true then all headers are forwarded.
|
void |
setHeaders(java.util.Set<java.lang.String> names)
Set the header names to forward from the request.
|
void |
setMatchers(java.util.List<? extends URIMatcher> matchers)
The matchers used to select the urls that are going to be modified by the 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, getOutputTypevalidatepublic void setHeaders(java.util.Set<java.lang.String> names)
names - the header names.public void setMatchers(java.util.List<? extends URIMatcher> matchers)
- !restrictUris
matchers:
- !localMatch
dummy: true
- !ipMatch
ip: www.camptocamp.org
- !dnsMatch
host: mapfish-geoportal.demo-camptocamp.com
port: 80
- !dnsMatch
host: labs.metacarta.com
port: 80
- !dnsMatch
host: terraservice.net
port: 80
- !dnsMatch
host: tile.openstreetmap.org
port: 80
- !dnsMatch
host: www.geocat.ch
port: 80
matchers - the list of matcher to use to check if a url is permittedpublic void setAll(boolean all)
all - if true forward all headersprotected void extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
AbstractProcessorextraValidation in class AbstractProcessor<ForwardHeadersProcessor.Param,ClientHttpFactoryProcessorParam>validationErrors - a list to add errors to so that all validation errors are reported as one.configuration - the containing configurationpublic MfClientHttpRequestFactory createFactoryWrapper(ForwardHeadersProcessor.Param param, MfClientHttpRequestFactory requestFactory)
HttpProcessorMfClientHttpRequestFactory to use.createFactoryWrapper in interface HttpProcessor<ForwardHeadersProcessor.Param>param - extra parameters required to create the updated request factoryrequestFactory - the basic request factory. It should be unmodified and just wrapped with a proxy class.@Nullable public ForwardHeadersProcessor.Param 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<ForwardHeadersProcessor.Param,ClientHttpFactoryProcessorParam>@Nullable public ClientHttpFactoryProcessorParam execute(ForwardHeadersProcessor.Param values, Processor.ExecutionContext context) throws java.lang.Exception
Processorexecute in interface Processor<ForwardHeadersProcessor.Param,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