public class BlacklistFilter extends IoFilterAdapter
IoFilter
which blocks connections from blacklisted remote
address.IoFilter.NextFilter
Constructor and Description |
---|
BlacklistFilter() |
Modifier and Type | Method and Description |
---|---|
void |
block(InetAddress address)
Blocks the specified endpoint.
|
void |
block(Subnet subnet)
Blocks the specified subnet.
|
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
Object message)
Filters
IoHandler.messageReceived(IoSession,Object) event. |
void |
messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoHandler.messageSent(IoSession,Object) event. |
void |
sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionClosed(IoSession) event. |
void |
sessionCreated(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionCreated(IoSession) event. |
void |
sessionIdle(IoFilter.NextFilter nextFilter,
IoSession session,
IdleStatus status)
Filters
IoHandler.sessionIdle(IoSession,IdleStatus) event. |
void |
sessionOpened(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionOpened(IoSession) event. |
void |
setBlacklist(InetAddress[] addresses)
Sets the addresses to be blacklisted.
|
void |
setBlacklist(Iterable<InetAddress> addresses)
Sets the addresses to be blacklisted.
|
void |
setSubnetBlacklist(Iterable<Subnet> subnets)
Sets the subnets to be blacklisted.
|
void |
setSubnetBlacklist(Subnet[] subnets)
Sets the subnets to be blacklisted.
|
void |
unblock(InetAddress address)
Unblocks the specified endpoint.
|
void |
unblock(Subnet subnet)
Unblocks the specified subnet.
|
destroy, exceptionCaught, filterClose, filterWrite, init, inputClosed, onPostAdd, onPostRemove, onPreAdd, onPreRemove, toString
public BlacklistFilter()
public void setBlacklist(InetAddress[] addresses)
addresses
- an array of addresses to be blacklisted.public void setSubnetBlacklist(Subnet[] subnets)
subnets
- an array of subnets to be blacklisted.public void setBlacklist(Iterable<InetAddress> addresses)
addresses
- a collection of InetAddress objects representing the
addresses to be blacklisted.IllegalArgumentException
- if the specified collections contains
non-InetAddress
objects.public void setSubnetBlacklist(Iterable<Subnet> subnets)
subnets
- an array of subnets to be blacklisted.public void block(InetAddress address)
address
- The address to blockpublic void block(Subnet subnet)
subnet
- The subnet to blockpublic void unblock(InetAddress address)
address
- The address to unblockpublic void unblock(Subnet subnet)
subnet
- The subnet to unblockpublic void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session)
IoFilterAdapter
IoHandler.sessionCreated(IoSession)
event.sessionCreated
in interface IoFilter
sessionCreated
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventpublic void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilterAdapter
IoHandler.sessionOpened(IoSession)
event.sessionOpened
in interface IoFilter
sessionOpened
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventException
- If an error occurred while processing the eventpublic void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilterAdapter
IoHandler.sessionClosed(IoSession)
event.sessionClosed
in interface IoFilter
sessionClosed
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventException
- If an error occurred while processing the eventpublic void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception
IoFilterAdapter
IoHandler.sessionIdle(IoSession,IdleStatus)
event.sessionIdle
in interface IoFilter
sessionIdle
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventstatus
- The IdleStatus
typeException
- If an error occurred while processing the eventpublic void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message)
IoFilterAdapter
IoHandler.messageReceived(IoSession,Object)
event.messageReceived
in interface IoFilter
messageReceived
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventmessage
- The received messagepublic void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoFilterAdapter
IoHandler.messageSent(IoSession,Object)
event.messageSent
in interface IoFilter
messageSent
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventwriteRequest
- The WriteRequest
that contains the sent messageException
- If an error occurred while processing the eventCopyright © 2004–2016 Apache MINA Project. All rights reserved.