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

    Constructors
    Constructor
    Description
     
    XhtmlCleaningInterceptor(StorageFormatCleaner storageFormatCleaner, Supplier<Boolean> siteReindexingChecker)
    this allows us to check wether site is reindexing or not
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XhtmlCleaningInterceptor

      public XhtmlCleaningInterceptor(StorageFormatCleaner storageFormatCleaner)
    • 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 interface org.hibernate.Interceptor
      Overrides:
      onFlushDirty in class org.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 interface org.hibernate.Interceptor
      Overrides:
      onSave in class org.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 interface org.hibernate.Interceptor
      Overrides:
      onLoad in class org.hibernate.EmptyInterceptor
      Throws:
      org.hibernate.CallbackException