Class CompositeClientHttpRequestFactoryProcessor

java.lang.Object
org.mapfish.print.processor.AbstractProcessor<CompositeClientHttpRequestFactoryProcessor.Input,Void>
org.mapfish.print.processor.http.CompositeClientHttpRequestFactoryProcessor
All Implemented Interfaces:
ConfigurationObject, HttpProcessor<CompositeClientHttpRequestFactoryProcessor.Input>, Processor<CompositeClientHttpRequestFactoryProcessor.Input,Void>

public final class CompositeClientHttpRequestFactoryProcessor extends AbstractProcessor<CompositeClientHttpRequestFactoryProcessor.Input,Void> implements HttpProcessor<CompositeClientHttpRequestFactoryProcessor.Input>
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:

  • Restrict allowed URIS using the !restrictUris processor
  • Forward all headers from print request to all requests using !forwardHeaders
  • Change the url using the !mapUri processor

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: {clientHttpRequestFactoryProvider: clientHttpRequestFactoryMapped}
 - !forwardHeaders
   all: true
   inputMapper: {clientHttpRequestFactoryMapped :clientHttpRequestFactoryProvider}
   outputMapper: {clientHttpRequestFactoryProvider: clientHttpRequestFactoryWithHeaders}
 - !restrictUris
   matchers: [!localMatch {}]
   inputMapper: {clientHttpRequestFactoryWithHeaders:clientHttpRequestFactoryProvider}
     

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]]