Merge remote-tracking branch 'springsource/1.2.x'
This commit is contained in:
@@ -95,6 +95,10 @@ public abstract class AbstractEmbeddedServletContainerFactory
|
||||
return null;
|
||||
}
|
||||
|
||||
private File getWarFileDocumentRoot() {
|
||||
return getArchiveFileDocumentRoot(".war");
|
||||
}
|
||||
|
||||
private File getArchiveFileDocumentRoot(String extension) {
|
||||
File file = getCodeSourceArchive();
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
@@ -107,10 +111,6 @@ public abstract class AbstractEmbeddedServletContainerFactory
|
||||
return null;
|
||||
}
|
||||
|
||||
private File getWarFileDocumentRoot() {
|
||||
return getArchiveFileDocumentRoot(".war");
|
||||
}
|
||||
|
||||
private File getCommonDocumentRoot() {
|
||||
for (String commonDocRoot : COMMON_DOC_ROOTS) {
|
||||
File root = new File(commonDocRoot);
|
||||
|
||||
@@ -64,7 +64,6 @@ import io.undertow.server.HttpHandler;
|
||||
import io.undertow.server.handlers.accesslog.AccessLogHandler;
|
||||
import io.undertow.server.handlers.accesslog.AccessLogReceiver;
|
||||
import io.undertow.server.handlers.accesslog.DefaultAccessLogReceiver;
|
||||
import io.undertow.server.handlers.resource.ClassPathResourceManager;
|
||||
import io.undertow.server.handlers.resource.FileResourceManager;
|
||||
import io.undertow.server.handlers.resource.Resource;
|
||||
import io.undertow.server.handlers.resource.ResourceChangeListener;
|
||||
@@ -372,10 +371,12 @@ public class UndertowEmbeddedServletContainerFactory
|
||||
|
||||
private void configureAccessLog(DeploymentInfo deploymentInfo) {
|
||||
deploymentInfo.addInitialHandlerChainWrapper(new HandlerWrapper() {
|
||||
|
||||
@Override
|
||||
public HttpHandler wrap(HttpHandler handler) {
|
||||
return createAccessLogHandler(handler);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -433,10 +434,7 @@ public class UndertowEmbeddedServletContainerFactory
|
||||
if (root != null && root.isFile()) {
|
||||
return new JarResourcemanager(root);
|
||||
}
|
||||
if (this.resourceLoader != null) {
|
||||
return new ClassPathResourceManager(this.resourceLoader.getClassLoader(), "");
|
||||
}
|
||||
return new ClassPathResourceManager(getClass().getClassLoader(), "");
|
||||
return ResourceManager.EMPTY_RESOURCE_MANAGER;
|
||||
}
|
||||
|
||||
private void configureErrorPages(DeploymentInfo servletBuilder) {
|
||||
|
||||
@@ -513,6 +513,17 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
|
||||
assertThat(getJspServlet(), is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cannotReadClassPathFiles() throws Exception {
|
||||
AbstractEmbeddedServletContainerFactory factory = getFactory();
|
||||
this.container = factory
|
||||
.getEmbeddedServletContainer(exampleServletRegistration());
|
||||
this.container.start();
|
||||
ClientHttpResponse response = getClientResponse(
|
||||
getLocalUrl("/org/springframework/boot/SpringApplication.class"));
|
||||
assertThat(response.getStatusCode(), equalTo(HttpStatus.NOT_FOUND));
|
||||
}
|
||||
|
||||
private Ssl getSsl(ClientAuth clientAuth, String keyPassword, String keyStore) {
|
||||
return getSsl(clientAuth, keyPassword, keyStore, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user