Interface HttpUpgradeCheck

All Known Implementing Classes:
SecurityHttpUpgradeCheck

public interface HttpUpgradeCheck
A check that controls which requests are allowed to upgrade the HTTP connection to a WebSocket connection. CDI beans implementing this interface are invoked on every request. The CDI beans implementing `HttpUpgradeCheck` interface can be either `@ApplicationScoped`, `@Singleton` or `@Dependent` beans, but never the `@RequestScoped` beans.

The checks are called orderly according to a bean priority. When no priority is declared (for example with the `@jakarta.annotation.Priority` annotation), default priority is used. If one of the checks rejects the upgrade, remaining checks are not called.

  • Method Details

    • perform

      io.smallrye.mutiny.Uni<HttpUpgradeCheck.CheckResult> perform(HttpUpgradeCheck.HttpUpgradeContext context)
      This method inspects HTTP Upgrade context and either allows or denies upgrade to a WebSocket connection.

      Use VertxContextSupport.executeBlocking(java.util.concurrent.Callable) in order to execute some blocking code in the check.

      Parameters:
      context - HttpUpgradeCheck.HttpUpgradeContext
      Returns:
      check result; must never be null
    • appliesTo

      default boolean appliesTo(String endpointId)
      Determines WebSocket endpoints this check is applied to.
      Parameters:
      endpointId - WebSocket endpoint id, @see WebSocket.endpointId() for more information
      Returns:
      true if this check should be applied on a WebSocket endpoint with given id