Studio Developer Manual / Version 2301
Table Of ContentsA write interceptor is enabled by simply defining a bean in the Spring application context of the Studio web application. The interception framework automatically collects all interceptor beans and applies them in order whenever an update is requested. Interceptors with numerically lower priorities are executed first.
For a write interceptor implemented using the class ContentWriteInterceptorBase
,
the priority is configured through the priority
property. Such interceptors also
provide the property type
, indicating that an interceptor should only run for
instances of specific content types. While the setter setType()
receives a
ContentType
parameter, it is possible to simply provide the content type name as
a string in the Spring bean definition file. The type name will be automatically converted to
a ContentType
object.
Furthermore, you need to configure whether the interceptor also applies to instances of
subtypes of the given type through the property isInterceptingSubtypes
. Like for
validators, this property defaults to false
, meaning that interception applies
only to documents of the exact type.
Each write interceptor may also introduce additional configuration options of its own.
A typical definition might look like this:
@Bean MyInterceptor myInterceptor() { MyInterceptor myInterceptor = new MyInterceptor(); myInterceptor.setType("CMPicture"); myInterceptor.setImageProperty("data"); return myInterceptor; }
Example 9.97. Configuring a Write Interceptor