Class JSONDataFilter
- java.lang.Object
-
- org.cometd.server.filter.JSONDataFilter
-
- All Implemented Interfaces:
DataFilter
- Direct Known Subclasses:
NoMarkupFilter
,NoScriptsFilter
,RegexFilter
public class JSONDataFilter extends java.lang.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 java.lang.Object
filter(ServerSession session, ServerChannel channel, java.lang.Object data)
Modifies the given message data.protected java.lang.Object
filterArray(ServerSession session, ServerChannel channel, java.lang.Object array)
protected java.lang.Object
filterBoolean(ServerSession session, ServerChannel channel, java.lang.Boolean bool)
protected java.lang.Object
filterCollection(ServerSession session, ServerChannel channel, java.util.Collection<java.lang.Object> collection)
protected java.lang.Object
filterList(ServerSession session, ServerChannel channel, java.util.List<java.lang.Object> list)
protected java.lang.Object
filterMap(ServerSession session, ServerChannel channel, java.util.Map<java.lang.String,java.lang.Object> map)
protected java.lang.Object
filterNumber(ServerSession session, ServerChannel channel, java.lang.Number number)
protected java.lang.Object
filterObject(ServerSession session, ServerChannel channel, java.lang.Object data)
protected java.lang.Object
filterString(ServerSession session, ServerChannel channel, java.lang.String string)
void
init(java.lang.Object init)
-
-
-
Method Detail
-
init
public void init(java.lang.Object init)
-
filter
public java.lang.Object filter(ServerSession session, ServerChannel channel, java.lang.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 java.lang.Object filterString(ServerSession session, ServerChannel channel, java.lang.String string)
-
filterBoolean
protected java.lang.Object filterBoolean(ServerSession session, ServerChannel channel, java.lang.Boolean bool)
-
filterNumber
protected java.lang.Object filterNumber(ServerSession session, ServerChannel channel, java.lang.Number number)
-
filterArray
protected java.lang.Object filterArray(ServerSession session, ServerChannel channel, java.lang.Object array)
-
filterList
protected java.lang.Object filterList(ServerSession session, ServerChannel channel, java.util.List<java.lang.Object> list)
-
filterCollection
protected java.lang.Object filterCollection(ServerSession session, ServerChannel channel, java.util.Collection<java.lang.Object> collection)
-
filterMap
protected java.lang.Object filterMap(ServerSession session, ServerChannel channel, java.util.Map<java.lang.String,java.lang.Object> map)
-
filterObject
protected java.lang.Object filterObject(ServerSession session, ServerChannel channel, java.lang.Object data)
-
-