org.cometd.server.filter
Class JSONDataFilter

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

public class JSONDataFilter
extends Object
implements DataFilter

JSONDataFilter walks an object to see if it is a JSON data structure and calls the appropriate protected method filterString(String), filterNumber(Number), filterBoolean(Boolean), filterArray(ServerSession, ServerChannel, Object) or filterMap(ServerSession, ServerChannel, Map).

Derived filters may override one or more of these methods to provide filtering of specific types.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.cometd.server.filter.DataFilter
DataFilter.Abort
 
Constructor Summary
JSONDataFilter()
           
 
Method Summary
 Object filter(ServerSession from, ServerChannel to, Object data)
           
protected  Object filterArray(ServerSession from, ServerChannel to, Object array)
           
protected  Object filterBoolean(Boolean bool)
           
protected  Object filterMap(ServerSession from, ServerChannel to, Map map)
           
protected  Object filterNumber(Number number)
           
protected  Object filterObject(ServerSession from, ServerChannel to, Object obj)
           
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)

filter

public Object filter(ServerSession from,
                     ServerChannel to,
                     Object data)
Specified by:
filter in interface DataFilter
Parameters:
from - the Client that sends the data
to - the channel the data is being sent to
data - the data being sent
Returns:
the transformed data or null 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(ServerSession from,
                             ServerChannel to,
                             Object array)

filterMap

protected Object filterMap(ServerSession from,
                           ServerChannel to,
                           Map map)

filterObject

protected Object filterObject(ServerSession from,
                              ServerChannel to,
                              Object obj)


Copyright © 2008-2011 Dojo Foundation. All Rights Reserved.