public class FileAttributesFilter extends Object implements Filter
Map
object, whose location is specified by the
target
expression. If a matching record cannot be found, then the resulting map
will be empty.
The retrieval of the record is performed lazily; it does not occur until the first attempt
to access a value in the target. This defers the overhead of file operations and text
processing until a value is first required. This also means that the value
expression will not be evaluated until the map is first accessed.
SeparatedValuesFile
Modifier and Type | Class and Description |
---|---|
static class |
FileAttributesFilter.Heaplet
Creates and initializes a separated values file attribute provider in a heap environment.
|
Constructor and Description |
---|
FileAttributesFilter(SeparatedValuesFile file,
String key,
Expression<String> value,
LeftValueExpression<Map> target)
Builds a new FileAttributesFilter extracting values from the given separated values file.
|
Modifier and Type | Method and Description |
---|---|
Promise<Response,NeverThrowsException> |
filter(Context context,
Request request,
Handler next)
Filters the request and/or response of an exchange.
|
public FileAttributesFilter(SeparatedValuesFile file, String key, Expression<String> value, LeftValueExpression<Map> target)
file
- The file to read separated values from (csv file)key
- The name of the field in the file to perform the lookup onvalue
- Expression that yields the value to be looked-up within the filetarget
- Expression that yields the target object that will contain the recordpublic Promise<Response,NeverThrowsException> filter(Context context, Request request, Handler next)
Filter
next.handle(context, request)
.
This method may elect not to pass the request to the next filter or
handler, and instead handle the request itself. It can achieve this by
merely avoiding a call to next.handle(context, request)
and creating its own response object. The filter is also at liberty to
replace a response with another of its own by intercepting the response
returned by the next handler.
Copyright 2011-2017 ForgeRock AS.