Skip to content

Commit 9240884

Browse files
authored
fix: add support for graphiql controller view forward request (#256)
1 parent dea68a8 commit 9240884

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

graphql-jpa-query-graphiql/src/main/java/com/introproventures/graphql/jpa/query/graphiql/WebMvcViewControllerConfigurer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.introproventures.graphql.jpa.query.graphiql;
22

3+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
34
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
45
import org.springframework.context.annotation.Bean;
56
import org.springframework.context.annotation.Configuration;
@@ -11,11 +12,13 @@
1112
public class WebMvcViewControllerConfigurer {
1213

1314
@Bean
14-
public WebMvcConfigurer graphqiQLRedirectToIndex() {
15+
@ConditionalOnMissingBean(name = "graphiqlViewController")
16+
public WebMvcConfigurer graphiqlViewController() {
1517
return new WebMvcConfigurer() {
1618
@Override
1719
public void addViewControllers(ViewControllerRegistry registry) {
18-
registry.addRedirectViewController("/graphiql", "graphiql/index.html");
20+
registry.addViewController("/graphiql")
21+
.setViewName("forward:/graphiql/index.html");
1922
}
2023
};
2124
}

graphql-jpa-query-graphiql/src/main/resources/static/graphiql/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<!DOCTYPE html>
99
<html>
1010
<head>
11-
<base href="./" />
1211
<style>
1312
body {
1413
height: 100%;
@@ -38,8 +37,8 @@
3837
copy them directly into your environment, or perhaps include them in your
3938
favored resource bundler.
4039
-->
41-
<link rel="stylesheet" href="graphiql.css" />
42-
<script src="graphiql.js"></script>
40+
<link rel="stylesheet" href="graphiql/graphiql.css" />
41+
<script src="graphiql/graphiql.js"></script>
4342

4443
</head>
4544
<body>

0 commit comments

Comments
 (0)