DATAREST-720 - HAL Browser fragment now considers the context path if set.
Removed some obsolete Maven dependency versions along the way.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.rest.webmvc.halbrowser;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
|
||||
import org.springframework.data.rest.webmvc.BasePathAwareController;
|
||||
@@ -58,8 +60,8 @@ public class HalBrowser {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/", "" }, method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
|
||||
public View index() {
|
||||
return browser();
|
||||
public View index(HttpServletRequest request) {
|
||||
return browser(request);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,9 +70,11 @@ public class HalBrowser {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/browser", method = RequestMethod.GET)
|
||||
public View browser() {
|
||||
public View browser(HttpServletRequest request) {
|
||||
|
||||
String contextPath = request.getContextPath();
|
||||
String basePath = configuration.getBasePath().toString();
|
||||
return new RedirectView(basePath.concat(BROWSER_INDEX).concat("#").concat(basePath), true);
|
||||
|
||||
return new RedirectView(basePath.concat(BROWSER_INDEX).concat("#").concat(contextPath.concat(basePath)), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user