Package org.cometd.server.filter
Interface DataFilter
- All Known Implementing Classes:
JSONDataFilter
,NoMarkupFilter
,NoScriptsFilter
,RegexFilter
public interface DataFilter
A filter that can add, modify or remove fields from the
message data
.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DataFilter.Abort
Deprecated.useDataFilter.AbortException
insteadstatic class
DataFilter.AbortException
Aborts the filtering of the message data. -
Method Summary
Modifier and Type Method Description Object
filter(ServerSession session, ServerChannel channel, Object data)
Modifies the given message data.
-
Method Details
-
filter
Object filter(ServerSession session, ServerChannel channel, Object data) throws DataFilter.AbortExceptionModifies 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)
.- 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
- Throws:
DataFilter.AbortException
- to abort the filtering of the data
-