Skip to content

Commit

Permalink
Adjusted the server path to include the context path
Browse files Browse the repository at this point in the history
  • Loading branch information
sadv1r committed Jun 3, 2024
1 parent f6489bb commit a719ba0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public class GraphiQlWebFluxAutoConfiguration {
@Order(-1)
public RouterFunction<RenderingResponse> reactiveGraphiQlRouterFunction(GraphiqlProperties properties,
@Value("${spring.graphql.path:/graphql}") String serverPath) {
String pathWithContext = serverPath.startsWith("/") ? serverPath : "/" + serverPath;

final HandlerFunction<RenderingResponse> handler = e -> RenderingResponse.create("graphiql")
.modelAttribute("cdnHost", properties.getCdn().getHost())
.modelAttribute("serverPath", serverPath)
.modelAttribute("serverPath", e.requestPath().contextPath().value() + pathWithContext)
.modelAttribute("query", properties.getQuery())
.modelAttribute("defaultEditorToolsVisibility", properties.getDefaultEditorToolsVisibility())
.modelAttribute("variables", properties.getVariables())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public class GraphiQlWebMvcAutoConfiguration {
@Order(-1)
public RouterFunction<ServerResponse> graphiQlRouterFunction(GraphiqlProperties properties,
@Value("${spring.graphql.path:/graphql}") String serverPath) {
String pathWithContext = serverPath.startsWith("/") ? serverPath : "/" + serverPath;

final HandlerFunction<ServerResponse> handler = e -> RenderingResponse.create("graphiql")
.modelAttribute("cdnHost", properties.getCdn().getHost())
.modelAttribute("serverPath", serverPath)
.modelAttribute("serverPath", e.requestPath().contextPath().value() + pathWithContext)
.modelAttribute("query", properties.getQuery())
.modelAttribute("defaultEditorToolsVisibility", properties.getDefaultEditorToolsVisibility())
.modelAttribute("variables", properties.getVariables())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public class PlaygroundWebFluxMvcAutoConfiguration {
@Order(-1)
public RouterFunction<RenderingResponse> reactivePlaygroundRouterFunction(PlaygroundProperties properties,
@Value("${spring.graphql.path:/graphql}") String serverPath) {
String pathWithContext = serverPath.startsWith("/") ? serverPath : "/" + serverPath;

final HandlerFunction<RenderingResponse> handler = e -> RenderingResponse.create("playground")
.modelAttribute("cdnHost", properties.getCdn().getHost())
.modelAttribute("serverPath", serverPath)
.modelAttribute("serverPath", e.requestPath().contextPath().value() + pathWithContext)
.modelAttribute("settings", properties.getSettings())
.modelAttribute("headers", properties.getHeaders())
.modelAttribute("tabs", properties.getTabs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public class PlaygroundWebMvcAutoConfiguration {
@Order(-1)
public RouterFunction<ServerResponse> playgroundRouterFunction(PlaygroundProperties properties,
@Value("${spring.graphql.path:/graphql}") String serverPath) {
String pathWithContext = serverPath.startsWith("/") ? serverPath : "/" + serverPath;

final HandlerFunction<ServerResponse> handler = e -> RenderingResponse.create("playground")
.modelAttribute("cdnHost", properties.getCdn().getHost())
.modelAttribute("serverPath", serverPath)
.modelAttribute("serverPath", e.requestPath().contextPath().value() + pathWithContext)
.modelAttribute("settings", properties.getSettings())
.modelAttribute("headers", properties.getHeaders())
.modelAttribute("tabs", properties.getTabs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ public class VoyagerWebFluxAutoConfiguration {
@Bean
@Order(-1)
public RouterFunction<RenderingResponse> reactiveVoyagerRouterFunction(VoyagerProperties properties,
@Value("${spring.graphql.path:/graphql}") String serverPath) {
@Value("${spring.graphql.path:/graphql}") String serverPath) {
String pathWithContext = serverPath.startsWith("/") ? serverPath : "/" + serverPath;

final HandlerFunction<RenderingResponse> handler = e -> RenderingResponse.create("voyager")
.modelAttribute("cdnHost", properties.getCdn().getHost())
.modelAttribute("serverPath", serverPath)
.modelAttribute("serverPath", e.requestPath().contextPath().value() + pathWithContext)
.modelAttribute("displayOptions", properties.getDisplayOptions())
.modelAttribute("hideDocs", properties.isHideDocs())
.modelAttribute("hideSettings", properties.isHideSettings())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ public class VoyagerWebMvcAutoConfiguration {
@Bean
@Order(-1)
public RouterFunction<ServerResponse> voyagerRouterFunction(VoyagerProperties properties,
@Value("${spring.graphql.path:/graphql}") String serverPath) {
@Value("${spring.graphql.path:/graphql}") String serverPath) {
String pathWithContext = serverPath.startsWith("/") ? serverPath : "/" + serverPath;

final HandlerFunction<ServerResponse> handler = e -> RenderingResponse.create("voyager")
.modelAttribute("cdnHost", properties.getCdn().getHost())
.modelAttribute("serverPath", serverPath)
.modelAttribute("serverPath", e.requestPath().contextPath().value() + pathWithContext)
.modelAttribute("displayOptions", properties.getDisplayOptions())
.modelAttribute("hideDocs", properties.isHideDocs())
.modelAttribute("hideSettings", properties.isHideSettings())
Expand Down

0 comments on commit a719ba0

Please sign in to comment.