Class NettyHttpServerConfiguration.NettyListenerConfiguration
java.lang.Object
io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration.NettyListenerConfiguration
- Enclosing class:
- NettyHttpServerConfiguration
@EachProperty("listeners")
public static final class NettyHttpServerConfiguration.NettyListenerConfiguration
extends Object
Netty listener configuration.
- Since:
- 3.5.0
- Author:
- yawkat
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Address family enum. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionCreate a TCP listener configuration.An already accepted socket fd that should be registered to this listener.The address family of this listener.getFd()
The fixed file descriptor for this listener, ornull
if a new file descriptor should be opened (the default).getHost()
For TCP listeners, the host to bind to, ornull
to bind to all hosts.getName()
Name of the listener.getPath()
For UNIX domain sockets, the path of the socket.int
getPort()
The TCP port to bind to.boolean
isBind()
Whether the server should bind to the socket.boolean
Whether to expose default routes on this listener.boolean
Whether to create a server socket.boolean
isSsl()
Whether to enable SSL on this listener.boolean
Iftrue
(the default), this listener will stop accepting new connections and terminate any existing ones when a graceful shutdown is initiated.void
setAcceptedFd
(Integer acceptedFd) An already accepted socket fd that should be registered to this listener.void
setBind
(boolean bind) Whether the server should bind to the socket.void
setExposeDefaultRoutes
(boolean exposeDefaultRoutes) Whether to expose default routes on this listener.void
The address family of this listener.void
The fixed file descriptor for this listener, ornull
if a new file descriptor should be opened (the default).void
For TCP listeners, the host to bind to, ornull
to bind to all hosts.void
For UNIX domain sockets, the path of the socket.void
setPort
(int port) The TCP port to bind to.void
setServerSocket
(boolean serverSocket) Whether to create a server socket.void
setSsl
(boolean ssl) Whether to enable SSL on this listener.void
setSupportGracefulShutdown
(boolean supportGracefulShutdown) Iftrue
(the default), this listener will stop accepting new connections and terminate any existing ones when a graceful shutdown is initiated.
-
Constructor Details
-
NettyListenerConfiguration
Constructor.- Parameters:
name
- The name of this listener
-
NettyListenerConfiguration
Deprecated.Please pass the listener name toNettyListenerConfiguration(String)
Constructor.
-
-
Method Details
-
createTcp
@Internal public static NettyHttpServerConfiguration.NettyListenerConfiguration createTcp(@Nullable @Nullable String host, int port, boolean ssl) Create a TCP listener configuration.- Parameters:
host
- The host to bind toport
- The port to bind tossl
- Whether to enable SSL- Returns:
- The configuration with the given settings
-
getName
Name of the listener.- Returns:
- Name of the listener
-
getFamily
The address family of this listener.- Returns:
- The address family of this listener.
-
setFamily
public void setFamily(@NonNull @NonNull NettyHttpServerConfiguration.NettyListenerConfiguration.Family family) The address family of this listener.- Parameters:
family
- The address family of this listener.
-
isSsl
public boolean isSsl()Whether to enable SSL on this listener. Also requiresSslConfiguration.isEnabled()
to be set.- Returns:
- Whether to enable SSL on this listener.
-
setSsl
public void setSsl(boolean ssl) Whether to enable SSL on this listener. Also requiresSslConfiguration.isEnabled()
to be set.- Parameters:
ssl
- Whether to enable SSL on this listener.
-
getHost
For TCP listeners, the host to bind to, ornull
to bind to all hosts.- Returns:
- For TCP listeners, the host to bind to, or
null
to bind to all hosts.
-
setHost
For TCP listeners, the host to bind to, ornull
to bind to all hosts.- Parameters:
host
- For TCP listeners, the host to bind to, ornull
to bind to all hosts.
-
getPort
public int getPort()The TCP port to bind to. May be-1
to bind to a random port.- Returns:
- The TCP port to bind to. May be
-1
to bind to a random port.
-
setPort
public void setPort(int port) The TCP port to bind to. May be-1
to bind to a random port.- Parameters:
port
- The TCP port to bind to. May be-1
to bind to a random port.
-
getPath
For UNIX domain sockets, the path of the socket. For abstract domain sockets, this should start with a NUL byte.- Returns:
- For UNIX domain sockets, the path of the socket. For abstract domain sockets, this should start with a NUL byte.
-
setPath
For UNIX domain sockets, the path of the socket. For abstract domain sockets, this should start with a NUL byte.- Parameters:
path
- For UNIX domain sockets, the path of the socket. For abstract domain sockets, this should start with a NUL byte.
-
isExposeDefaultRoutes
Whether to expose default routes on this listener.- Returns:
- Whether to expose default routes on this listener.
-
setExposeDefaultRoutes
Whether to expose default routes on this listener.- Parameters:
exposeDefaultRoutes
- Whether to expose default routes on this listener.
-
isSupportGracefulShutdown
public boolean isSupportGracefulShutdown()Iftrue
(the default), this listener will stop accepting new connections and terminate any existing ones when a graceful shutdown is initiated. By setting this tofalse
you can ignore the graceful shutdown, e.g. to keep a management port up while the shutdown of other listeners is in progress.- Returns:
- Whether to support shutting down gracefully
-
setSupportGracefulShutdown
public void setSupportGracefulShutdown(boolean supportGracefulShutdown) Iftrue
(the default), this listener will stop accepting new connections and terminate any existing ones when a graceful shutdown is initiated. By setting this tofalse
you can ignore the graceful shutdown, e.g. to keep a management port up while the shutdown of other listeners is in progress.- Parameters:
supportGracefulShutdown
- Whether to support shutting down gracefully
-
getFd
The fixed file descriptor for this listener, ornull
if a new file descriptor should be opened (the default).- Returns:
- The file descriptor
-
setFd
The fixed file descriptor for this listener, ornull
if a new file descriptor should be opened (the default).- Parameters:
fd
- The file descriptor
-
isBind
public boolean isBind()Whether the server should bind to the socket.true
by default. If set tofalse
, the socket must already be bound and listening.- Returns:
- Whether to bind to the socket
-
setBind
public void setBind(boolean bind) Whether the server should bind to the socket.true
by default. If set tofalse
, the socket must already be bound and listening.- Parameters:
bind
- Whether to bind to the socket
-
isServerSocket
public boolean isServerSocket()Whether to create a server socket. This is on by default. Turning it off only makes sense in combination withacceptedFd
.- Returns:
true
iff a server socket should be created
-
setServerSocket
public void setServerSocket(boolean serverSocket) Whether to create a server socket. This is on by default. Turning it off only makes sense in combination withacceptedFd
.- Parameters:
serverSocket
-true
iff a server socket should be created
-
getAcceptedFd
An already accepted socket fd that should be registered to this listener.- Returns:
- The fd to register
-
setAcceptedFd
An already accepted socket fd that should be registered to this listener.- Parameters:
acceptedFd
- The fd to register
-
NettyListenerConfiguration(String)