com.atlassian.confluence.content.render.xhtml.storage
Class XhtmlCleaningInterceptor

java.lang.Object
  extended by com.atlassian.confluence.content.render.xhtml.storage.XhtmlCleaningInterceptor
All Implemented Interfaces:
net.sf.hibernate.Interceptor

public class XhtmlCleaningInterceptor
extends Object
implements net.sf.hibernate.Interceptor

A Hibernate interceptor that will silently cleanup security issues with XHTML content on saving to the database.


Constructor Summary
XhtmlCleaningInterceptor(XhtmlCleaner storageFormatCleaner)
           
 
Method Summary
 int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, net.sf.hibernate.type.Type[] types)
           
 Object instantiate(Class clazz, Serializable id)
           
 Boolean isUnsaved(Object entity)
           
 void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, net.sf.hibernate.type.Type[] types)
           
 boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, net.sf.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, net.sf.hibernate.type.Type[] types)
           
 boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, net.sf.hibernate.type.Type[] types)
          If a BodyContent entity is being saved, then ensure the body of the entity is safe XHTML.
 void postFlush(Iterator entities)
           
 void preFlush(Iterator entities)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XhtmlCleaningInterceptor

public XhtmlCleaningInterceptor(XhtmlCleaner storageFormatCleaner)
Method Detail

findDirty

public int[] findDirty(Object entity,
                       Serializable id,
                       Object[] currentState,
                       Object[] previousState,
                       String[] propertyNames,
                       net.sf.hibernate.type.Type[] types)
Specified by:
findDirty in interface net.sf.hibernate.Interceptor

instantiate

public Object instantiate(Class clazz,
                          Serializable id)
                   throws net.sf.hibernate.CallbackException
Specified by:
instantiate in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException

isUnsaved

public Boolean isUnsaved(Object entity)
Specified by:
isUnsaved in interface net.sf.hibernate.Interceptor

onDelete

public void onDelete(Object entity,
                     Serializable id,
                     Object[] state,
                     String[] propertyNames,
                     net.sf.hibernate.type.Type[] types)
              throws net.sf.hibernate.CallbackException
Specified by:
onDelete in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException

onFlushDirty

public boolean onFlushDirty(Object entity,
                            Serializable id,
                            Object[] currentState,
                            Object[] previousState,
                            String[] propertyNames,
                            net.sf.hibernate.type.Type[] types)
                     throws net.sf.hibernate.CallbackException
When a BodyContent is being modified ensure that the body of the entity is safe XHTML.

Specified by:
onFlushDirty in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException

onLoad

public boolean onLoad(Object entity,
                      Serializable id,
                      Object[] state,
                      String[] propertyNames,
                      net.sf.hibernate.type.Type[] types)
               throws net.sf.hibernate.CallbackException
Specified by:
onLoad in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException

onSave

public boolean onSave(Object entity,
                      Serializable id,
                      Object[] state,
                      String[] propertyNames,
                      net.sf.hibernate.type.Type[] types)
               throws net.sf.hibernate.CallbackException
If a BodyContent entity is being saved, then ensure the body of the entity is safe XHTML.

Specified by:
onSave in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException

postFlush

public void postFlush(Iterator entities)
               throws net.sf.hibernate.CallbackException
Specified by:
postFlush in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException

preFlush

public void preFlush(Iterator entities)
              throws net.sf.hibernate.CallbackException
Specified by:
preFlush in interface net.sf.hibernate.Interceptor
Throws:
net.sf.hibernate.CallbackException


Copyright © 2003-2012 Atlassian. All Rights Reserved.