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.
DataFilter.AbortException
Constructor and Description |
---|
JSONDataFilter() |
Modifier and Type | Method and 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) |
public void init(Object init)
public Object filter(ServerSession session, ServerChannel channel, Object data)
DataFilter
Modifies the given message data.
Returning null
or throwing DataFilter.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 the data
parameter
then it is set as the new message data via
Message.Mutable#setData(Object)
.
filter
in interface DataFilter
session
- the ServerSession
that sends the datachannel
- the channel the data is being sent ondata
- the data being sentprotected Object filterString(ServerSession session, ServerChannel channel, String string)
protected Object filterBoolean(ServerSession session, ServerChannel channel, Boolean bool)
protected Object filterNumber(ServerSession session, ServerChannel channel, Number number)
protected Object filterArray(ServerSession session, ServerChannel channel, Object array)
protected Object filterList(ServerSession session, ServerChannel channel, List<Object> list)
protected Object filterCollection(ServerSession session, ServerChannel channel, Collection<Object> collection)
protected Object filterMap(ServerSession session, ServerChannel channel, Map<String,Object> map)
protected Object filterObject(ServerSession session, ServerChannel channel, Object data)
Copyright © 2008–2024 The CometD Project. All rights reserved.