Package org.mapfish.print.processor.http
Class ForwardHeadersProcessor
- java.lang.Object
-
- org.mapfish.print.processor.AbstractProcessor<ForwardHeadersProcessor.Param,java.lang.Void>
-
- org.mapfish.print.processor.http.ForwardHeadersProcessor
-
- All Implemented Interfaces:
ConfigurationObject
,HttpProcessor<ForwardHeadersProcessor.Param>
,Processor<ForwardHeadersProcessor.Param,java.lang.Void>
public final class ForwardHeadersProcessor extends AbstractProcessor<ForwardHeadersProcessor.Param,java.lang.Void> 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 ). [[examples=http_processors]]
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ForwardHeadersProcessor.Param
The parameters required by this processor.-
Nested classes/interfaces inherited from class org.mapfish.print.processor.AbstractProcessor
AbstractProcessor.Context
-
Nested classes/interfaces inherited from interface org.mapfish.print.processor.Processor
Processor.ExecutionContext
-
-
Field Summary
-
Fields inherited from interface org.mapfish.print.processor.Processor
MDC_APPLICATION_ID_KEY, MDC_JOB_ID_KEY
-
-
Constructor Summary
Constructors Constructor Description ForwardHeadersProcessor()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MfClientHttpRequestFactory
createFactoryWrapper(ForwardHeadersProcessor.Param param, MfClientHttpRequestFactory requestFactory)
Create theMfClientHttpRequestFactory
to use.ForwardHeadersProcessor.Param
createInputParameter()
Returns a new/clean instance of a parameter object.java.lang.Void
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.-
Methods inherited from class org.mapfish.print.processor.AbstractProcessor
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, toString, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.mapfish.print.config.ConfigurationObject
validate
-
Methods inherited from interface org.mapfish.print.processor.Processor
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, toString
-
-
-
-
Method Detail
-
setHeaders
public void setHeaders(java.util.Set<java.lang.String> names)
Set the header names to forward from the request. Should not be defined if all is set to true- Parameters:
names
- the header names.
-
setMatchers
public void setMatchers(java.util.List<? extends URIMatcher> matchers)
The matchers used to select the urls that are going to be modified by the processor. For example:- !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
- Parameters:
matchers
- the list of matcher to use to check if a url is permitted
-
setAll
public void setAll(boolean all)
If set to true then all headers are forwarded. If this is true headers should be empty (or undefined)- Parameters:
all
- if true forward all headers
-
extraValidation
protected void extraValidation(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
Description copied from class:AbstractProcessor
Perform any extra validation a subclass may need to perform.- Specified by:
extraValidation
in classAbstractProcessor<ForwardHeadersProcessor.Param,java.lang.Void>
- Parameters:
validationErrors
- a list to add errors to so that all validation errors are reported as one.configuration
- the containing configuration
-
createFactoryWrapper
public MfClientHttpRequestFactory createFactoryWrapper(ForwardHeadersProcessor.Param param, MfClientHttpRequestFactory requestFactory)
Description copied from interface:HttpProcessor
Create theMfClientHttpRequestFactory
to use.- Specified by:
createFactoryWrapper
in interfaceHttpProcessor<ForwardHeadersProcessor.Param>
- Parameters:
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.
-
createInputParameter
@Nullable public ForwardHeadersProcessor.Param createInputParameter()
Description copied from interface:Processor
Returns a new/clean instance of a parameter object. This instance's will be inspected using reflection to find its public fields and the properties will be set from theValues
object.The way the properties will be looked up is to
- take the bean property name
- map it using the input mapper, (if the input mapper does not have a mapping for the property then the unmapped property name is used)
- Look up the property value in the
Values
object using the mapped property name - set the value on the instance created by this method. If the value is null an exception
will be thrown UNLESS the
HasDefaultValue
annotation is on the field for the property.
It is important to realize that super classes will also be analyzed, so care must be had with inheritance.
- Specified by:
createInputParameter
in interfaceProcessor<ForwardHeadersProcessor.Param,java.lang.Void>
-
execute
@Nullable public java.lang.Void execute(ForwardHeadersProcessor.Param values, Processor.ExecutionContext context)
Description copied from interface:Processor
Perform the process on the input attributes.- Specified by:
execute
in interfaceProcessor<ForwardHeadersProcessor.Param,java.lang.Void>
- Parameters:
values
- A Java object whose public fields are populated from theValues
object (which is used for transferring properties between processors).context
- The execution context for a print task.- Returns:
- A Java object whose public fields will be put into the
Values
object. The key in theValues
object is the name of the field or if there is a mapping in theProcessor.getOutputMapperBiMap()
map, the mapped name. The key is determined in a similar way as for the input object.
-
-