diff options
author | Thomas Watson | 2019-03-05 20:31:44 +0000 |
---|---|---|
committer | Raymond Auge | 2019-03-05 22:25:38 +0000 |
commit | f8f0c5e1536a1fff5f0c6dcccbd5d77ec9ac6cf3 (patch) | |
tree | 1a38ebf62c16949b575de6b07e8c33b5cd225cbf | |
parent | 775dd74aa404e745a1beac5903cc642782d15115 (diff) | |
download | rt.equinox.bundles-f8f0c5e1536a1fff5f0c6dcccbd5d77ec9ac6cf3.tar.gz rt.equinox.bundles-f8f0c5e1536a1fff5f0c6dcccbd5d77ec9ac6cf3.tar.xz rt.equinox.bundles-f8f0c5e1536a1fff5f0c6dcccbd5d77ec9ac6cf3.zip |
Bug 544145 - Web Services Explorer fails to load correctly with 3.13.0Y20190320-2200Y20190319-2305Y20190316-1220Y20190313-2200Y20190313-0215Y20190308-0715Y20190307-1015Y20190306-2200S4_11_0_RC2R4_11I20190307-0500I20190306-2135I20190306-1800I20190306-0600I20190305-1800
M2
Change-Id: Ica97acc6ad2e8ec564f2ec92dadb2ec07469088c
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
3 files changed, 30 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java index 299c6febb..e820cef83 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java @@ -1969,6 +1969,26 @@ public class ServletTest extends BaseTest { } @Test + public void test_ResourceAliasNormal() throws Exception { + HttpService extendedHttpService = getHttpService(); + + extendedHttpService.registerResources("/testalias", "/org/eclipse/equinox/http/servlet/tests", null); + + String actual = requestAdvisor.request("testalias/resource2.txt"); + Assert.assertEquals("Wrong value.", "test", actual); + } + + @Test + public void test_ResourceAliasSlash() throws Exception { + HttpService extendedHttpService = getHttpService(); + + extendedHttpService.registerResources("/", "/org/eclipse/equinox/http/servlet/tests", null); + + String actual = requestAdvisor.request("resource2.txt"); + Assert.assertEquals("Wrong value.", "test", actual); + } + + @Test public void test_ResourceRangeRequest_Complete() throws Exception { Bundle bundle = installBundle(TEST_BUNDLE_2); ServletContextHelper customSCH = new ServletContextHelper(bundle) { diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/resource2.txt b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/resource2.txt new file mode 100644 index 000000000..30d74d258 --- /dev/null +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/resource2.txt @@ -0,0 +1 @@ +test
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java index f2e3f2b91..ecd7b2c12 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java @@ -771,15 +771,18 @@ public class HttpServiceRuntimeImpl throw new IllegalArgumentException("Name cannot be null"); //$NON-NLS-1$ } String pattern = alias; - if (pattern.startsWith("/*.")) { //$NON-NLS-1$ + if (pattern.startsWith(Const.SLASH_STAR_DOT)) { pattern = pattern.substring(1); } - else if (!pattern.contains("*.") && //$NON-NLS-1$ - !pattern.endsWith(Const.SLASH_STAR) && - !pattern.endsWith(Const.SLASH)) { - pattern += Const.SLASH_STAR; + // need to make sure exact matching aliases are converted to wildcard pattern matches + if (!pattern.endsWith(Const.SLASH_STAR) && !pattern.startsWith(Const.STAR_DOT) && !pattern.contains(Const.SLASH_STAR_DOT)) { + if (pattern.endsWith(Const.SLASH)) { + pattern = pattern + '*'; + } else { + pattern = pattern + Const.SLASH_STAR; + } } - + // check the pattern against the original input ContextController.checkPattern(alias); synchronized (legacyMappings) { |