Class XhtmlCleaningInterceptor
java.lang.Object
org.hibernate.EmptyInterceptor
com.atlassian.confluence.content.render.xhtml.storage.XhtmlCleaningInterceptor
- All Implemented Interfaces:
Serializable
,org.hibernate.Interceptor
@ReturnValuesAreNullableByDefault
public class XhtmlCleaningInterceptor
extends org.hibernate.EmptyInterceptor
A Hibernate interceptor that will silently cleanup security issues with XHTML content on saving to the database.
- See Also:
-
Field Summary
Fields inherited from class org.hibernate.EmptyInterceptor
INSTANCE
-
Constructor Summary
ConstructorDescriptionXhtmlCleaningInterceptor
(StorageFormatCleaner storageFormatCleaner) XhtmlCleaningInterceptor
(StorageFormatCleaner storageFormatCleaner, Supplier<Boolean> siteReindexingChecker) this allows us to check wether site is reindexing or not -
Method Summary
Modifier and TypeMethodDescriptionboolean
onFlushDirty
(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types) When a BodyContent is being modified ensure that the body of the entity is safe XHTML.boolean
onLoad
(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) boolean
onSave
(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) If a BodyContent entity is being saved, then ensure the body of the entity is safe XHTML.Methods inherited from class org.hibernate.EmptyInterceptor
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, findDirty, getEntity, getEntityName, instantiate, isTransient, onCollectionRecreate, onCollectionRemove, onCollectionUpdate, onDelete, onPrepareStatement, postFlush, preFlush
-
Constructor Details
-
XhtmlCleaningInterceptor
-
XhtmlCleaningInterceptor
public XhtmlCleaningInterceptor(StorageFormatCleaner storageFormatCleaner, Supplier<Boolean> siteReindexingChecker) this allows us to check wether site is reindexing or not- Parameters:
storageFormatCleaner
-siteReindexingChecker
-- Since:
- 8.1
-
-
Method Details
-
onFlushDirty
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException When a BodyContent is being modified ensure that the body of the entity is safe XHTML.- Specified by:
onFlushDirty
in interfaceorg.hibernate.Interceptor
- Overrides:
onFlushDirty
in classorg.hibernate.EmptyInterceptor
- Throws:
org.hibernate.CallbackException
-
onSave
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException If a BodyContent entity is being saved, then ensure the body of the entity is safe XHTML.- Specified by:
onSave
in interfaceorg.hibernate.Interceptor
- Overrides:
onSave
in classorg.hibernate.EmptyInterceptor
- Throws:
org.hibernate.CallbackException
-
onLoad
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException - Specified by:
onLoad
in interfaceorg.hibernate.Interceptor
- Overrides:
onLoad
in classorg.hibernate.EmptyInterceptor
- Throws:
org.hibernate.CallbackException
-