Class 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 methods
filterString(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.Abort, DataFilter.AbortException
-
Constructor Summary
Constructors Constructor Description JSONDataFilter()
-
Method Summary
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(Boolean bool)
Deprecated.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(Number number)
Deprecated.protected Object
filterNumber(ServerSession session, ServerChannel channel, Number number)
protected Object
filterObject(ServerSession session, ServerChannel channel, Object data)
protected Object
filterString(String string)
Deprecated.protected Object
filterString(ServerSession session, ServerChannel channel, String string)
void
init(Object init)
-
Constructor Details
-
JSONDataFilter
public JSONDataFilter()
-
-
Method Details
-
init
-
filter
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
-
filterString
Deprecated.- Parameters:
string
- the string to filter- Returns:
- a filtered object
-
filterBoolean
-
filterBoolean
Deprecated.- Parameters:
bool
- the boolean to filter- Returns:
- a filtered object
-
filterNumber
-
filterNumber
Deprecated.- Parameters:
number
- the number to filter- Returns:
- a filtered object
-
filterArray
-
filterList
-
filterCollection
protected Object filterCollection(ServerSession session, ServerChannel channel, Collection<Object> collection) -
filterMap
-
filterObject
-