Class UndertowWebSocketDeploymentCustomizer

java.lang.Object
io.micronaut.servlet.websocket.undertow.UndertowWebSocketDeploymentCustomizer
All Implemented Interfaces:
io.micronaut.context.event.BeanCreatedEventListener<io.undertow.servlet.api.DeploymentInfo>, EventListener

@Internal @Singleton @Requires(classes={io.undertow.websockets.jsr.WebSocketDeploymentInfo.class,io.undertow.servlet.api.DeploymentInfo.class}) @Requires(property="micronaut.servlet.websocket.enabled",notEquals="false",defaultValue="true") public final class UndertowWebSocketDeploymentCustomizer extends Object implements io.micronaut.context.event.BeanCreatedEventListener<io.undertow.servlet.api.DeploymentInfo>
Ensures that a Jakarta ServerContainer is available on the Undertow servlet context.

Undertow's io.undertow.websockets.jsr.Bootstrap servlet extension is loaded by service loading during deployment, but only acts when the deployment carries a WebSocketDeploymentInfo servlet context attribute. Adding that attribute to the DeploymentInfo bean is therefore all the bootstrap that is needed.

Handlers are dispatched to a worker thread rather than run on the XNIO I/O thread, so that blocking application code cannot stall the event loop.

Since:
6.2.0
Author:
graemerocher
  • Constructor Details

    • UndertowWebSocketDeploymentCustomizer

      public UndertowWebSocketDeploymentCustomizer(ServletWebSocketConfiguration configuration, io.micronaut.http.server.HttpServerConfiguration serverConfiguration, WebSocketContainerHolder holder)
      Default constructor.
      Parameters:
      configuration - The WebSocket configuration
      serverConfiguration - The server configuration, used for the default idle timeout
      holder - Where the container is registered for client connections
  • Method Details

    • onCreated

      public io.undertow.servlet.api.DeploymentInfo onCreated(io.micronaut.context.event.BeanCreatedEvent<io.undertow.servlet.api.DeploymentInfo> event)
      Specified by:
      onCreated in interface io.micronaut.context.event.BeanCreatedEventListener<io.undertow.servlet.api.DeploymentInfo>