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 enumAddress family enum. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateTcp(@Nullable String host, int port, boolean ssl, @Nullable String keyName, @Nullable String trustName) Create 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, ornullif a new file descriptor should be opened (the default).getHost()For TCP listeners, the host to bind to, ornullto bind to all hosts.Name of aCertificateProviderbean that supplies the private key and certificate chain for this listener's SSL context.getName()Name of the listener.getPath()For UNIX domain sockets, the path of the socket.intgetPort()The TCP port to bind to.Name of aCertificateProviderbean that supplies the trust material (trusted certificates) for this listener's SSL context.booleanisBind()Whether the server should bind to the socket.booleanWhether to expose default routes on this listener.booleanWhether to create a server socket.booleanisSsl()Whether to enable SSL on this listener.booleanIftrue(the default), this listener will stop accepting new connections and terminate any existing ones when a graceful shutdown is initiated.voidsetAcceptedFd(Integer acceptedFd) An already accepted socket fd that should be registered to this listener.voidsetBind(boolean bind) Whether the server should bind to the socket.voidsetExposeDefaultRoutes(boolean exposeDefaultRoutes) Whether to expose default routes on this listener.voidThe address family of this listener.voidThe fixed file descriptor for this listener, ornullif a new file descriptor should be opened (the default).voidFor TCP listeners, the host to bind to, ornullto bind to all hosts.voidsetKeyName(@Nullable String keyName) Name of aCertificateProviderbean that supplies the private key and certificate chain for this listener's SSL context.voidFor UNIX domain sockets, the path of the socket.voidsetPort(int port) The TCP port to bind to.voidsetServerSocket(boolean serverSocket) Whether to create a server socket.voidsetSsl(boolean ssl) Whether to enable SSL on this listener.voidsetSupportGracefulShutdown(boolean supportGracefulShutdown) Iftrue(the default), this listener will stop accepting new connections and terminate any existing ones when a graceful shutdown is initiated.voidsetTrustName(@Nullable String trustName) Name of aCertificateProviderbean that supplies the trust material (trusted certificates) for this listener's SSL context.
-
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, @Nullable @Nullable String keyName, @Nullable @Nullable String trustName) Create a TCP listener configuration.- Parameters:
host- The host to bind toport- The port to bind tossl- Whether to enable SSLkeyName- Optional certificate name to usetrustName- Optional trust store name to use- 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.
-
getKeyName
Name of aCertificateProviderbean that supplies the private key and certificate chain for this listener's SSL context. When set, Micronaut resolves the named provider and subscribes to its keystore updates. If not set, the global SSL configuration (e.g.SslConfiguration.getKeyName()) or legacy keystore properties may be used instead.- Returns:
- the name of the certificate provider for key material on this listener or
null
-
setKeyName
Name of aCertificateProviderbean that supplies the private key and certificate chain for this listener's SSL context. When set, Micronaut resolves the named provider and subscribes to its keystore updates. If not set, the global SSL configuration (e.g.SslConfiguration.getKeyName()) or legacy keystore properties may be used instead.- Parameters:
keyName- the name of the certificate provider for key material on this listener ornull
-
getTrustName
Name of aCertificateProviderbean that supplies the trust material (trusted certificates) for this listener's SSL context. When set, Micronaut resolves the named provider and subscribes to its keystore updates. If not set, the global SSL configuration (e.g.SslConfiguration.getTrustName()) or legacy trust store properties may be used instead.- Returns:
- the name of the certificate provider for trust material on this listener or
null
-
setTrustName
Name of aCertificateProviderbean that supplies the trust material (trusted certificates) for this listener's SSL context. When set, Micronaut resolves the named provider and subscribes to its keystore updates. If not set, the global SSL configuration (e.g.SslConfiguration.getTrustName()) or legacy trust store properties may be used instead.- Parameters:
trustName- the name of the certificate provider for trust material on this listener ornull
-
getHost
For TCP listeners, the host to bind to, ornullto bind to all hosts.- Returns:
- For TCP listeners, the host to bind to, or
nullto bind to all hosts.
-
setHost
For TCP listeners, the host to bind to, ornullto bind to all hosts.- Parameters:
host- For TCP listeners, the host to bind to, ornullto bind to all hosts.
-
getPort
public int getPort()The TCP port to bind to. May be-1to bind to a random port.- Returns:
- The TCP port to bind to. May be
-1to bind to a random port.
-
setPort
public void setPort(int port) The TCP port to bind to. May be-1to bind to a random port.- Parameters:
port- The TCP port to bind to. May be-1to 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 tofalseyou 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 tofalseyou 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, ornullif a new file descriptor should be opened (the default).- Returns:
- The file descriptor
-
setFd
The fixed file descriptor for this listener, ornullif 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.trueby 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.trueby 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:
trueiff 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-trueiff 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)