From 2552f2300bf52bee7160fa4f6195cb042621fb55 Mon Sep 17 00:00:00 2001 From: WalkerWatch Date: Wed, 26 Oct 2016 15:16:17 -0400 Subject: [PATCH 1/5] Updates for upgrading guide. Signed-off-by: WalkerWatch --- .../upgrading/upgrading-9.3-to-9.4.adoc | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/jetty-documentation/src/main/asciidoc/reference/upgrading/upgrading-9.3-to-9.4.adoc b/jetty-documentation/src/main/asciidoc/reference/upgrading/upgrading-9.3-to-9.4.adoc index 0ae8623900b..f0b73c0e280 100644 --- a/jetty-documentation/src/main/asciidoc/reference/upgrading/upgrading-9.3-to-9.4.adoc +++ b/jetty-documentation/src/main/asciidoc/reference/upgrading/upgrading-9.3-to-9.4.adoc @@ -24,14 +24,20 @@ https://wiki.debian.org/LSBInitScripts[LSB tags]. You can safely replace Jetty 9.3's `jetty.sh` with 9.4's. -==== Modules No Longer Available +==== Module Changes in Jetty 9.4 [cols="1,1", options="header"] |=== | 9.3 Module | 9.4 Module -| logging | console-capture +| `logging` | `console-capture` +| `infinispan` | `session-store-infinispan-embedded` or `session-store-infinispan-remote` +| `jdbc-sessions` | `session-store-jdbc` +| `gcloud-memcached-sessions`, `gcloud-session-idmgr` and `gcloud-sessions` | `gcloud`, `gcloud-datastore` and `session-store-gcloud` +| `nosql` | `session-store-mongo` |=== +===== Logging Modules + The module `logging` is no longer available in Jetty 9.4. The logging module structure present in Jetty 9.3 has been replaced with @@ -45,7 +51,7 @@ If you have a Jetty 9.3 installation, and you have both `$jetty.base/modules/logging.mod` and `$jetty.base/etc/jetty-logging.xml`, then this module is local to your `$jetty.base` setup and will be used by Jetty 9.4 as before. -No changes required on your part. +No changes are required for your implementation. If either `$jetty.base/modules/logging.mod` or `$jetty.base/etc/jetty-logging.xml` are missing, then you were relying on those present in `$jetty.home`, @@ -55,7 +61,7 @@ The Jetty 9.3 `logging` module has been renamed to `console-capture` in Jetty 9. You need to open your Jetty 9.3 `start.ini` and replace the references to the `logging` modules with `console-capture`. -For example: +For example, in an existing 9.3 `start.ini` file the module declaration for logging would look like this: .start.ini ---- @@ -63,7 +69,7 @@ For example: jetty.logging.retainDays=7 ---- -should be replaced by: +In 9.4, it should be replaced by: .start.ini ---- @@ -75,3 +81,15 @@ The properties that may be present in your Jetty 9.3's `start.ini`, such as `jetty.logging.retainDays` will still be working in Jetty 9.4, but a warning will be printed at Jetty 9.4 startup, saying to replace them with correspondent `jetty.console-capture.*` properties such as `jetty.console-capture.retainDays`. + +For information on logging modules in the Jetty 9.4 architecture please see the section on link:#configuring-logging-modules[configuring logging modules.] + +===== Session Management + +//TODO - More info. + +Session management received a significant overhaul in Jetty 9.4. Whereas in prior versions of Jetty uses needed to implement individual instances of both `SessionIdManager` and `SessionManager`, now one instance of both handles sessions for the server. + +As part of these changes, modules for individual technologies were re-named to make configuration more transparent. + +For more information, please refer to the documentation on link:#jetty-sessions-architecture[Jetty Session Architecture.] From ebc8983721071c668f5dc58be6a742a726e7ca89 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 26 Oct 2016 14:25:20 -0700 Subject: [PATCH 2/5] Issue #1038 - correcting "file:" and double "//" behavior --- .../jetty/quickstart/AttributeNormalizer.java | 16 ++-- .../AttributeNormalizerPathTest.java | 88 ++++++++----------- .../quickstart/AttributeNormalizerTest.java | 24 ++--- .../eclipse/jetty/quickstart/EnvUtils.java | 76 ++++++++++++++++ 4 files changed, 129 insertions(+), 75 deletions(-) create mode 100644 tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/EnvUtils.java diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java index 1cddeb5711c..7e39636ac40 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java @@ -380,18 +380,20 @@ public class AttributeNormalizer return null; } - // Use war path (if known) - if("WAR".equalsIgnoreCase(property)) - { - return warURI.toASCIIString(); - } - // Use known path attributes for (PathAttribute attr : attributes) { if (attr.key.equalsIgnoreCase(property)) { - return uriSeparators(attr.path.toString()); + String path = uriSeparators(attr.path.toString()); + if (path.endsWith("/")) + { + return path.substring(0, path.length() - 1); + } + else + { + return path; + } } } diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java index 32c94ebcc59..0085537e1ae 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java @@ -18,17 +18,19 @@ package org.eclipse.jetty.quickstart; -import java.io.IOException; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.FileSystems; -import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; import java.util.List; +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.resource.Resource; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -37,65 +39,34 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - @RunWith(Parameterized.class) public class AttributeNormalizerPathTest { @Parameters(name="{0} = {1}") public static List data() { - String[][] tests = { - // Can't test 'WAR' property, as its not a Path (which this testcase works with) - // { "WAR", toSystemPath("http://localhost/resources/webapps/root") }, - { "jetty.home", toSystemPath("/opt/jetty-distro") }, - { "jetty.base", toSystemPath("/opt/jetty-distro/demo.base") }, - { "user.home", toSystemPath("/home/user") }, - { "user.dir", toSystemPath("/etc/init.d") }, + String[][] tests = { + { "WAR", testRoot.toString() }, + { "jetty.home", EnvUtils.toSystemPath("/opt/jetty-distro") }, + { "jetty.base", EnvUtils.toSystemPath("/opt/jetty-distro/demo.base") }, + { "user.home", EnvUtils.toSystemPath("/home/user") }, + { "user.dir", EnvUtils.toSystemPath("/etc/init.d") }, }; return Arrays.asList(tests); } - /** - * As the declared paths in this testcase might be actual paths on the system - * running these tests, the expected paths should be cleaned up to represent - * the actual system paths. - *

