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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfilter(ServerSession session, ServerChannel channel, Object data) Modifies the given message data.protected ObjectfilterArray(ServerSession session, ServerChannel channel, Object array) protected ObjectfilterBoolean(ServerSession session, ServerChannel channel, Boolean bool) protected ObjectfilterCollection(ServerSession session, ServerChannel channel, Collection<Object> collection) protected ObjectfilterList(ServerSession session, ServerChannel channel, List<Object> list) protected ObjectfilterMap(ServerSession session, ServerChannel channel, Map<String, Object> map) protected ObjectfilterNumber(ServerSession session, ServerChannel channel, Number number) protected ObjectfilterObject(ServerSession session, ServerChannel channel, Object data) protected ObjectfilterString(ServerSession session, ServerChannel channel, String string) void
-
Constructor Details
-
JSONDataFilter
public JSONDataFilter()
-
-
Method Details
-
init
-
filter
Description copied from interface:DataFilterModifies the given message data.
Returning
nullor throwingDataFilter.AbortExceptionresults in the message processing being interrupted and the message itself discarded.If the returned object is different (as returned by the
!=operator) from thedataparameter then it is set as the new message data viaMessage.Mutable.setData(Object).- Specified by:
filterin interfaceDataFilter- Parameters:
session- theServerSessionthat 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
-