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
ConstructorsConstructorDescriptionXhtmlCleaningInterceptor(StorageFormatCleaner storageFormatCleaner) XhtmlCleaningInterceptor(StorageFormatCleaner storageFormatCleaner, Supplier<Boolean> siteReindexingChecker) this allows us to check wether site is reindexing or not -
Method Summary
Modifier and TypeMethodDescriptionbooleanonFlushDirty(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.booleanonLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) booleanonSave(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:
onFlushDirtyin interfaceorg.hibernate.Interceptor- Overrides:
onFlushDirtyin 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:
onSavein interfaceorg.hibernate.Interceptor- Overrides:
onSavein 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:
onLoadin interfaceorg.hibernate.Interceptor- Overrides:
onLoadin classorg.hibernate.EmptyInterceptor- Throws:
org.hibernate.CallbackException
-