From 0401a5924d1bb8513dfc4e40c69a4c40686de2e3 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Wed, 5 Jun 2019 23:34:06 +0200 Subject: [PATCH] DATAREST-1386 - Tweak redirect setup for HAL explorer. We now prepare the redirect to the HAL explorer as it expects it. --- .../data/rest/webmvc/halexplorer/HalExplorer.java | 2 +- .../rest/webmvc/halexplorer/HalExplorerIntegrationTests.java | 2 +- .../data/rest/webmvc/halexplorer/HalExplorerUnitTests.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-data-rest-hal-explorer/src/main/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorer.java b/spring-data-rest-hal-explorer/src/main/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorer.java index 05eac69ee..d03c87baa 100644 --- a/spring-data-rest-hal-explorer/src/main/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorer.java +++ b/spring-data-rest-hal-explorer/src/main/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorer.java @@ -76,7 +76,7 @@ class HalExplorer { } builder.path(INDEX); - builder.fragment(explorerRelative ? path.substring(0, path.lastIndexOf(EXPLORER)) : path); + builder.fragment(String.format("uri=%s", explorerRelative ? path.substring(0, path.lastIndexOf(EXPLORER)) : path)); return new RedirectView(builder.build().toUriString()); } diff --git a/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerIntegrationTests.java b/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerIntegrationTests.java index 22b27a36f..1ae89141d 100755 --- a/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerIntegrationTests.java +++ b/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerIntegrationTests.java @@ -54,7 +54,7 @@ public class HalExplorerIntegrationTests { static final String BASE_PATH = "/api"; static final String EXPLORER_INDEX = "/explorer/index.html"; - static final String TARGET = BASE_PATH.concat(EXPLORER_INDEX).concat("#").concat(BASE_PATH); + static final String TARGET = BASE_PATH.concat(EXPLORER_INDEX).concat("#uri=").concat(BASE_PATH); @Configuration @EnableWebMvc diff --git a/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerUnitTests.java b/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerUnitTests.java index a7be66424..b943a5bea 100755 --- a/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerUnitTests.java +++ b/spring-data-rest-hal-explorer/src/test/java/org/springframework/data/rest/webmvc/halexplorer/HalExplorerUnitTests.java @@ -62,7 +62,7 @@ public class HalExplorerUnitTests { UriComponents components = UriComponentsBuilder.fromUriString(response.getHeader(HttpHeaders.LOCATION)).build(); assertThat(components.getPath(), startsWith("/context")); - assertThat(components.getFragment()).isEqualTo("/context"); + assertThat(components.getFragment()).isEqualTo("uri=/context"); } @Test // DATAREST-1264