logoBack to home screen

Adding Around-Processor Logic for WebReader

In this showcase, we're adding a simple around-processor that retrieves a requestMeta parameter from the call to WebReader. The following Groovy script is a key part of our processor:

//fetch metaData map which holds requestMeta.* URL parameters
def metaData = $request.getMetaData();

//fetch my custom context URL parameter
def myParameter = metaData.get("requestMeta.myParameter");
if (myParameter != null) {
    //print out custom URL parameter

//We could do some real world tasks here - e.g. 
// - call other applications
// - adapt the request
// - ...

//execute actual request - e.g. DocumentRetrievalRequest
def response = $proceedContext.proceed($request);

//We could do some real world tasks here - e.g.
// - call other applications
// - adapt response
// - ...

//return response of e.g. DocumentRetrievalRequest
return response;

Note that services get executed on the server side - so you have access to everything that ADx can provide.

Please watch the video showing the initial configuration or follow the procedure directly below it. Copy and paste the above script when prompted.

Adding new Service Processor - video

Adding new Service Processor - instruction

  1. Log in to ADx. Go to the Administrator page:

  2. Click Repositories to open the repositories query view.

  3. Double-click on a repository where you want to customize the WebReader.

  4. Double-click Processing Configuration. Editing form opens.

  5. Add new service interceptors (click Add under Service Interceptors to begin).

  6. Double-click Scripted Interceptor. Editing form for the interceptor opens.

  7. Define your interceptor:

    • Interceptor Type - select when the script should be executed - before, after, or around service request

    • Script - assign the script to be executed. You can use the script below as an example:

      This script will fetch a metadata map of the service request and then it will try to find a parameter called myParameter using the Tribefire-standard requestMeta method. This parameter must be passed in the URL when calling WebReader.

    • Service Type - select DocumentRetrievalRequest from the list.

  8. Apply your changes.

  9. Reactivate the repository. Your script can now be used! To check how to try it out, see Calling WebReader with Custom Parameters.