Skip to content

Commit

Permalink
Issue #5093 Static UrlEncoded
Browse files Browse the repository at this point in the history
Updated UrlEncoded to static only class with no synchronization
  • Loading branch information
gregw committed Jul 29, 2020
1 parent 47d0c35 commit 0aa4b68
Show file tree
Hide file tree
Showing 4 changed files with 387 additions and 491 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.UrlEncoded;
import org.junit.jupiter.api.AfterEach;
Expand Down Expand Up @@ -835,13 +836,13 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
assertEquals(null, request.getPathTranslated());

UrlEncoded query = new UrlEncoded();
query.decode(request.getQueryString());
UrlEncoded.decodeTo(request.getQueryString(), new MultiMap<>(), UrlEncoded.ENCODING);
assertThat(query.getString("do"), is("end"));

// Russian for "selected=Temperature"
UrlEncoded q2 = new UrlEncoded();
q2.decode(query.getString("else"));
String russian = q2.encode();
UrlEncoded.decodeTo(query.getString("else"), new MultiMap<>(), UrlEncoded.ENCODING);
String russian = UrlEncoded.encode(new MultiMap<>(), UrlEncoded.ENCODING, false);
assertThat(russian, is("%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE=%D0%A2%D0%B5%D0%BC%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0"));
assertThat(query.containsKey("test"), is(false));
assertThat(query.containsKey("foreign"), is(false));
Expand Down
Loading

0 comments on commit 0aa4b68

Please sign in to comment.