Class MapUriProcessor

All Implemented Interfaces:
ConfigurationObject, HttpProcessor<ClientHttpFactoryProcessorParam>, Processor<ClientHttpFactoryProcessorParam,Void>

public final class MapUriProcessor extends AbstractClientHttpRequestFactoryProcessor
This processor maps uris submitted to the MfClientHttpRequestFactory to a modified uri as specified by the mapping parameter.

Example: change the hostname of all requests that are http requests and have the hostname: myhost.com to localhost instead of myhost.com


 - !mapUri
   mapping: {(http)://myhost.com(.*): "$1://localhost$2"}
 

Can be applied conditionally using matchers, like in RestrictUrisProcessor (!restrictUris ). [[examples=http_processors]]

  • Constructor Details

    • MapUriProcessor

      public MapUriProcessor()
  • Method Details

    • setMapping

      public void setMapping(Map<String,String> mapping)
      Set the uri mappings.

      The key is a regular expression that must match uri's string form. The value will be used for the replacement.

      Parameters:
      mapping - the uri mappings.
    • createFactoryWrapper

      public MfClientHttpRequestFactory createFactoryWrapper(ClientHttpFactoryProcessorParam clientHttpFactoryProcessorParam, MfClientHttpRequestFactory requestFactory)
      Description copied from interface: HttpProcessor
      Create the MfClientHttpRequestFactory to use.
      Parameters:
      clientHttpFactoryProcessorParam - extra parameters required to create the updated request factory
      requestFactory - the basic request factory. It should be unmodified and just wrapped with a proxy class.
    • extraValidation

      protected void extraValidation(List<Throwable> validationErrors, Configuration configuration)
      Description copied from class: AbstractProcessor
      Perform any extra validation a subclass may need to perform.
      Overrides:
      extraValidation in class AbstractClientHttpRequestFactoryProcessor
      Parameters:
      validationErrors - a list to add errors to so that all validation errors are reported as one.
      configuration - the containing configuration