Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x
This commit is contained in:
commit
401ca3800e
|
@ -135,7 +135,7 @@ public class RegexPathSpec extends AbstractPathSpec
|
|||
Matcher matcher = getMatcher(path);
|
||||
if (matcher.matches())
|
||||
{
|
||||
if (matcher.groupCount() >= 1)
|
||||
if (_group == PathSpecGroup.PREFIX_GLOB && matcher.groupCount() >= 1)
|
||||
{
|
||||
int idx = matcher.start(1);
|
||||
if (idx > 0)
|
||||
|
|
|
@ -345,7 +345,7 @@ public class ServletPathSpec extends AbstractPathSpec
|
|||
case PREFIX_GLOB:
|
||||
if (path.length() == (_specLength - 2))
|
||||
return null;
|
||||
return path.substring(_specLength - 2);
|
||||
return _specLength == 2 ? path : path.substring(_specLength - 2);
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
|
|
@ -353,7 +353,7 @@ public class UriTemplatePathSpec extends AbstractPathSpec
|
|||
Matcher matcher = getMatcher(path);
|
||||
if (matcher.matches())
|
||||
{
|
||||
if (matcher.groupCount() >= 1)
|
||||
if (_group == PathSpecGroup.PREFIX_GLOB && matcher.groupCount() >= 1)
|
||||
{
|
||||
int idx = matcher.start(1);
|
||||
if (idx > 0)
|
||||
|
|
|
@ -19,7 +19,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class RegexPathSpecTest
|
||||
{
|
||||
|
@ -71,6 +73,20 @@ public class RegexPathSpecTest
|
|||
assertNotMatches(spec, "/rest/list");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPathInfo()
|
||||
{
|
||||
RegexPathSpec spec = new RegexPathSpec("^/test(/.*)?$");
|
||||
assertTrue(spec.matches("/test/info"));
|
||||
assertThat(spec.getPathMatch("/test/info"), equalTo("/test"));
|
||||
assertThat(spec.getPathInfo("/test/info"), equalTo("/info"));
|
||||
|
||||
spec = new RegexPathSpec("^/[Tt]est(/.*)?$");
|
||||
assertTrue(spec.matches("/test/info"));
|
||||
assertThat(spec.getPathMatch("/test/info"), equalTo("/test/info"));
|
||||
assertThat(spec.getPathInfo("/test/info"), nullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMiddleSpecNoGrouping()
|
||||
{
|
||||
|
|
|
@ -22,7 +22,9 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Tests for URI Template Path Specs
|
||||
|
@ -142,6 +144,20 @@ public class UriTemplatePathSpecTest
|
|||
assertEquals("b", mapped.get("var"), "Spec.pathParams[var]");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPathInfo()
|
||||
{
|
||||
UriTemplatePathSpec spec = new UriTemplatePathSpec("/test/{var}");
|
||||
assertTrue(spec.matches("/test/info"));
|
||||
assertThat(spec.getPathMatch("/test/info"), equalTo("/test"));
|
||||
assertThat(spec.getPathInfo("/test/info"), equalTo("info"));
|
||||
|
||||
spec = new UriTemplatePathSpec("/{x}/test/{y}");
|
||||
assertTrue(spec.matches("/try/test/info"));
|
||||
assertThat(spec.getPathMatch("/try/test/info"), equalTo("/try/test/info"));
|
||||
assertThat(spec.getPathInfo("/try/test/info"), nullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneVarPathSpec()
|
||||
{
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -29,7 +29,7 @@
|
|||
<apache.httpcore.version>4.4.15</apache.httpcore.version>
|
||||
<asciidoctorj-diagram.version>2.2.1</asciidoctorj-diagram.version>
|
||||
<asciidoctorj.version>2.5.3</asciidoctorj.version>
|
||||
<asm.version>9.2</asm.version>
|
||||
<asm.version>9.3</asm.version>
|
||||
<awaitility.version>4.2.0</awaitility.version>
|
||||
<bndlib.version>5.3.0</bndlib.version>
|
||||
<build-support.version>1.5</build-support.version>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<disruptor.version>3.4.2</disruptor.version>
|
||||
<felix.version>7.0.3</felix.version>
|
||||
<findbugs.jsr305.version>3.0.2</findbugs.jsr305.version>
|
||||
<google.errorprone.version>2.11.0</google.errorprone.version>
|
||||
<google.errorprone.version>2.12.0</google.errorprone.version>
|
||||
<grpc.version>1.45.1</grpc.version>
|
||||
<gson.version>2.9.0</gson.version>
|
||||
<guava.version>31.1-jre</guava.version>
|
||||
|
@ -139,7 +139,7 @@
|
|||
<maven.antrun.plugin.version>3.0.0</maven.antrun.plugin.version>
|
||||
<maven.assembly.plugin.version>3.3.0</maven.assembly.plugin.version>
|
||||
<maven.bundle.plugin.version>5.1.4</maven.bundle.plugin.version>
|
||||
<maven.clean.plugin.version>3.1.0</maven.clean.plugin.version>
|
||||
<maven.clean.plugin.version>3.2.0</maven.clean.plugin.version>
|
||||
<maven.checkstyle.plugin.version>3.1.2</maven.checkstyle.plugin.version>
|
||||
<maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version>
|
||||
<maven.dependency.plugin.version>3.3.0</maven.dependency.plugin.version>
|
||||
|
|
Loading…
Reference in New Issue