Page Properties |
---|
Status | Status |
---|
| |
---|
colour | Yellow |
---|
title | PROGRESS |
---|
|
|
---|
Priority | 2 |
---|
Note |
|
---|
Assignee | Antje |
---|
RessourcesConcept article linking to the respecive tutorials |
...
Section |
---|
|
Column |
---|
Table of Contents Table of Contents |
---|
exclude | (Table of Contents|Read on|Another TutorialSystem Hooks|Another Concept Article|Another interesting Tutorial) |
---|
|
|
|
...
The interceptor configuration is part of the . It is a JSON list of all interceptors, each of them specified by its type
, predicate
, url
and useDirectory
parameters. If there are two or more interceptors of the same type, all of them will be executed in random order.
The following two code examples show the configuration of a getContent interceptor. In the first case, the predicate contains the condition in JavaScript. In contrast, the second code example makes use of SpEL.
Code Block |
---|
language | javajs |
---|
title | For Loop in Java (brief, concise title) |
---|
linenumbers | true |
---|
|
for (int i = 0; i < 10; i++)
{
System.out.println("Hello World " + i);
} |
Summary
...
Read on
...
Column |
---|
|
Another Tutorial Brief summary of the article linked.
|
Column |
---|
|
Another Concept Article Brief summary of the article linked. |
...
Another interesting Tutorial
...
| getContent interceptor with Javascript condition |
---|
linenumbers | true |
---|
|
{
"interceptors" : [
{ "type" : "getContent",
"predicate" : "js:function process(dmsApiObject){return dmsApiObject[\"contentStreams\"][0][\"range\"]!=null && dmsApiObject[\"contentStreams\"][0][\"range\"].startsWith(\"page:\")}",
"url" : "http://localhost:10666/api/dms/objects/{enaio:objectId}",
"useDiscovery" : false
}
]
} |
Code Block |
---|
language | yml |
---|
title | getContent interceptor with SpEL condition |
---|
linenumbers | true |
---|
|
{
"interceptors" : [
{ "type" : "getContent",
"predicate" : "spel:contentStreams[0]['range'] != null ? contentStreams[0]['range'] matches '(?i)^page:.*' : false",
"url" : "http://localhost:10666/api/dms/objects/{enaio:objectId}",
"useDiscovery" : false
}
]
} |
A search interceptor can have a SpEL or a JavaScript statement in the predicate as well. In the example code below, only the SpEL variant is shown. In addition to the actual search interceptor configuration, the class SearchInterceptionObject has to be defined.
Code Block |
---|
language | yml |
---|
title | search interceptor with SpEL condition |
---|
linenumbers | true |
---|
|
{
"interceptors" : [
{ "type" : "search",
"predicate" : "spel:!grantedAuthorities.contains('ACCESS_FOREIGN_JOURNAL_OBJECTS')",
"url" : "http://localhost:10777/api/search/dsl",
"useDiscovery" : false
}
]
} |
Code Block |
---|
language | yml |
---|
title | Definition of the SearchInterceptionObject class |
---|
linenumbers | true |
---|
|
public class SearchInterceptionObject
{
private EnaioUserDetails enaioUserDetails;
private List<String> grantedAuthorities; // liste der dem aktuellen Nutzer zugeordneten Authority-Namen
}
public class EnaioUserDetails extends User
{
private String jwtAutorization;
private String id;
private String domain;
private String tenant;
private volatile long expiresAt;
...
} |
Summary
This article gave an overview of the interceptor handling in yuuvis® Momentum. If you want to extend the functionality of your system, also system hooks might be an interesting topic for you.