-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QuteErrorPageSetup: support templates that are not backed by a file
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...nsions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteDevModeProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.qute.deployment; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import io.quarkus.arc.deployment.ValidationPhaseBuildItem.ValidationErrorBuildItem; | ||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.BuildSteps; | ||
import io.quarkus.dev.console.DevConsoleManager; | ||
import io.quarkus.qute.runtime.devmode.QuteErrorPageSetup; | ||
|
||
@BuildSteps(onlyIf = IsDevelopment.class) | ||
public class QuteDevModeProcessor { | ||
|
||
@BuildStep | ||
void collectGeneratedContents(List<TemplatePathBuildItem> templatePaths, | ||
BuildProducer<ValidationErrorBuildItem> errors) { | ||
Map<String, String> contents = new HashMap<>(); | ||
for (TemplatePathBuildItem template : templatePaths) { | ||
if (!template.isFileBased()) { | ||
contents.put(template.getPath(), template.getContent()); | ||
} | ||
} | ||
// Set the global that could be used at runtime when a qute error page is rendered | ||
DevConsoleManager.setGlobal(QuteErrorPageSetup.GENERATED_CONTENTS, contents); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters