diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java index fc5040bb354a..9ea8f70bfd55 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java @@ -29,6 +29,7 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.http.HttpStatus; +import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import org.springframework.web.context.request.RequestAttributes; @@ -121,10 +122,10 @@ private void addErrorDetails(Map errorAttributes, } } Object message = getAttribute(requestAttributes, "javax.servlet.error.message"); - if ((message != null || errorAttributes.get("message") == null) + if ((!StringUtils.isEmpty(message) || errorAttributes.get("message") == null) && !(error instanceof BindingResult)) { - errorAttributes.put("message", message == null ? "No message available" - : message); + errorAttributes.put("message", + StringUtils.isEmpty(message) ? "No message available" : message); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java index e09a88faa3ee..36fd63a2bbc3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java @@ -73,10 +73,10 @@ public class BasicErrorControllerIntegrationTests { public void testErrorForMachineClient() throws Exception { ResponseEntity entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.port, Map.class); - assertThat(entity.getBody().toString(), endsWith("status=500, " - + "error=Internal Server Error, " - + "exception=java.lang.IllegalStateException, " - + "message=Server Error, " + "path=/}")); + String body = entity.getBody().toString(); + assertThat(body, endsWith("status=500, " + "error=Internal Server Error, " + + "exception=java.lang.IllegalStateException, " + "message=Expected!, " + + "path=/}")); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java index c344d03f0e92..8041898bc642 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java @@ -128,7 +128,8 @@ public void testDirectAccessForBrowserClient() throws Exception { @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented - @Import({ EmbeddedServletContainerAutoConfiguration.class, + @Import({ EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat.class, + EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java index b632fd8b35cf..b934eeb8141d 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java @@ -20,7 +20,9 @@ import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; +import java.lang.reflect.Field; import java.net.URI; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @@ -94,6 +96,7 @@ public String jar(String... args) throws Exception { private Future submitCommand(final T command, String... args) { + clearUrlHandler(); final String[] sources = getSources(args); return Executors.newSingleThreadExecutor().submit(new Callable() { @Override @@ -112,6 +115,21 @@ public T call() throws Exception { }); } + /** + * The TomcatURLStreamHandlerFactory fails if the factory is already set, use + * reflection to reset it. + */ + private void clearUrlHandler() { + try { + Field field = URL.class.getDeclaredField("factory"); + field.setAccessible(true); + field.set(null, null); + } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + } + protected String[] getSources(String... args) { final String[] sources = new String[args.length]; for (int i = 0; i < args.length; i++) { diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 56b1ff118118..eaf38ab9a4b4 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -82,7 +82,7 @@ 1.0.0 1.5.2 2.4.2 - 8.1.15.v20140411 + 9.2.4.v20141103 2.2.0.v201112011158 1.1.6 2.0.5 @@ -101,7 +101,7 @@ 5.1.32 1.1.5.RELEASE 1.1.3.RELEASE - 3.0.1 + 3.1.0 1.7.7 1.13 4.7.2 @@ -127,7 +127,7 @@ 2.1.1.RELEASE 1.2.5 1.3 - 7.0.56 + 8.0.14 1.7 2.0 1.6.3 diff --git a/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java b/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java index 86b29f7b91dc..d076a98dba8b 100644 --- a/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java +++ b/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java @@ -52,12 +52,11 @@ public class WarPackagingTests { private static final Set JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet( Arrays.asList("spring-boot-starter-jetty-", "jetty-util-", "jetty-xml-", - "javax.servlet-", "jetty-continuation-", "jetty-io-", "jetty-http-", + "jetty-schemas-", "javax.servlet-", "jetty-io-", "jetty-http-", "jetty-server-", "jetty-security-", "jetty-servlet-", - "jetty-webapp-", "javax.servlet.jsp-", - "org.apache.jasper.glassfish-", "javax.servlet.jsp.jstl-", - "org.apache.taglibs.standard.glassfish-", "javax.el-", "com.sun.el-", - "org.eclipse.jdt.core-", "jetty-jsp-")); + "jetty-webapp-", "javax.servlet.jsp-2", "javax.servlet.jsp-api-", + "javax.servlet.jsp.jstl-1.2.2", "javax.servlet.jsp.jstl-1.2.0", + "javax.el-", "org.eclipse.jdt.core-", "jetty-jsp-")); private static final String BOOT_VERSION = ManagedDependencies.get() .find("spring-boot").getVersion(); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index 8e228cedf683..ac9826be9249 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -25,11 +25,14 @@ import java.util.Collection; import java.util.List; +import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.handler.ErrorHandler; -import org.eclipse.jetty.server.ssl.SslSocketConnector; import org.eclipse.jetty.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletMapping; @@ -117,10 +120,10 @@ public EmbeddedServletContainer getEmbeddedServletContainer( if (getSsl() != null) { SslContextFactory sslContextFactory = new SslContextFactory(); configureSsl(sslContextFactory, getSsl()); - - SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory); - sslConnector.setPort(port); - server.setConnectors(new Connector[] { sslConnector }); + ServerConnector connector = getSslServerConnectorFactory().getConnector( + server, sslContextFactory); + connector.setPort(port); + server.setConnectors(new Connector[] { connector }); } for (JettyServerCustomizer customizer : getServerCustomizers()) { @@ -130,6 +133,13 @@ public EmbeddedServletContainer getEmbeddedServletContainer( return getJettyEmbeddedServletContainer(server); } + private SslServerConnectorFactory getSslServerConnectorFactory() { + if (ClassUtils.isPresent("org.eclipse.jetty.server.ssl.SslSocketConnector", null)) { + return new Jetty8SslServerConnectorFactory(); + } + return new Jetty9SslServerConnectorFactory(); + } + /** * Configure the SSL connection. * @param factory the Jetty {@link SslContextFactory}. @@ -246,7 +256,7 @@ private void configureDocumentRoot(WebAppContext handler) { handler.setBaseResource(resource); } else { - handler.setBaseResource(Resource.newResource(root)); + handler.setBaseResource(Resource.newResource(root.getCanonicalFile())); } } catch (Exception ex) { @@ -458,4 +468,50 @@ private void addJettyErrorPages(ErrorHandler errorHandler, } } + /** + * Factory to create the SSL {@link ServerConnector}. + */ + private static interface SslServerConnectorFactory { + + ServerConnector getConnector(Server server, SslContextFactory sslContextFactory); + + } + + /** + * {@link SslServerConnectorFactory} for Jetty 9. + */ + private static class Jetty9SslServerConnectorFactory implements + SslServerConnectorFactory { + + @Override + public ServerConnector getConnector(Server server, + SslContextFactory sslContextFactory) { + return new ServerConnector(server, new SslConnectionFactory( + sslContextFactory, HttpVersion.HTTP_1_1.asString()), + new HttpConnectionFactory()); + } + } + + /** + * {@link SslServerConnectorFactory} for Jetty 8. + */ + private static class Jetty8SslServerConnectorFactory implements + SslServerConnectorFactory { + + @Override + public ServerConnector getConnector(Server server, + SslContextFactory sslContextFactory) { + try { + Class connectorClass = Class + .forName("org.eclipse.jetty.server.ssl.SslSocketConnector"); + return (ServerConnector) connectorClass.getConstructor( + SslContextFactory.class).newInstance(sslContextFactory); + } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + } + + } + } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java index 3bccd783d50d..f989eb1cd44a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/SkipPatternJarScanner.java @@ -16,7 +16,6 @@ package org.springframework.boot.context.embedded.tomcat; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; import java.util.LinkedHashSet; @@ -27,6 +26,7 @@ import org.apache.tomcat.JarScanner; import org.apache.tomcat.JarScannerCallback; +import org.apache.tomcat.util.scan.StandardJarScanFilter; import org.apache.tomcat.util.scan.StandardJarScanner; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -45,8 +45,6 @@ class SkipPatternJarScanner extends StandardJarScanner { private static final String JAR_SCAN_FILTER_CLASS = "org.apache.tomcat.JarScanFilter"; - private static final String STANDARD_JAR_SCAN_FILTER_CLASS = "org.apache.tomcat.util.scan.StandardJarScanFilter"; - private final JarScanner jarScanner; private final SkipPattern pattern; @@ -60,34 +58,24 @@ class SkipPatternJarScanner extends StandardJarScanner { private void setPatternToTomcat8SkipFilter(SkipPattern pattern) { if (ClassUtils.isPresent(JAR_SCAN_FILTER_CLASS, null)) { - try { - Class filterClass = Class.forName(JAR_SCAN_FILTER_CLASS); - Method setJarScanner = ReflectionUtils.findMethod( - StandardJarScanner.class, "setJarScanFilter", filterClass); - setJarScanner.invoke(this, createStandardJarScanFilter(pattern)); - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } + new Tomcat8TldSkipSetter(this).setSkipPattern(pattern); } } - private Object createStandardJarScanFilter(SkipPattern pattern) - throws ClassNotFoundException, InstantiationException, - IllegalAccessException, InvocationTargetException { - Class filterClass = Class.forName(STANDARD_JAR_SCAN_FILTER_CLASS); - Method setTldSkipMethod = ReflectionUtils.findMethod(filterClass, "setTldSkip", - String.class); - Object scanner = filterClass.newInstance(); - setTldSkipMethod.invoke(scanner, pattern.asCommaDelimitedString()); - return scanner; - } - - @Override + // For Tomcat 7 compatibility public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set jarsToSkip) { - this.jarScanner.scan(context, classloader, callback, - (jarsToSkip == null ? this.pattern.asSet() : jarsToSkip)); + Method scanMethod = ReflectionUtils.findMethod(this.jarScanner.getClass(), + "scan", ServletContext.class, ClassLoader.class, + JarScannerCallback.class, Set.class); + Assert.notNull(scanMethod, "Unable to find scan method"); + try { + scanMethod.invoke(this.jarScanner, context, classloader, callback, + (jarsToSkip == null ? this.pattern.asSet() : jarsToSkip)); + } + catch (Exception ex) { + throw new IllegalStateException("Tomcat 7 reflection failed", ex); + } } /** @@ -101,6 +89,28 @@ public static void apply(TomcatEmbeddedContext context, String pattern) { context.setJarScanner(scanner); } + /** + * Tomcat 8 specific logic to setup the scanner. + */ + private static class Tomcat8TldSkipSetter { + + private final StandardJarScanner jarScanner; + + public Tomcat8TldSkipSetter(StandardJarScanner jarScanner) { + this.jarScanner = jarScanner; + } + + public void setSkipPattern(SkipPattern pattern) { + StandardJarScanFilter filter = new StandardJarScanFilter(); + filter.setTldSkip(pattern.asCommaDelimitedString()); + this.jarScanner.setJarScanFilter(filter); + } + + } + + /** + * Skip patterns used by Spring Boot + */ private static class SkipPattern { private Set patterns = new LinkedHashSet(); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java index fb5c681f82a5..9cd7c4231b42 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedContext.java @@ -16,8 +16,6 @@ package org.springframework.boot.context.embedded.tomcat; -import java.lang.reflect.Method; - import org.apache.catalina.Container; import org.apache.catalina.core.StandardContext; import org.springframework.util.ClassUtils; @@ -33,9 +31,19 @@ class TomcatEmbeddedContext extends StandardContext { private ServletContextInitializerLifecycleListener starter; + private final boolean overrideLoadOnStart; + + public TomcatEmbeddedContext() { + this.overrideLoadOnStart = ReflectionUtils.findMethod(StandardContext.class, + "loadOnStartup", Container[].class).getReturnType() == boolean.class; + } + @Override public boolean loadOnStartup(Container[] children) { - return true; + if (this.overrideLoadOnStart) { + return true; + } + return super.loadOnStartup(children); } public void deferredLoadOnStartup() { @@ -49,12 +57,13 @@ public void deferredLoadOnStartup() { if (classLoader != null) { existingLoader = ClassUtils.overrideThreadContextClassLoader(classLoader); } - if (ClassUtils.isPresent("org.apache.catalina.deploy.ErrorPage", null)) { + + if (this.overrideLoadOnStart) { + // Earlier versions of Tomcat used a version that returned void. If that + // version is used our overridden loadOnStart method won't have been called + // and the original will have already run. super.loadOnStartup(findChildren()); } - else { - callSuper(this, "loadOnStartup", findChildren(), Container[].class); - } if (existingLoader != null) { ClassUtils.overrideThreadContextClassLoader(existingLoader); } @@ -68,10 +77,4 @@ public ServletContextInitializerLifecycleListener getStarter() { return this.starter; } - private void callSuper(Object target, String name, Object value, Class type) { - Method method = ReflectionUtils.findMethod(target.getClass().getSuperclass(), - name, type); - ReflectionUtils.invokeMethod(method, target, value); - } - } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index d451ca09deac..3d0a599ff665 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -604,15 +604,14 @@ public TomcatErrorPage(ErrorPage errorPage) { private Object createNativePage(ErrorPage errorPage) { Object nativePage = null; try { - if (ClassUtils.isPresent("org.apache.catalina.deploy.ErrorPage", null)) { - nativePage = new org.apache.catalina.deploy.ErrorPage(); + if (ClassUtils.isPresent( + "org.apache.tomcat.util.descriptor.web.ErrorPage", null)) { + nativePage = new org.apache.tomcat.util.descriptor.web.ErrorPage(); } - else { - if (ClassUtils.isPresent( - "org.apache.tomcat.util.descriptor.web.ErrorPage", null)) { - nativePage = BeanUtils.instantiate(ClassUtils.forName( - "org.apache.tomcat.util.descriptor.web.ErrorPage", null)); - } + else if (ClassUtils.isPresent("org.apache.catalina.deploy.ErrorPage", + null)) { + nativePage = BeanUtils.instantiate(ClassUtils.forName( + "org.apache.catalina.deploy.ErrorPage", null)); } } catch (ClassNotFoundException ex) { @@ -627,8 +626,9 @@ private Object createNativePage(ErrorPage errorPage) { public void addToContext(Context context) { Assert.state(this.nativePage != null, "Neither Tomcat 7 nor 8 detected so no native error page exists"); - if (ClassUtils.isPresent("org.apache.catalina.deploy.ErrorPage", null)) { - org.apache.catalina.deploy.ErrorPage errorPage = (org.apache.catalina.deploy.ErrorPage) this.nativePage; + if (ClassUtils.isPresent("org.apache.tomcat.util.descriptor.web.ErrorPage", + null)) { + org.apache.tomcat.util.descriptor.web.ErrorPage errorPage = (org.apache.tomcat.util.descriptor.web.ErrorPage) this.nativePage; errorPage.setLocation(this.location); errorPage.setErrorCode(this.errorCode); errorPage.setExceptionType(this.exceptionType); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java index 2483c452fa95..0c7fe8aa7539 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatResources.java @@ -22,11 +22,12 @@ import java.net.URL; import java.net.URLClassLoader; +import javax.naming.directory.DirContext; import javax.servlet.ServletContext; import org.apache.catalina.Context; +import org.apache.catalina.WebResourceRoot.ResourceSetType; import org.apache.catalina.core.StandardContext; -import org.apache.naming.resources.FileDirContext; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; @@ -104,29 +105,57 @@ public static TomcatResources get(Context context) { */ private static class Tomcat7Resources extends TomcatResources { + private final Method addResourceJarUrlMethod; + public Tomcat7Resources(Context context) { super(context); + this.addResourceJarUrlMethod = ReflectionUtils.findMethod(context.getClass(), + "addResourceJarUrl", URL.class); } @Override protected void addJar(String jar) { + URL url = getJarUlr(jar); + if (url != null) { + try { + this.addResourceJarUrlMethod.invoke(getContext(), url); + } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + } + } + + private URL getJarUlr(String jar) { try { - getContext().addResourceJarUrl(new URL(jar)); + return new URL(jar); } catch (MalformedURLException ex) { - // Ignore? + // Ignore + return null; } } @Override protected void addDir(String dir, URL url) { if (getContext() instanceof ServletContext) { - FileDirContext files = new FileDirContext(); - files.setDocBase(dir); - ((StandardContext) getContext()).addResourcesDirContext(files); + try { + Class fileDirContextClass = Class + .forName("org.apache.naming.resources.FileDirContext"); + Method setDocBaseMethod = ReflectionUtils.findMethod( + fileDirContextClass, "setDocBase", String.class); + Object fileDirContext = fileDirContextClass.newInstance(); + setDocBaseMethod.invoke(fileDirContext, dir); + Method addResourcesDirContextMethod = ReflectionUtils.findMethod( + StandardContext.class, "addResourcesDirContext", + DirContext.class); + addResourcesDirContextMethod.invoke(getContext(), fileDirContext); + } + catch (Exception ex) { + throw new IllegalStateException("Tomcat 7 reflection failed", ex); + } } } - } /** @@ -134,28 +163,8 @@ protected void addDir(String dir, URL url) { */ static class Tomcat8Resources extends TomcatResources { - private Object resources; - - private Method createWebResourceSetMethod; - - private Enum resourceJarEnum; - - @SuppressWarnings({ "rawtypes", "unchecked" }) public Tomcat8Resources(Context context) { super(context); - try { - this.resources = ReflectionUtils.findMethod(context.getClass(), - "getResources").invoke(context); - Class resourceSetType = ClassUtils.resolveClassName( - "org.apache.catalina.WebResourceRoot.ResourceSetType", null); - this.createWebResourceSetMethod = ReflectionUtils.findMethod( - this.resources.getClass(), "createWebResourceSet", - resourceSetType, String.class, URL.class, String.class); - this.resourceJarEnum = Enum.valueOf(resourceSetType, "RESOURCE_JAR"); - } - catch (Exception ex) { - throw new IllegalStateException("Tomcat 8 reflection failed", ex); - } } @Override @@ -178,7 +187,8 @@ private void addResourceSet(String resource) { } URL url = new URL(resource); String path = "/META-INF/resources"; - createWebResourceSet("/", url, path); + getContext().getResources().createWebResourceSet( + ResourceSetType.RESOURCE_JAR, "/", url, path); } catch (Exception ex) { // Ignore (probably not a directory) @@ -189,12 +199,6 @@ private boolean isInsideNestedJar(String dir) { return dir.indexOf("!/") < dir.lastIndexOf("!/"); } - private void createWebResourceSet(String webAppMount, URL url, String path) - throws Exception { - this.createWebResourceSetMethod.invoke(this.resources, this.resourceJarEnum, - webAppMount, url, path); - } - } } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java index e3379af7e740..33b8be6fa85d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java @@ -21,9 +21,10 @@ import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.HandlerWrapper; -import org.eclipse.jetty.server.ssl.SslConnector; import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.WebAppContext; import org.junit.Test; @@ -114,9 +115,11 @@ public void sslCiphersConfiguration() throws Exception { this.container.start(); JettyEmbeddedServletContainer jettyContainer = (JettyEmbeddedServletContainer) this.container; - SslConnector sslConnector = (SslConnector) jettyContainer.getServer() + ServerConnector connector = (ServerConnector) jettyContainer.getServer() .getConnectors()[0]; - assertThat(sslConnector.getSslContextFactory().getIncludeCipherSuites(), + SslConnectionFactory connectionFactory = connector + .getConnectionFactory(SslConnectionFactory.class); + assertThat(connectionFactory.getSslContextFactory().getIncludeCipherSuites(), equalTo(new String[] { "ALPHA", "BRAVO", "CHARLIE" })); }