Encapsulate choice of URI encoding within RequestPath

Currently the URI path is always treated as UTF-8 so we can eliminate
the encoding parameter from RequestPath#parse.
This commit is contained in:
Rossen Stoyanchev
2017-07-10 14:55:01 +02:00
parent 122ee3096c
commit 9f7d57f933
8 changed files with 17 additions and 22 deletions

View File

@@ -19,7 +19,6 @@ import java.net.URI;
import org.junit.Test;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
/**
@@ -54,7 +53,7 @@ public class DefaultRequestPathTests {
private void testRequestPath(String fullPath, String contextPath, String pathWithinApplication) {
URI uri = URI.create("http://localhost:8080" + fullPath);
RequestPath requestPath = new DefaultRequestPath(uri, contextPath, UTF_8);
RequestPath requestPath = RequestPath.parse(uri, contextPath);
assertEquals(contextPath.equals("/") ? "" : contextPath, requestPath.contextPath().value());
assertEquals(pathWithinApplication, requestPath.pathWithinApplication().value());