Merge branch 'jetty-9.4.x' into jetty-9.4.x-5605-wakeup-blocked-threads

This commit is contained in:
gregw 2021-02-17 10:52:24 +01:00
commit 83496141a6
2 changed files with 5 additions and 3 deletions

View File

@ -90,13 +90,15 @@ public class RewritePatternRule extends PatternRule implements Rule.ApplyURI
@Override
public void applyURI(Request request, String oldURI, String newURI) throws IOException
{
String queryString = request.getQueryString();
if (_query == null)
{
request.setURIPathQuery(newURI);
if (queryString != null)
request.setQueryString(queryString);
}
else
{
String queryString = request.getQueryString();
if (queryString != null)
queryString = queryString + "&" + _query;
else

View File

@ -29,7 +29,7 @@ import static org.hamcrest.Matchers.is;
public class RewritePatternRuleTest extends AbstractRuleTestCase
{
// TODO: Parameterize
private String[][] _tests =
private final String[][] _tests =
{
{"/foo/bar", "/", "/replace"},
{"/foo/bar", "/*", "/replace/foo/bar"},
@ -98,8 +98,8 @@ public class RewritePatternRuleTest extends AbstractRuleTestCase
assertThat("result matches expected", result, is(replacement));
rewritePatternRule.applyURI(_request, null, result);
assertThat("queryString matches expected", _request.getQueryString(), is(queryString));
assertThat("request URI matches expected", _request.getRequestURI(), is(replacement));
assertThat("queryString matches expected", _request.getQueryString(), is(queryString));
}
@Test