Class JSONDataFilter
- All Implemented Interfaces:
DataFilter
- Direct Known Subclasses:
NoMarkupFilter
,NoScriptsFilter
,RegexFilter
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.AbortException
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfilter
(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
-
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
-
filterBoolean
-
filterNumber
-
filterArray
-
filterList
-
filterCollection
protected Object filterCollection(ServerSession session, ServerChannel channel, Collection<Object> collection) -
filterMap
-
filterObject
-