Package javax.ws.rs.core

Examples of javax.ws.rs.core.UriBuilder.buildFromEncodedMap()


        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/y/z%3F%20/param-b/aaa/paramc1%2Fparamc2?query=q?%20%26",
                uriBuilder.buildFromEncodedMap(m).toString());
    }

    @Test
    public void resolveTemplateWithoutEncodedTest() {
        final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path
View Full Code Here


        resolveMap.put("c", "paramc1/paramc2");
        uriBuilder.resolveTemplatesFromEncoded(resolveMap);
        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?%20%26",
                uriBuilder.buildFromEncodedMap(buildMap).toString());
    }

    @Test
    public void resolveTemplatesFromNotEncodedTest() {
        final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path
View Full Code Here

        String expectedPath2 =
                "path-rootless/test2/x%25yz//path-absolute/test1/fred@example.com/x%25yz";
       
        UriBuilder ub = UriBuilder.fromPath("").path("{w}/{x}/{y}/{z}/{x}");
       
        URI uri = ub.buildFromEncodedMap(maps);
        assertEquals(expectedPath, uri.getRawPath());
       
        uri = ub.buildFromEncodedMap(maps1);
        assertEquals(expectedPath1, uri.getRawPath());
       
View Full Code Here

        UriBuilder ub = UriBuilder.fromPath("").path("{w}/{x}/{y}/{z}/{x}");
       
        URI uri = ub.buildFromEncodedMap(maps);
        assertEquals(expectedPath, uri.getRawPath());
       
        uri = ub.buildFromEncodedMap(maps1);
        assertEquals(expectedPath1, uri.getRawPath());
       
        uri = ub.buildFromEncodedMap(maps2);
        assertEquals(expectedPath2, uri.getRawPath());
    }
View Full Code Here

        assertEquals(expectedPath, uri.getRawPath());
       
        uri = ub.buildFromEncodedMap(maps1);
        assertEquals(expectedPath1, uri.getRawPath());
       
        uri = ub.buildFromEncodedMap(maps2);
        assertEquals(expectedPath2, uri.getRawPath());
    }
   
    @Test(expected = IllegalArgumentException.class)
    public void testBuildFromEncodedMapWithNullValue() throws Exception {
View Full Code Here

        uri = builder.buildFromMap(map);
        uriString = uri.toString();
        assertEquals("//localhost:8080/some/path/pathEx/a+b/a+bc%252Bd#frag", uriString);

        // buildFromEncodedMap
        uri = builder.buildFromEncodedMap(map);
        uriString = uri.toString();
        assertEquals("//localhost:8080/some/path/pathEx/a+b/a+bc%2Bd#frag", uriString);
    }

    public void testUri() throws Exception {
View Full Code Here

     */
    public void testBuildEncoded() {
        UriBuilder uriBuilder = UriBuilder.fromPath("{a}");
        Map<String, String> values = new HashMap<String, String>();
        values.put("a", "/%test%/");
        assertEquals("/%25test%25/", uriBuilder.buildFromEncodedMap(values).toASCIIString());

        uriBuilder = UriBuilder.fromPath("{a}");
        assertEquals("/%25test%25/", uriBuilder.buildFromMap(values).toASCIIString());

        uriBuilder = UriBuilder.fromPath("{a}");
View Full Code Here

    public void testRootless() {
        UriBuilder uriBuilder = UriBuilder.fromPath("");
        uriBuilder.path("{w}");
        Map<String, String> values = new HashMap<String, String>();
        values.put("w", "somerootlesspath");
        URI uri = uriBuilder.buildFromEncodedMap(values);
        assertEquals("somerootlesspath", uri.toASCIIString());

        uriBuilder = UriBuilder.fromPath("{w}");
        values = new HashMap<String, String>();
        values.put("w", "somerootlesspath");
View Full Code Here

        assertEquals("somerootlesspath", uri.toASCIIString());

        uriBuilder = UriBuilder.fromPath("{w}");
        values = new HashMap<String, String>();
        values.put("w", "somerootlesspath");
        uri = uriBuilder.buildFromEncodedMap(values);
        assertEquals("somerootlesspath", uri.toASCIIString());
    }

    public void testQueryIllegal() {
        UriBuilder uriBuilder = UriBuilder.fromPath("");
View Full Code Here

      map.put("host", "A/B");
      map.put("d", "C/D");

      uri = builder.buildFromMap(map);
      Assert.assertEquals("http://A%2FB/C%2FD", uri.toString());
      uri = builder.buildFromEncodedMap(map);
      Assert.assertEquals("http://A/B/C/D", uri.toString());
      uri = builder.buildFromMap(map, false);
      Assert.assertEquals("http://A/B/C/D", uri.toString());

   }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.