loading table of contents...

7.15.2.2. Configuring Write Interceptors

A 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 id="myInterceptor" class="MyInterceptor">
  <property name="type" value="CMPicture"/>
  <property name="imageProperty" value="data"/>
</bean>

Example 7.65. Configuring a Write Interceptor