-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added test for Regex mapping for Servlet #7614
Conversation
@joakime not specifically. I had observed recent client conversation about regex matching for servlets and knew that we had regex capability in our matcher. So I just wanted to test what would be involved to use that capability and it turns out that with a simple change to So this PR really is just a thought bubble for consideration.... but it does indicate that a very trivial change with zero risk may enable some extra behaviors. |
…xtHandler + needed to open up ServletHandler to allow regex mappings Signed-off-by: Greg Wilkins <[email protected]> Signed-off-by: Joakim Erdfelt <[email protected]>
9af9a28
to
1dc3b93
Compare
@gregw I updated this PR and cleaned up the testcases. |
@joakime good to merge! |
@joakime I'm not sure tagging PRs with merge-12-needed is the right thing to do, as the PRs get closed. We need to tag the associated issue, which can be left open. |
The PR contains the commits and eventual merge commit, those are what we want to ensure make it forward to jetty 12. |
@joakime I'm back porting this to 9.4, which doesn't have the Unfortunately these methods are not symmetric, and I'm wondering if you know why? @Test
public void testMiddleSpecPaths()
{
RegexPathSpec spec = new RegexPathSpec("^/[Tt]est(/.*)?$");
assertTrue(spec.matches("/test/info"));
assertThat(spec.getPathMatch("/test/info"), equalTo("/test"));
assertThat(spec.getPathInfo("/test/info"), equalTo("/info"));
} But it fails because the pathinfo returned is null??? I would expect either If you look at the implementations, they are not symmetric: Do you have any idea why it is like this? What might I break if I fix this? |
The pattern If you want case insensitive, then we should perhaps open up regex flags to the |
@joakime I agree that it is a middle glob pattern. My issue is that the pathMatch and pathInfo are not implemented the same way. PathInfo tests for PREFIX, but pathMatch only cares that there are match groups. |
…xtHandler (#7614) Added protected method to ServletHandler to allow other servlet mappings (eg regex) in embedded/extended usage Signed-off-by: Greg Wilkins <[email protected]> Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Greg Wilkins [email protected]