public class ServerAuthFilter extends BaseFilter
Constructor and Description |
---|
ServerAuthFilter() |
Modifier and Type | Method and Description |
---|---|
NextAction |
handleClose(FilterChainContext ctx)
The method is called, when a connection gets closed.
|
NextAction |
handleRead(FilterChainContext ctx)
The method is called once we have received
MultiLinePacket from
a client. |
NextAction |
handleWrite(FilterChainContext ctx)
The method is called each time, when server sends a message to a client.
|
createContext, exceptionOccurred, handleAccept, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved
public NextAction handleRead(FilterChainContext ctx) throws IOException
MultiLinePacket
from
a client.
Filter check if incoming message is the client authentication request.
If yes - we generate new client id and send it back in the
authentication response. If the message is not authentication request -
we check message authentication header to correspond to a connection id
in the authenticated clients map. If it's ok - the filter removes
authentication header from the message and pass the message to a next
filter in a filter chain, otherwise, if authentication failed - the filter
throws an ExceptionhandleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- Request processing contextNextAction
IOException
public NextAction handleWrite(FilterChainContext ctx) throws IOException
handleWrite
in interface Filter
handleWrite
in class BaseFilter
ctx
- Response processing contextNextAction
IOException
public NextAction handleClose(FilterChainContext ctx) throws IOException
handleClose
in interface Filter
handleClose
in class BaseFilter
ctx
- Request processing contextNextAction
IOException
Copyright © 2014 Oracle Corporation. All rights reserved.