Package org.jivesoftware.openfire.nio
Class NettyConnectionHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<String>
-
- org.jivesoftware.openfire.nio.NettyConnectionHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
NettyClientConnectionHandler,NettyComponentConnectionHandler,NettyMultiplexerConnectionHandler,NettyOutboundConnectionHandler,NettyServerConnectionHandler
public abstract class NettyConnectionHandler extends io.netty.channel.SimpleChannelInboundHandler<String>
A NettyConnectionHandler is responsible for creating new sessions, destroying sessions and delivering received XML stanzas to the proper StanzaHandler.Subclasses of this will supply a specific
StanzaHandlerimplementation depending on the type of connection to be handled, e.g. C2S, S2S.- Author:
- Matthew Vivian, Alex Gidman
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionConfigurationconfigurationThe configuration for new connections.static io.netty.util.AttributeKey<NettyConnection>CONNECTIONstatic io.netty.util.AttributeKey<Boolean>IDLE_FLAGprotected static ThreadLocal<XMPPPacketReader>PARSER_CACHEstatic io.netty.util.AttributeKey<Long>READ_BYTESprotected booleansslInitDonestatic io.netty.util.AttributeKey<Long>WRITTEN_BYTES
-
Constructor Summary
Constructors Modifier Constructor Description protectedNettyConnectionHandler(ConnectionConfiguration configuration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, String message)voidchannelUnregistered(io.netty.channel.ChannelHandlerContext ctx)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)abstract DurationgetMaxIdleTime()Returns the time that a connection can be idle before being closed.voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx)voidhandlerRemoved(io.netty.channel.ChannelHandlerContext ctx)StringtoString()voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt)-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
-
-
-
Field Detail
-
CONNECTION
public static final io.netty.util.AttributeKey<NettyConnection> CONNECTION
-
READ_BYTES
public static final io.netty.util.AttributeKey<Long> READ_BYTES
-
WRITTEN_BYTES
public static final io.netty.util.AttributeKey<Long> WRITTEN_BYTES
-
IDLE_FLAG
public static final io.netty.util.AttributeKey<Boolean> IDLE_FLAG
-
PARSER_CACHE
protected static final ThreadLocal<XMPPPacketReader> PARSER_CACHE
-
sslInitDone
protected boolean sslInitDone
-
configuration
protected final ConnectionConfiguration configuration
The configuration for new connections.
-
-
Constructor Detail
-
NettyConnectionHandler
protected NettyConnectionHandler(ConnectionConfiguration configuration)
-
-
Method Detail
-
getMaxIdleTime
public abstract Duration getMaxIdleTime()
Returns the time that a connection can be idle before being closed.- Returns:
- the time a connection can be idle.
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter
-
handlerRemoved
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
handlerRemovedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerRemovedin classio.netty.channel.ChannelHandlerAdapter
-
channelRead0
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx, String message)- Specified by:
channelRead0in classio.netty.channel.SimpleChannelInboundHandler<String>
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
channelUnregistered
public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelUnregisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelUnregisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
-