Interface IFilter
-
- All Known Implementing Classes:
SFSExtensionFilter
public interface IFilter
Overview
If you are familiar with the Java Servlet API this will probably look familiar. Extension Filters in SFS2X are inspired to servlet filters and they serve a similar purpose: they execute in chain and they can be used to log, filter, or handle specific requests/events before they get to the Extension itself.The advantage of pluggable Filters is that they don't get in the way of your Extension code, their execution order can be altered and they can even stop the execution flow if necessary. An example of this could be a custom ban filter where User credentials are checked against a black list before the request is passed to your Login Handler. Another example of usage would be logging or filtering public and private messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
destroy()
This is invoked when the Extension is destroyedFilterAction
handleClientRequest(java.lang.String requestId, User sender, ISFSObject params)
Handles a client requestFilterAction
handleServerEvent(ISFSEvent event)
Handles a server side eventvoid
init(SFSExtension ext)
Initialize the Filter
-
-
-
Method Detail
-
init
void init(SFSExtension ext)
Initialize the Filter- Parameters:
ext
- a reference to the related Extension
-
destroy
void destroy()
This is invoked when the Extension is destroyed
-
handleClientRequest
FilterAction handleClientRequest(java.lang.String requestId, User sender, ISFSObject params) throws SFSException
Handles a client request- Parameters:
requestId
- the request idsender
- the sender of the requestparams
- the parameters of the request- Returns:
- the action returned determines if the FilterChain can continue its flow or it must stop
- Throws:
SFSException
- See Also:
FilterAction
-
handleServerEvent
FilterAction handleServerEvent(ISFSEvent event) throws SFSException
Handles a server side event- Parameters:
event
- the event- Returns:
- the action returned determines if the FilterChain can continue its flow or it must stop
- Throws:
SFSException
-
-