Search in sources :

Example 1 with NotFoundPageDisplayableEndpointBuildItem

use of io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem in project quarkus-github-app by quarkiverse.

the class GitHubAppProcessor method replayUi.

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void replayUi(GitHubAppRecorder recorder, LaunchModeBuildItem launchMode, WebJarResultsBuildItem webJarResults, HttpRootPathBuildItem httpRootPath, ShutdownContextBuildItem shutdownContext, BuildProducer<RouteBuildItem> routes, BuildProducer<NotFoundPageDisplayableEndpointBuildItem> displayableEndpoints) throws IOException {
    if (launchMode.getLaunchMode() != LaunchMode.DEVELOPMENT) {
        return;
    }
    WebJarResultsBuildItem.WebJarResult webJarResult = webJarResults.byArtifactKey(QUARKIVERSE_GITHUB_APP_GACT);
    if (webJarResult == null) {
        return;
    }
    Handler<RoutingContext> handler = recorder.replayUiHandler(webJarResult.getFinalDestination(), REPLAY_UI_PATH, webJarResult.getWebRootConfigurations(), shutdownContext);
    routes.produce(httpRootPath.routeBuilder().route(REPLAY_UI_PATH).handler(handler).build());
    routes.produce(httpRootPath.routeBuilder().route(REPLAY_UI_PATH + "/*").handler(handler).build());
    displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(REPLAY_UI_PATH + "/"));
}
Also used : RoutingContext(io.vertx.ext.web.RoutingContext) WebJarResultsBuildItem(io.quarkus.vertx.http.deployment.webjar.WebJarResultsBuildItem) NotFoundPageDisplayableEndpointBuildItem(io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem) BuildStep(io.quarkus.deployment.annotations.BuildStep) Record(io.quarkus.deployment.annotations.Record)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)1 Record (io.quarkus.deployment.annotations.Record)1 NotFoundPageDisplayableEndpointBuildItem (io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem)1 WebJarResultsBuildItem (io.quarkus.vertx.http.deployment.webjar.WebJarResultsBuildItem)1 RoutingContext (io.vertx.ext.web.RoutingContext)1