From 355f4ed7f3252d312f1c95fe3ca1d0c684e15491 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 30 May 2017 12:16:10 -0700 Subject: [PATCH 1/5] Removing redundant new URI --- .../main/java/org/eclipse/jetty/websocket/api/util/WSURI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/WSURI.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/WSURI.java index 664082185c0..902604bd6b0 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/WSURI.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/util/WSURI.java @@ -120,7 +120,7 @@ public final class WSURI if ("ws".equalsIgnoreCase(httpScheme) || "wss".equalsIgnoreCase(httpScheme)) { // keep as-is - return new URI(inputUri.toString()); + return inputUri; } if ("http".equalsIgnoreCase(httpScheme)) From 5e63c4db6235520bcf94e96e5c74bbd559195b21 Mon Sep 17 00:00:00 2001 From: Bernhard Haumacher Date: Tue, 30 May 2017 21:51:31 +0200 Subject: [PATCH 2/5] Fixed determining mime type of `PathResource` based on its file name. (#1532) The result of `toString()` is expected to be the path name of a Resource. This is used for determining the mime type based on the file name extension in `org.eclipse.jetty.server.ResourceCache.Content`. Without a custom `toString()` implementation, no mime type can be determined for a resource. This problem does no longer exist in current Jetty, since `PathResource` has vanished. --- .../org/eclipse/jetty/util/resource/PathResource.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java index b68e02cf118..446585b4f4b 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java @@ -201,6 +201,14 @@ public class PathResource extends Resource return path.toAbsolutePath().toString(); } + @Override + public String toString() { + // Note: The org.eclipse.jetty.server.ResourceCache.Content uses #toString() instead of + // #getName() for determining the file name for mime type resolution based on the file name + // extension. + return _path.toString(); + } + @Override public ReadableByteChannel getReadableByteChannel() throws IOException { From ce67192399acfecbcfdd4b108c98d601531b3968 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 30 May 2017 22:13:25 +0200 Subject: [PATCH 3/5] Fixed determining mime type of `PathResource` based on its file name. (#1532) --- .../org/eclipse/jetty/util/resource/PathResource.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java index 446585b4f4b..4c6d2d7d9ac 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java @@ -201,13 +201,10 @@ public class PathResource extends Resource return path.toAbsolutePath().toString(); } - @Override - public String toString() { - // Note: The org.eclipse.jetty.server.ResourceCache.Content uses #toString() instead of - // #getName() for determining the file name for mime type resolution based on the file name - // extension. - return _path.toString(); - } + @Override + public String toString() { + return path.toString(); + } @Override public ReadableByteChannel getReadableByteChannel() throws IOException From d42ff37e572b8dd364b395040efffd14543b1811 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 30 May 2017 13:13:28 -0700 Subject: [PATCH 4/5] Fixing compile error --- .../main/java/org/eclipse/jetty/util/resource/PathResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java index 446585b4f4b..8837f9d241d 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java @@ -206,7 +206,7 @@ public class PathResource extends Resource // Note: The org.eclipse.jetty.server.ResourceCache.Content uses #toString() instead of // #getName() for determining the file name for mime type resolution based on the file name // extension. - return _path.toString(); + return path.toString(); } @Override From 2b93c4ecd9a7d3ad71fe2471eb5512246d671118 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 30 May 2017 13:31:09 -0700 Subject: [PATCH 5/5] Fixing PathResource.toString() duplicate --- .../java/org/eclipse/jetty/util/resource/PathResource.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java index e1a979a439e..968847a8bc0 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java @@ -404,11 +404,6 @@ public class PathResource extends Resource return path.toAbsolutePath().toString(); } - @Override - public String toString() { - return path.toString(); - } - @Override public ReadableByteChannel getReadableByteChannel() throws IOException {