Remove ResourceController mappings with param useDefaultLabel (#1728)
Fixes gh-1643
This commit is contained in:
@@ -106,13 +106,6 @@ public class ResourceController {
|
||||
return retrieve(request, name, profile, label, path, resolvePlaceholders);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{name}/{profile}/**", params = "useDefaultLabel")
|
||||
public String retrieve(@PathVariable String name, @PathVariable String profile, ServletWebRequest request,
|
||||
@RequestParam(defaultValue = "true") boolean resolvePlaceholders) throws IOException {
|
||||
String path = getFilePath(request, name, profile, null);
|
||||
return retrieve(request, name, profile, null, path, resolvePlaceholders);
|
||||
}
|
||||
|
||||
private String getFilePath(ServletWebRequest request, String name, String profile, String label) {
|
||||
String stem;
|
||||
if (label != null) {
|
||||
@@ -174,14 +167,6 @@ public class ResourceController {
|
||||
return binary(request, name, profile, label, path);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{name}/{profile}/**", params = "useDefaultLabel",
|
||||
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
public byte[] binary(@PathVariable String name, @PathVariable String profile, ServletWebRequest request)
|
||||
throws IOException {
|
||||
String path = getFilePath(request, name, profile, null);
|
||||
return binary(request, name, profile, null, path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Used only for unit tests.
|
||||
*/
|
||||
|
||||
@@ -297,12 +297,12 @@ public class ResourceControllerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultLabelForBinary() throws Exception {
|
||||
public void nullLabelForBinary() throws Exception {
|
||||
this.environmentRepository.setSearchLocations("classpath:/test/{application}");
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
ServletWebRequest webRequest = new ServletWebRequest(request, new MockHttpServletResponse());
|
||||
request.setRequestURI("/dev/spam/bar/" + "foo.txt");
|
||||
byte[] resource = this.controller.binary("dev/spam", "bar", webRequest);
|
||||
byte[] resource = this.controller.binary("dev/spam", "bar", null, webRequest);
|
||||
assertThat(new String(resource)).isEqualToIgnoringNewLines("foo: dev_bar/spam");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user