org.mortbay.cometd.filter
Class JSONDataFilter

java.lang.Object
  extended by org.mortbay.cometd.filter.JSONDataFilter
All Implemented Interfaces:
DataFilter
Direct Known Subclasses:
NoMarkupFilter, NoScriptsFilter, RegexFilter

public class JSONDataFilter
extends Object
implements DataFilter

JSON DataFilter This DataFilter walks an Object as if it was a call to JSON.toString(Object) and calls the protected methods filterString(String), filterNumber(Number), filterBoolean(Boolean), filterArray(Object, Client) or filterMap(Map, Client) appropriate. Derived filters may override one or more of these methods to provide filtering of specific types.

Author:
gregw

Constructor Summary
JSONDataFilter()
           
 
Method Summary
 Object filter(Object data, Client from)
           
protected  Object filterArray(Object array, Client from)
           
protected  Object filterBoolean(Boolean bool)
           
protected  Object filterMap(Map object, Client from)
           
protected  Object filterNumber(Number number)
           
protected  Object filterString(String string)
           
 void init(Object init)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONDataFilter

public JSONDataFilter()
Method Detail

init

public void init(Object init)
Specified by:
init in interface DataFilter

filter

public Object filter(Object data,
                     Client from)
              throws IllegalStateException
Specified by:
filter in interface DataFilter
Returns:
The filtered data.
Throws:
IllegalStateException - If the message should be aborted

filterString

protected Object filterString(String string)

filterBoolean

protected Object filterBoolean(Boolean bool)

filterNumber

protected Object filterNumber(Number number)

filterArray

protected Object filterArray(Object array,
                             Client from)

filterMap

protected Object filterMap(Map object,
                           Client from)


Copyright © 2007 Mort Bay Consulting. All Rights Reserved.