- * Eg: on fedora /etc/init.d is a symlink to /etc/rc.d/init.d - */ - public static String toSystemPath(String rawpath) - { - Path path = FileSystems.getDefault().getPath(rawpath); - if (Files.exists(path)) - { - // It exists, resolve it to the real path - try - { - path = path.toRealPath(); - } - catch (IOException e) - { - // something prevented us from resolving to real path, fallback to - // absolute path resolution (not as accurate) - path = path.toAbsolutePath(); - e.printStackTrace(); - } - } - else - { - // File doesn't exist, resolve to absolute path - // We can't rely on File.toCanonicalPath() here - path = path.toAbsolutePath(); - } - return path.toString(); - } - + private static Path testRoot; private static String origJettyBase; private static String origJettyHome; private static String origUserHome; private static String origUserDir; + + static + { + testRoot = MavenTestingUtils.getTargetTestingPath(AttributeNormalizerPathTest.class.getSimpleName()); + FS.ensureEmpty(testRoot); + } @BeforeClass public static void initProperties() @@ -129,15 +100,26 @@ public class AttributeNormalizerPathTest { this.key = key; this.path = AttributeNormalizer.uriSeparators(path); - this.normalizer = new AttributeNormalizer(Resource.newResource("/opt/jetty-distro/demo.base/webapps/root")); + this.normalizer = new AttributeNormalizer(Resource.newResource(testRoot.toFile())); } - + + private void assertExpand(String line, String expected) + { + assertThat("normalizer.expand(\"" + line + "\")", normalizer.expand(line), is(expected)); + } + @Test public void testEqual() { assertThat(normalizer.normalize("file:" + path), is("file:${" + key + "}")); } - + + @Test + public void testExpandEqual() + { + assertExpand("file:${" + key + "}", "file:" + path); + } + @Test public void testEqualsSlash() { @@ -203,6 +185,12 @@ public class AttributeNormalizerPathTest { assertThat(normalizer.normalize("jar:file:" + path + "/file!/file"), is("jar:file:${" + key + "}/file!/file")); } + + @Test + public void testExpandJarFileEquals_FileBangFile() + { + assertExpand("jar:file:${" + key + "}/file!/file", "jar:file:" + path + "/file!/file"); + } @Test public void testJarFileEquals_URIBangFile() throws URISyntaxException diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java index 3fd51fe8129..41fcb38b0fd 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java @@ -41,9 +41,9 @@ public class AttributeNormalizerTest try { - String testJettyHome = AttributeNormalizerPathTest.toSystemPath("/opt/jetty-distro"); - String testJettyBase = AttributeNormalizerPathTest.toSystemPath("/opt/jetty-distro/demo.base"); - String testWar = AttributeNormalizerPathTest.toSystemPath("/opt/jetty-distro/demo.base/webapps/FOO"); + String testJettyHome = EnvUtils.toSystemPath("/opt/jetty-distro"); + String testJettyBase = EnvUtils.toSystemPath("/opt/jetty-distro/demo.base"); + String testWar = EnvUtils.toSystemPath("/opt/jetty-distro/demo.base/webapps/FOO"); System.setProperty("jetty.home", testJettyHome); System.setProperty("jetty.base", testJettyBase); @@ -77,20 +77,8 @@ public class AttributeNormalizerTest } finally { - restoreSystemProperty("jetty.home", oldJettyHome); - restoreSystemProperty("jetty.base", oldJettyBase); - } - } - - private void restoreSystemProperty(String key, String value) - { - if (value == null) - { - System.clearProperty(key); - } - else - { - System.setProperty(key, value); + EnvUtils.restoreSystemProperty("jetty.home", oldJettyHome); + EnvUtils.restoreSystemProperty("jetty.base", oldJettyBase); } } @@ -119,7 +107,7 @@ public class AttributeNormalizerTest // Setup example from windows String javaUserHome = System.getProperty("user.home"); - String realUserHome = AttributeNormalizerPathTest.toSystemPath(javaUserHome); + String realUserHome = EnvUtils.toSystemPath(javaUserHome); String userHome = AttributeNormalizer.uriSeparators(realUserHome); String path = "jar:file:" + userHome + "/.m2/repository/something/somejar.jar!/META-INF/some.tld"; diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/EnvUtils.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/EnvUtils.java new file mode 100644 index 00000000000..7bc51932756 --- /dev/null +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/EnvUtils.java @@ -0,0 +1,76 @@ +// +// ======================================================================== +// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.quickstart; + +import java.io.IOException; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; + +/** + * Common utility methods for quickstart tests + */ +public class EnvUtils +{ + /** + * As the declared paths in this testcase might be actual paths on the system + * running these tests, the expected paths should be cleaned up to represent + * the actual system paths. + *

+ * Eg: on fedora /etc/init.d is a symlink to /etc/rc.d/init.d + */ + public static String toSystemPath(String rawpath) + { + Path path = FileSystems.getDefault().getPath(rawpath); + if (Files.exists(path)) + { + // It exists, resolve it to the real path + try + { + path = path.toRealPath(); + } + catch (IOException e) + { + // something prevented us from resolving to real path, fallback to + // absolute path resolution (not as accurate) + path = path.toAbsolutePath(); + e.printStackTrace(); + } + } + else + { + // File doesn't exist, resolve to absolute path + // We can't rely on File.toCanonicalPath() here + path = path.toAbsolutePath(); + } + return path.toString(); + } + + public static void restoreSystemProperty(String key, String value) + { + if (value == null) + { + System.clearProperty(key); + } + else + { + System.setProperty(key, value); + } + } +} From ca5e075ba0b4d7291e72d3f5e5071ecb137d6a6e Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 26 Oct 2016 15:30:34 -0700 Subject: [PATCH 3/5] Issue #1038 - treating ${WAR} as a URI always, not a Path + Still needs testing on MS Windows --- .../jetty/quickstart/AttributeNormalizer.java | 59 ++++++++++++++----- .../AttributeNormalizerPathTest.java | 8 ++- .../quickstart/AttributeNormalizerTest.java | 30 +++++++--- 3 files changed, 69 insertions(+), 28 deletions(-) diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java index 7e39636ac40..8292f30e193 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java @@ -53,20 +53,21 @@ public class AttributeNormalizer { private static final Logger LOG = Log.getLogger(AttributeNormalizer.class); private static final Pattern __propertyPattern = Pattern.compile("(?<=[^$]|^)\\$\\{([^}]*)\\}"); - + private static class PathAttribute { public final Path path; public final String key; + private boolean isUriBased = false; private int weight = -1; - + public PathAttribute(String key, Path path) throws IOException { this.key = key; this.path = toCanonicalPath(path); // TODO: Don't allow non-directory paths? (but what if the path doesn't exist?) } - + public PathAttribute(String key, String systemPropertyKey) throws IOException { this(key, toCanonicalPath(System.getProperty(systemPropertyKey))); @@ -93,7 +94,41 @@ public class AttributeNormalizer } return path.toAbsolutePath(); } - + + public String toUri() + { + if (isUriBased) + { + // Return "{KEY}" -> "" (including scheme) + return path.toUri().toASCIIString(); + } + else + { + // Return "{KEY}" -> "" (excluding scheme) + return path.toUri().getSchemeSpecificPart(); + } + } + + public String getNormalizedScheme() + { + if (isUriBased) + { + // If we are treating the {KEY} -> "" (scheme is expanded) + return ""; + } + else + { + // If we are treating the {KEY} -> "" (scheme is not part of KEY) + return "file:"; + } + } + + public PathAttribute treatAsUri() + { + this.isUriBased = true; + return this; + } + public PathAttribute weight(int newweight) { this.weight = newweight; @@ -195,7 +230,7 @@ public class AttributeNormalizer attributes.add(new PathAttribute("user.dir", "user.dir").weight(6)); if(warURI != null && warURI.getScheme().equals("file")) { - attributes.add(new PathAttribute("WAR", new File(warURI).toPath().toAbsolutePath()).weight(10)); + attributes.add(new PathAttribute("WAR", new File(warURI).toPath().toAbsolutePath()).treatAsUri().weight(10)); } Collections.sort(attributes, new PathAttributeComparator()); @@ -245,7 +280,7 @@ public class AttributeNormalizer } else if ("file".equalsIgnoreCase(uri.getScheme())) { - return "file:" + normalizePath(new File(uri.getRawSchemeSpecificPart()).toPath()); + return normalizePath(new File(uri.getRawSchemeSpecificPart()).toPath()); } else { @@ -284,7 +319,7 @@ public class AttributeNormalizer { if (path.startsWith(attr.path) || path.equals(attr.path) || Files.isSameFile(path,attr.path)) { - return uriSeparators(URIUtil.addPaths("${" + attr.key + "}",attr.path.relativize(path).toString())); + return attr.getNormalizedScheme() + uriSeparators(URIUtil.addPaths("${" + attr.key + "}", attr.path.relativize(path).toString())); } } catch (IOException ignore) @@ -385,15 +420,7 @@ public class AttributeNormalizer { if (attr.key.equalsIgnoreCase(property)) { - String path = uriSeparators(attr.path.toString()); - if (path.endsWith("/")) - { - return path.substring(0, path.length() - 1); - } - else - { - return path; - } + return attr.toUri(); } } diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java index 0085537e1ae..61064ef3816 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerPathTest.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.quickstart; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; +import java.io.File; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; @@ -46,7 +47,6 @@ public class AttributeNormalizerPathTest public static List data() { String[][] tests = { - { "WAR", testRoot.toString() }, { "jetty.home", EnvUtils.toSystemPath("/opt/jetty-distro") }, { "jetty.base", EnvUtils.toSystemPath("/opt/jetty-distro/demo.base") }, { "user.home", EnvUtils.toSystemPath("/home/user") }, @@ -117,7 +117,8 @@ public class AttributeNormalizerPathTest @Test public void testExpandEqual() { - assertExpand("file:${" + key + "}", "file:" + path); + String expectedPath = new File(path).toPath().toUri().getRawSchemeSpecificPart(); + assertExpand("file:${" + key + "}", "file:" + expectedPath); } @Test @@ -189,7 +190,8 @@ public class AttributeNormalizerPathTest @Test public void testExpandJarFileEquals_FileBangFile() { - assertExpand("jar:file:${" + key + "}/file!/file", "jar:file:" + path + "/file!/file"); + String expectedPath = new File(path).toPath().toUri().getRawSchemeSpecificPart(); + assertExpand("jar:file:${" + key + "}/file!/file", "jar:file:" + expectedPath + "/file!/file"); } @Test diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java index 41fcb38b0fd..0d8ccb9d69e 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java @@ -28,6 +28,7 @@ import java.io.File; import java.net.MalformedURLException; import java.net.URI; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.resource.Resource; import org.junit.Test; @@ -60,12 +61,12 @@ public class AttributeNormalizerTest // Normalize as URI result = normalizer.normalize(testWarURI); - assertThat(result, is("file:${WAR}")); + assertThat(result, is("${WAR}")); // Normalize deep path as File File testWarDeep = new File(new File(testWar), "deep/ref").getAbsoluteFile(); result = normalizer.normalize(testWarDeep); - assertThat(result, is("file:${WAR}/deep/ref")); + assertThat(result, is("${WAR}/deep/ref")); // Normalize deep path as String result = normalizer.normalize(testWarDeep.toString()); @@ -73,7 +74,7 @@ public class AttributeNormalizerTest // Normalize deep path as URI result = normalizer.normalize(testWarDeep.toURI()); - assertThat(result, is("file:${WAR}/deep/ref")); + assertThat(result, is("${WAR}/deep/ref")); } finally { @@ -83,18 +84,29 @@ public class AttributeNormalizerTest } @Test - public void testNormalizeWAR() throws MalformedURLException + public void testNormalizeExpandWAR() throws MalformedURLException { - String webref = "http://localhost/resource/webapps/root"; + String webref = MavenTestingUtils.getTargetDir().getAbsolutePath() + "/bogus.war"; Resource webresource = Resource.newResource(webref); AttributeNormalizer normalizer = new AttributeNormalizer(webresource); String result = null; - result = normalizer.normalize(URI.create(webref)); - assertThat(result, is("${WAR}")); + File webrefFile = new File(webref); + URI uri = webrefFile.toURI(); + // As normal URI ref + result = normalizer.normalize(uri); + assertThat("normalize(" + uri + ")", result, is("${WAR}")); - result = normalizer.normalize(URI.create(webref + "/deep/ref")); - assertThat(result, is("${WAR}/deep/ref")); + // as jar internal resource reference + uri = URI.create("jar:" + webrefFile.toURI().toASCIIString() + "!/deep/ref"); + result = normalizer.normalize(uri); + assertThat("normalize(" + uri + ")", result, is("jar:${WAR}!/deep/ref")); + + // as jar internal resource reference + String line = "jar:${WAR}!/other/file"; + result = normalizer.expand(line); + uri = URI.create("jar:" + webrefFile.toPath().toUri().toASCIIString() + "!/other/file"); + assertThat("expand(\"" + line + "\")", URI.create(result), is(uri)); } @Test From 7256d75e9cb3f6a641a1e67e969607723d5f197a Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 26 Oct 2016 16:09:12 -0700 Subject: [PATCH 4/5] Issue #1038 - fixes for MS Windows --- .../jetty/quickstart/AttributeNormalizer.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java index 8292f30e193..45256037322 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/AttributeNormalizer.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.quickstart; import java.io.File; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.FileSystems; import java.nio.file.Files; @@ -250,6 +251,12 @@ public class AttributeNormalizer } } + /** + * Normalize a URI, URL, or File reference by replacing known attributes with ${key} attributes. + * + * @param o the object to normalize into a string + * @return the string representation of the object, with expansion keys. + */ public String normalize(Object o) { try @@ -265,9 +272,23 @@ public class AttributeNormalizer else { String s = o.toString(); - uri = new URI(s); - if (uri.getScheme() == null) + try + { + uri = new URI(s); + if (uri.getScheme() == null) + { + // Unknown scheme? not relevant to normalize + return s; + } + } + catch(URISyntaxException e) + { + // This path occurs for many reasons, but most common is when this + // is executed on MS Windows, on a string like "D:\jetty" + // and the new URI() fails for + // java.net.URISyntaxException: Illegal character in opaque part at index 2: D:\jetty return s; + } } if ("jar".equalsIgnoreCase(uri.getScheme())) @@ -310,6 +331,8 @@ public class AttributeNormalizer public String normalizePath(Path path) { + String uriPath = path.toUri().getSchemeSpecificPart(); + for (PathAttribute attr : attributes) { if (attr.path == null) From dadb86c831855f9918051868756dc453f1c78115 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 27 Oct 2016 10:35:49 +1100 Subject: [PATCH 5/5] Issue #1032 Make apache-jsp jar artifact without META-INF/services juli log --- apache-jsp/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apache-jsp/pom.xml b/apache-jsp/pom.xml index cc76dfc7edd..ed59d4d4a5d 100644 --- a/apache-jsp/pom.xml +++ b/apache-jsp/pom.xml @@ -46,6 +46,18 @@ test-jar + + nolog-jar + + jar + + + nolog + + META-INF/services/org.apache.juli.logging.Log + + +