Class JSONDataFilter
- java.lang.Object
-
- 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 methodsfilterString(ServerSession, ServerChannel, String)
,filterNumber(ServerSession, ServerChannel, Number)
,filterBoolean(ServerSession, ServerChannel, Boolean)
,filterArray(ServerSession, ServerChannel, Object)
,filterCollection(ServerSession, ServerChannel, Collection)
,filterList(ServerSession, ServerChannel, List)
,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.AbortException
-
-
Constructor Summary
Constructors Constructor Description JSONDataFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
filter(ServerSession session, ServerChannel channel, Object data)
Modifies the given message data.protected Object
filterArray(ServerSession session, ServerChannel channel, Object array)
protected Object
filterBoolean(ServerSession session, ServerChannel channel, Boolean bool)
protected Object
filterCollection(ServerSession session, ServerChannel channel, Collection<Object> collection)
protected Object
filterList(ServerSession session, ServerChannel channel, List<Object> list)
protected Object
filterMap(ServerSession session, ServerChannel channel, Map<String,Object> map)
protected Object
filterNumber(ServerSession session, ServerChannel channel, Number number)
protected Object
filterObject(ServerSession session, ServerChannel channel, Object data)
protected Object
filterString(ServerSession session, ServerChannel channel, String string)
void
init(Object init)
-
-
-
Method Detail
-
init
public void init(Object init)
-
filter
public Object filter(ServerSession session, ServerChannel channel, Object data)
Description copied from interface:DataFilter
Modifies the given message data.
Returning
null
or throwingDataFilter.AbortException
results in the message processing being interrupted and the message itself discarded.If the returned object is different (as returned by the
!=
operator) from thedata
parameter then it is set as the new message data viaMessage.Mutable.setData(Object)
.- Specified by:
filter
in interfaceDataFilter
- Parameters:
session
- theServerSession
that sends the datachannel
- the channel the data is being sent ondata
- the data being sent- Returns:
- the transformed data or null if the message should be ignored
-
filterString
protected Object filterString(ServerSession session, ServerChannel channel, String string)
-
filterBoolean
protected Object filterBoolean(ServerSession session, ServerChannel channel, Boolean bool)
-
filterNumber
protected Object filterNumber(ServerSession session, ServerChannel channel, Number number)
-
filterArray
protected Object filterArray(ServerSession session, ServerChannel channel, Object array)
-
filterList
protected Object filterList(ServerSession session, ServerChannel channel, List<Object> list)
-
filterCollection
protected Object filterCollection(ServerSession session, ServerChannel channel, Collection<Object> collection)
-
filterMap
protected Object filterMap(ServerSession session, ServerChannel channel, Map<String,Object> map)
-
filterObject
protected Object filterObject(ServerSession session, ServerChannel channel, Object data)
-
-