Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the native httpRoot & nonAppRoot issue #14939

Merged
merged 1 commit into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -470,22 +470,24 @@ void getGraphqlUiFinalDestination(
}

String graphQLPath = httpRootPath.adjustPath(graphQLConfig.rootPath);
String graphQLUiPath = nonApplicationRootPathBuildItem
.adjustPath(graphQLConfig.ui.rootPath);
String graphQLUiPath = httpRootPath
.adjustPath(nonApplicationRootPathBuildItem.adjustPath(graphQLConfig.ui.rootPath));

AppArtifact artifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, GRAPHQL_UI_WEBJAR_GROUP_ID,
GRAPHQL_UI_WEBJAR_ARTIFACT_ID);
if (launchMode.getLaunchMode().isDevOrTest()) {
Path tempPath = WebJarUtil.copyResourcesForDevOrTest(curateOutcomeBuildItem, launchMode, artifact,
GRAPHQL_UI_WEBJAR_PREFIX);
WebJarUtil.updateUrl(tempPath.resolve(FILE_TO_UPDATE), graphQLPath, LINE_TO_UPDATE, LINE_FORMAT);
WebJarUtil.updateUrl(tempPath.resolve(FILE_TO_UPDATE), httpRootPath.adjustPath(graphQLUiPath),
WebJarUtil.updateUrl(tempPath.resolve(FILE_TO_UPDATE), graphQLUiPath,
UI_LINE_TO_UPDATE, UI_LINE_FORMAT);

smallRyeGraphQLBuildProducer.produce(new SmallRyeGraphQLBuildItem(tempPath.toAbsolutePath().toString(),
httpRootPath.adjustPath(graphQLUiPath)));
smallRyeGraphQLBuildProducer
.produce(new SmallRyeGraphQLBuildItem(tempPath.toAbsolutePath().toString(), graphQLUiPath));
notFoundPageDisplayableEndpointProducer
.produce(new NotFoundPageDisplayableEndpointBuildItem(graphQLUiPath + "/", "MicroProfile GraphQL UI"));
.produce(new NotFoundPageDisplayableEndpointBuildItem(
nonApplicationRootPathBuildItem.adjustPath(graphQLConfig.ui.rootPath) + "/",
"MicroProfile GraphQL UI"));

// Handle live reload of branding files
if (liveReloadBuildItem.isLiveReload() && !liveReloadBuildItem.getChangedResources().isEmpty()) {
Expand All @@ -506,7 +508,7 @@ void getGraphqlUiFinalDestination(
LINE_FORMAT)
.getBytes(StandardCharsets.UTF_8);
content = WebJarUtil
.updateUrl(new String(content, StandardCharsets.UTF_8), httpRootPath.adjustPath(graphQLUiPath),
.updateUrl(new String(content, StandardCharsets.UTF_8), graphQLUiPath,
UI_LINE_TO_UPDATE,
UI_LINE_FORMAT)
.getBytes(StandardCharsets.UTF_8);
Expand All @@ -517,8 +519,7 @@ void getGraphqlUiFinalDestination(
nativeImageResourceProducer.produce(new NativeImageResourceBuildItem(fileName));
}

smallRyeGraphQLBuildProducer.produce(new SmallRyeGraphQLBuildItem(GRAPHQL_UI_FINAL_DESTINATION,
httpRootPath.adjustPath(graphQLUiPath)));
smallRyeGraphQLBuildProducer.produce(new SmallRyeGraphQLBuildItem(GRAPHQL_UI_FINAL_DESTINATION, graphQLUiPath));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ void registerUiExtension(
}

String healthPath = httpRootPath.adjustPath(nonApplicationRootPathBuildItem.adjustPath(healthConfig.rootPath));
String healthUiPath = httpRootPath.adjustPath(nonApplicationRootPathBuildItem.adjustPath(healthConfig.ui.rootPath));

AppArtifact artifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, HEALTH_UI_WEBJAR_GROUP_ID,
HEALTH_UI_WEBJAR_ARTIFACT_ID);
Expand All @@ -426,8 +427,8 @@ void registerUiExtension(
HEALTH_UI_WEBJAR_PREFIX);
updateApiUrl(tempPath.resolve(FILE_TO_UPDATE), healthPath);

smallRyeHealthBuildProducer.produce(new SmallRyeHealthBuildItem(tempPath.toAbsolutePath().toString(),
httpRootPath.adjustPath(healthConfig.ui.rootPath)));
smallRyeHealthBuildProducer
.produce(new SmallRyeHealthBuildItem(tempPath.toAbsolutePath().toString(), healthUiPath));

notFoundPageDisplayableEndpointProducer
.produce(new NotFoundPageDisplayableEndpointBuildItem(
Expand Down Expand Up @@ -457,8 +458,7 @@ void registerUiExtension(
nativeImageResourceProducer.produce(new NativeImageResourceBuildItem(fileName));
}

smallRyeHealthBuildProducer.produce(new SmallRyeHealthBuildItem(HEALTH_UI_FINAL_DESTINATION,
httpRootPath.adjustPath(healthConfig.ui.rootPath)));
smallRyeHealthBuildProducer.produce(new SmallRyeHealthBuildItem(HEALTH_UI_FINAL_DESTINATION, healthUiPath));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ public void getSwaggerUiFinalDestination(
WebJarUtil.updateFile(tempPath.resolve("index.html"),
generateIndexHtml(openApiPath, swaggerUiPath, swaggerUiConfig));

swaggerUiBuildProducer.produce(new SwaggerUiBuildItem(tempPath.toAbsolutePath().toString(),
nonApplicationRootPathBuildItem.adjustPath(swaggerUiConfig.path)));
swaggerUiBuildProducer.produce(new SwaggerUiBuildItem(tempPath.toAbsolutePath().toString(), swaggerUiPath));
displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(
nonApplicationRootPathBuildItem.adjustPath(swaggerUiConfig.path + "/"), "Open API UI"));

Expand Down Expand Up @@ -136,8 +135,7 @@ public void getSwaggerUiFinalDestination(
nativeImageResourceBuildItemBuildProducer.produce(new NativeImageResourceBuildItem(fileName));
}
}
swaggerUiBuildProducer.produce(new SwaggerUiBuildItem(SWAGGER_UI_FINAL_DESTINATION,
nonApplicationRootPathBuildItem.adjustPath(swaggerUiConfig.path)));
swaggerUiBuildProducer.produce(new SwaggerUiBuildItem(SWAGGER_UI_FINAL_DESTINATION, swaggerUiPath));
}
}
}
Expand Down