Class AddRequestProperties
java.lang.Object
org.restheart.mongodb.interceptors.AddRequestProperties
- All Implemented Interfaces:
ConfigurablePlugin,ExchangeTypeResolver<MongoRequest,,MongoResponse> Interceptor<MongoRequest,,MongoResponse> MongoInterceptor,Plugin
- 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(MongoRequest request, MongoResponse response) booleanresolve(MongoRequest request, MongoResponse response) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.restheart.plugins.ConfigurablePlugin
arg, argOrDefaultMethods inherited from interface org.restheart.plugins.ExchangeTypeResolver
requestType, responseType
-
Constructor Details
-
AddRequestProperties
public AddRequestProperties()
-
-
Method Details
-
handle
- Specified by:
handlein interfaceInterceptor<MongoRequest,MongoResponse> - Throws:
Exception
-
resolve
- Specified by:
resolvein interfaceInterceptor<MongoRequest,MongoResponse>
-