Prevent erroneous "empty locations" log warnings

Update our `ResourceHttpRequestHandler` subclass so that the following
warning is no longer displayed:

  "Locations list is empty. No resources will be served unless a
  custom ResourceResolver is configured as an alternative to
  PathResourceResolver."

Fixes gh-6791
This commit is contained in:
Phillip Webb 2016-09-09 13:19:58 -07:00
parent ca2b97b915
commit 3570f7730a
1 changed files with 6 additions and 0 deletions

View File

@ -106,6 +106,7 @@ public class LogFileMvcEndpoint extends AbstractMvcEndpoint {
Handler(Resource resource) { Handler(Resource resource) {
this.resource = resource; this.resource = resource;
getLocations().add(resource);
try { try {
afterPropertiesSet(); afterPropertiesSet();
} }
@ -114,6 +115,11 @@ public class LogFileMvcEndpoint extends AbstractMvcEndpoint {
} }
} }
@Override
protected void initAllowedLocations() {
this.getLocations().clear();
}
@Override @Override
protected Resource getResource(HttpServletRequest request) throws IOException { protected Resource getResource(HttpServletRequest request) throws IOException {
return this.resource; return this.resource;