use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method testQueryParamEncoded2.
@Test
public void testQueryParamEncoded2() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "{param}");
Assert.assertEquals("http://localhost:8080/path?query=%25dummy23", uriBuilder.build("%dummy23").toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method resolveTemplateWithoutEncodedTest.
@Test
public void resolveTemplateWithoutEncodedTest() {
final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path("{b}").path("{c}").queryParam("query", "{q}");
uriBuilder.resolveTemplate("a", "x/y/z%3F%20");
uriBuilder.resolveTemplate("q", "q?%20%26");
uriBuilder.resolveTemplate("c", "paramc1/paramc2");
final Map<String, Object> m = new HashMap<String, Object>();
m.put("a", "ignored-a");
m.put("b", "param-b/aaa");
m.put("q", "ignored-q");
Assert.assertEquals("http://localhost:8080/x%2Fy%2Fz%253F%2520/param-b%2Faaa/paramc1%2Fparamc2?query=q%3F%2520%2526", uriBuilder.buildFromMap(m).toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method testQueryParamEncoded.
@Test
public void testQueryParamEncoded() {
final UriBuilder uriBuilder = UriBuilder.fromUri("http://localhost:8080/path");
uriBuilder.queryParam("query", "%dummy23");
Assert.assertEquals("http://localhost:8080/path?query=%25dummy23", uriBuilder.build().toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method testUriBuilderShouldLeaveRelativePathRelative.
// Reproducer for JERSEY-2753
@Test
public void testUriBuilderShouldLeaveRelativePathRelative() {
final UriBuilder builder = JerseyUriBuilder.fromPath("");
builder.scheme("http");
builder.replacePath("path");
assertEquals("http:path", builder.build().toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method resolveTemplatesFromEncodedTest.
@Test
public void resolveTemplatesFromEncodedTest() {
final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path("{b}").path("{c}").queryParam("query", "{q}");
final Map<String, Object> resolveMap = new HashMap<String, Object>();
resolveMap.put("a", "x/y/z%3F%20");
resolveMap.put("q", "q?%20%26");
resolveMap.put("c", "paramc1/paramc2");
uriBuilder.resolveTemplatesFromEncoded(resolveMap);
final Map<String, Object> buildMap = new HashMap<String, Object>();
buildMap.put("b", "param-b/aaa");
Assert.assertEquals("http://localhost:8080/x/y/z%3F%20/param-b/aaa/paramc1/paramc2?query=q%3F%20%26", uriBuilder.buildFromEncodedMap(buildMap).toString());
}
Aggregations