mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Fix ResourceHttpRequestHandler delegate
Fix ResourceHttpRequestHandler to set the ServletContext following the Spring Framework update for SPR-14851.
This commit is contained in:
parent
cdcc3d2f28
commit
60355e0e11
Notes:
Phillip Webb
2016-11-04 14:30:31 -07:00
Fixes gh-7254
@ -19,6 +19,7 @@ package org.springframework.boot.actuate.endpoint.mvc;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -82,7 +83,8 @@ public class LogFileMvcEndpoint extends AbstractMvcEndpoint {
|
||||
}
|
||||
resource = null;
|
||||
}
|
||||
new Handler(resource).handleRequest(request, response);
|
||||
Handler handler = new Handler(resource, request.getServletContext());
|
||||
handler.handleRequest(request, response);
|
||||
}
|
||||
|
||||
private Resource getLogFileResource() {
|
||||
@ -104,10 +106,11 @@ public class LogFileMvcEndpoint extends AbstractMvcEndpoint {
|
||||
|
||||
private final Resource resource;
|
||||
|
||||
Handler(Resource resource) {
|
||||
Handler(Resource resource, ServletContext servletContext) {
|
||||
this.resource = resource;
|
||||
getLocations().add(resource);
|
||||
try {
|
||||
setServletContext(servletContext);
|
||||
afterPropertiesSet();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user