Class BaseFilter
- java.lang.Object
-
- org.glassfish.grizzly.filterchain.BaseFilter
-
- All Implemented Interfaces:
Filter
- Direct Known Subclasses:
AbstractCodecFilter,ActivityCheckFilter,DelayFilter,EchoFilter,GZipFilter,IdleTimeoutFilter,LogFilter,LZMAFilter,SilentConnectionFilter,SSLBaseFilter,TCPNIOTransportFilter,TransportFilter,UDPNIOTransportFilter
public class BaseFilter extends Object implements Filter
Provides empty implementation forFilterprocessing methods.- Author:
- Alexey Stashok
- See Also:
Filter
-
-
Constructor Summary
Constructors Constructor Description BaseFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilterChainContextcreateContext(Connection connection, FilterChainContext.Operation operation)voidexceptionOccurred(FilterChainContext ctx, Throwable error)Notification about exception, occurred on theFilterChainNextActionhandleAccept(FilterChainContext ctx)Execute a unit of processing work to be performed, when server channel has accepted the client connection.NextActionhandleClose(FilterChainContext ctx)Execute a unit of processing work to be performed, when connection has been closed.NextActionhandleConnect(FilterChainContext ctx)Execute a unit of processing work to be performed, when channel gets connected.NextActionhandleEvent(FilterChainContext ctx, FilterChainEvent event)Handle custom event associated with theConnection.NextActionhandleRead(FilterChainContext ctx)Execute a unit of processing work to be performed, when channel will become available for reading.NextActionhandleWrite(FilterChainContext ctx)Execute a unit of processing work to be performed, when some data should be written on channel.voidonAdded(FilterChain filterChain)Method is called, when the Filter has been added to the passedFilterChain.voidonFilterChainChanged(FilterChain filterChain)Method is called, when theFilterChainthis Filter is part of, has been changed.voidonRemoved(FilterChain filterChain)Method is called, when the Filter has been removed from the passedFilterChain.StringtoString()
-
-
-
Method Detail
-
onAdded
public void onAdded(FilterChain filterChain)
Method is called, when the Filter has been added to the passedFilterChain.- Specified by:
onAddedin interfaceFilter- Parameters:
filterChain- theFilterChainthis Filter was added to.
-
onFilterChainChanged
public void onFilterChainChanged(FilterChain filterChain)
Method is called, when theFilterChainthis Filter is part of, has been changed.- Specified by:
onFilterChainChangedin interfaceFilter- Parameters:
filterChain- theFilterChain.
-
onRemoved
public void onRemoved(FilterChain filterChain)
Method is called, when the Filter has been removed from the passedFilterChain.- Specified by:
onRemovedin interfaceFilter- Parameters:
filterChain- theFilterChainthis Filter was removed from.
-
handleRead
public NextAction handleRead(FilterChainContext ctx) throws IOException
Execute a unit of processing work to be performed, when channel will become available for reading. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleReadin interfaceFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleWrite
public NextAction handleWrite(FilterChainContext ctx) throws IOException
Execute a unit of processing work to be performed, when some data should be written on channel. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleWritein interfaceFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleConnect
public NextAction handleConnect(FilterChainContext ctx) throws IOException
Execute a unit of processing work to be performed, when channel gets connected. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleConnectin interfaceFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleAccept
public NextAction handleAccept(FilterChainContext ctx) throws IOException
Execute a unit of processing work to be performed, when server channel has accepted the client connection. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleAcceptin interfaceFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleEvent
public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
Handle custom event associated with theConnection. ThisFiltermay either complete the required processing and returnStopAction, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returningInvokeAction.- Specified by:
handleEventin interfaceFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleClose
public NextAction handleClose(FilterChainContext ctx) throws IOException
Execute a unit of processing work to be performed, when connection has been closed. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleClosein interfaceFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
exceptionOccurred
public void exceptionOccurred(FilterChainContext ctx, Throwable error)
Notification about exception, occurred on theFilterChain- Specified by:
exceptionOccurredin interfaceFilter- Parameters:
ctx- event processingFilterChainContexterror- error, which occurred during FilterChain execution
-
createContext
public FilterChainContext createContext(Connection connection, FilterChainContext.Operation operation)
-
-