Skip to content

Commit 2c3dca5

Browse files
committed
fixed jetty9 MalformedURLException for Jar files
1 parent c0d5ad0 commit 2c3dca5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
4141
import org.eclipse.jetty.servlet.ServletHolder;
4242
import org.eclipse.jetty.servlet.ServletMapping;
43+
import org.eclipse.jetty.util.resource.JarResource;
4344
import org.eclipse.jetty.util.resource.Resource;
4445
import org.eclipse.jetty.util.ssl.SslContextFactory;
4546
import org.eclipse.jetty.webapp.AbstractConfiguration;
@@ -259,7 +260,7 @@ private void configureDocumentRoot(WebAppContext handler) {
259260
if (root != null) {
260261
try {
261262
if (!root.isDirectory()) {
262-
Resource resource = Resource.newResource("jar:" + root.toURI() + "!");
263+
Resource resource = JarResource.newJarResource(Resource.newResource(root));
263264
handler.setBaseResource(resource);
264265
}
265266
else {
@@ -301,7 +302,7 @@ protected final void addJspServlet(WebAppContext context) {
301302
context.getServletHandler().addServlet(holder);
302303
ServletMapping mapping = new ServletMapping();
303304
mapping.setServletName("jsp");
304-
mapping.setPathSpecs(new String[] { "*.jsp", "*.jspx" });
305+
mapping.setPathSpecs(new String[]{"*.jsp", "*.jspx"});
305306
context.getServletHandler().addServletMapping(mapping);
306307
}
307308

0 commit comments

Comments
 (0)