Class AddRequestProperties

  • All Implemented Interfaces:
    ConfigurablePlugin, ExchangeTypeResolver<MongoRequest,​MongoResponse>, Interceptor<MongoRequest,​MongoResponse>, MongoInterceptor, Plugin

    public class AddRequestProperties
    extends Object
    implements MongoInterceptor
    Author:
    Andrea Di Cesare <andrea@softinstigate.com> addRequestProperties adds properties to write requests on documents of collections that have the following metadata: { "addRequestProperties": { "log": [ "userName", "remoteIp" ] } } ] } This is an example on how to refactor an old (before v5) Transformer as an Interceptor. The Transformer was applied using collection metatada; here the resolve() method checks if the collection properties obtained via the method request.getCollectionProps() contains the expected metadata object. the addRequestProperties metadata object can be either an array of strings, each specifiying the properties to add, or an object with a single property, as in the above example where the properties are added to the request in the nested "log" subdocument. the properties that can be added are: userName, userRoles, epochTimeStamp, dateTime, localIp, localPort, localServerName, queryString, relativePath, remoteIp, requestMethod, requestProtocol