Class 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:
    Serialized Form
    • Constructor Detail

      • XhtmlCleaningInterceptor

        public XhtmlCleaningInterceptor​(StorageFormatCleaner storageFormatCleaner)
    • Method Detail

      • 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