Class NonApplicationRootPathBuildItem

java.lang.Object
io.quarkus.builder.item.BuildItem
io.quarkus.builder.item.SimpleBuildItem
io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem

public final class NonApplicationRootPathBuildItem extends io.quarkus.builder.item.SimpleBuildItem
  • Field Details

    • httpRootPath

      final URI httpRootPath
      Normalized of quarkus.http.root-path. Must end in a slash
    • nonApplicationRootPath

      final URI nonApplicationRootPath
      Normalized from quarkus.http.non-application-root-path
    • managementRootPath

      final URI managementRootPath
      Normalized from quarkus.management.root-path
    • dedicatedRouterRequired

      final boolean dedicatedRouterRequired
      Non-Application root path is distinct from HTTP root path.
    • attachedToMainRouter

      final boolean attachedToMainRouter
  • Constructor Details

    • NonApplicationRootPathBuildItem

      public NonApplicationRootPathBuildItem(String httpRootPath, String nonApplicationRootPath, String managementRootPath)
  • Method Details

    • isDedicatedRouterRequired

      public boolean isDedicatedRouterRequired()
      Is a dedicated router required for non-application endpoints.
      Returns:
      boolean
    • isAttachedToMainRouter

      public boolean isAttachedToMainRouter()
    • getVertxRouterPath

      String getVertxRouterPath()
      Path to the Non-application root for use with Vert.x Routers, has a leading slash.

      If it's under the HTTP Root, return a path relative to HTTP Root. Otherwise, return an absolute path.

      Returns:
      String Path suitable for use with Vert.x Router. It has a leading slash
    • getNormalizedHttpRootPath

      public String getNormalizedHttpRootPath()
    • getNonApplicationRootPath

      public String getNonApplicationRootPath()
      Return normalized root path configured from quarkus.http.root-path and {quarkus.http.non-application-root-path}. This path will always end in a slash.

      Use resolvePath(String) if you need to construct a URI for a non-application endpoint.

      Returns:
      Normalized non-application root path ending with a slash
      See Also:
    • getManagementRootPath

      public String getManagementRootPath()
      Returns:
      the normalized root path for the mangement endpoints. getNonApplicationRootPath() if the management interface is disabled.
    • resolvePath

      public String resolvePath(String path)
      Resolve path into an absolute path. If path is relative, it will be resolved against `quarkus.http.non-application-root-path`. An absolute path will be normalized and returned.

      Given quarkus.http.root-path=/ and quarkus.http.non-application-root-path="q"

      • resolvePath("foo") will return /q/foo
      • resolvePath("/foo") will return /foo

      Given quarkus.http.root-path=/ and quarkus.http.non-application-root-path="/q"

      • resolvePath("foo") will return /q/foo
      • resolvePath("/foo") will return /foo
      Given quarkus.http.root-path=/app and quarkus.http.non-application-root-path="q"
      • resolvePath("foo") will return /app/q/foo
      • resolvePath("/foo") will return /foo
      Given quarkus.http.root-path=/app and quarkus.http.non-application-root-path="/q"
      • resolvePath("foo") will return /q/foo
      • resolvePath("/foo") will return /foo

      The returned path will not end with a slash.

      Parameters:
      path - Path to be resolved to an absolute path.
      Returns:
      An absolute path not ending with a slash
      Throws:
      IllegalArgumentException - if path is null or empty
      See Also:
      • UriNormalizationUtil.normalizeWithBase(URI, String, boolean)
    • resolveManagementPath

      public String resolveManagementPath(String path, ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig, io.quarkus.deployment.builditem.LaunchModeBuildItem mode)
    • resolveManagementPath

      public String resolveManagementPath(String path, ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig, io.quarkus.deployment.builditem.LaunchModeBuildItem mode, boolean extensionOverride)
    • getManagementUrlPrefix

      public static String getManagementUrlPrefix(io.quarkus.deployment.builditem.LaunchModeBuildItem mode)
      Best effort to deduce the URL prefix (scheme, host, port) of the management interface.
      Parameters:
      mode - the mode, influencing the default port
      Returns:
      the prefix
    • resolveNestedPath

      public String resolveNestedPath(String path, String subRoute)
      Resolve a base path and a sub-resource against the non-application root. This will call resolvePath on the base path (to establish a fully-resolved, absolute path), and then will resolve the subRoute against that resolved path. This allows a configured subpath to be configured (consistently) as an absolute URI.

      Given quarkus.http.root-path=/ and quarkus.http.non-application-root-path="q"

      • resolveNestedPath("foo", "a") will return /q/foo/a
      • resolveNestedPath("foo", "/a) will return /a

      The returned path will not end with a slash.

      Parameters:
      path - Path to be resolved to an absolute path.
      Returns:
      An absolute path not ending with a slash
      Throws:
      IllegalArgumentException - if path is null or empty
      See Also:
    • resolveManagementNestedPath

      public String resolveManagementNestedPath(String path, String subRoute)
    • routeBuilder