java.lang.Object
io.javalin.community.ssl.SSLPlugin
- All Implemented Interfaces:
io.javalin.plugin.Plugin
A plugin to easily enable SSL on a Javalin server.
The intended configuration pattern is to use the SSLPlugin(Consumer) constructor to configure the
plugin, either though a lambda or a Consumer. This allows for a more fluent configuration pattern.
Hot reloading of the SSL certificates is supported. This means that the plugin will replace the SSL certificates without restarting the server, allowing for a seamless transition. This is done by using the reload(Consumer) method.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(@NotNull io.javalin.Javalin javalin) Method to apply the plugin to a Javalin instancevoidpatch(@NotNull org.eclipse.jetty.server.Server server) Method to apply the SSLConfig to a given Jetty Server.voidDeprecated, for removal: This API element is subject to removal in a future version.voidMethod to hot-swap the certificate and key material of the plugin.
-
Constructor Details
-
SSLPlugin
public SSLPlugin()Creates a new SSLPlugin with the default configuration. -
SSLPlugin
Creates a new SSLPlugin with the given configuration.- Parameters:
config- The configuration to use.
-
SSLPlugin
Creates a new SSLPlugin with the given configuration lambda/supplier. This is useful if you want to use the default configuration and only change a few values. Recommended way to create a new SSLPlugin with the given configuration.- Parameters:
config- The configuration to use.
-
-
Method Details
-
apply
public void apply(@NotNull @NotNull io.javalin.Javalin javalin) Method to apply the plugin to a Javalin instance- Specified by:
applyin interfaceio.javalin.plugin.Plugin- Parameters:
javalin- Javalin instance
-
patch
public void patch(@NotNull @NotNull org.eclipse.jetty.server.Server server) Method to apply the SSLConfig to a given Jetty Server. Can be used to patch pre-existing or custom servers.- Parameters:
server- The Jetty Server to patch.
-
reload
Deprecated, for removal: This API element is subject to removal in a future version.Usereload(Consumer)instead.Method to hot-swap the certificate and key material of the plugin. Any configuration changes will be ignored, only the certificate and key material will be updated.- Parameters:
newConfig- A config containing the new certificate and key material.
-
reload
Method to hot-swap the certificate and key material of the plugin. Any configuration changes will be ignored, only the certificate and key material will be updated.- Parameters:
newConfig- A consumer providing the new certificate and key material.
-
reload(Consumer)instead.