Examples of replaceMatrixParam()


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

    }

    @Test
    public void testReplaceMatrixParamWithNull() {
        UriBuilder builder = new JerseyUriBuilder().matrixParam("matrix", "param1", "param2");
        builder.replaceMatrixParam("matrix", (Object[]) null);
        assertEquals(builder.build().toString(), "");
    }

    // for completeness (added along with regression tests for JERSEY-1114)
    @Test
View Full Code Here

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

            Assert.assertEquals(1, b.size());
            Assert.assertEquals("y", b.get(0));
        }

        {
            URI uri = ubu.replaceMatrixParam("a", "_z_", "_zz_").build();
            List<PathSegment> ps = UriComponent.decodePath(uri, true);
            MultivaluedMap<String, String> mps = ps.get(2).getMatrixParameters();
            List<String> a = mps.get("a");
            Assert.assertEquals(2, a.size());
            Assert.assertEquals("_z_", a.get(0));
View Full Code Here

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

    @Test
    public void testReplaceMatrixParamsEncoded() throws URISyntaxException {
        UriBuilder ubu = UriBuilder.fromUri("http://localhost/").
                replaceMatrix("limit=10;sql=select+*+from+users");
        ubu.replaceMatrixParam("limit", 100);

        URI uri = ubu.build();
        Assert.assertEquals(URI.create("http://localhost/;limit=100;sql=select+*+from+users"), uri);
    }

View Full Code Here

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

    @Test
    public void testMatrixParamsWithTheSameName() {
        UriBuilder first = UriBuilder.fromUri("http://www.com/").replaceMatrixParam("example", "one", "two");
        first = first.path("/child");
        first = first.replaceMatrixParam("example", "another");

        Assert.assertEquals(
                "http://www.com/;example=one;example=two/child;example=another", first.build().toString());
    }
View Full Code Here

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

    @Test
    public void testMatrixParamsWithTheDifferentName() {
        UriBuilder first = UriBuilder.fromUri("http://www.com/").replaceMatrixParam("example", "one", "two");
        first = first.path("/child");
        first = first.replaceMatrixParam("other", "another");

        Assert.assertEquals(
                "http://www.com/;example=one;example=two/child;other=another", first.build().toString());
    }
View Full Code Here

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

        builder.matrixParam("{matvar1}", "{var1}");
        uriString = builder.build("val2", "mat1").toString();
        assertEquals("path1;mat1=val1;mat2=val2;mat1=val2", uriString);

        builder.replaceMatrixParam("mat1", "val5");
        uriString = builder.build("val2", "mat1").toString();
        assertEquals("path1;mat1=val5;mat2=val2;mat1=val2", uriString);
    }

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

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

        for (Map.Entry<String, Object> p : queryParams.entrySet()) {
            uriBuilder.replaceQueryParam(p.getKey(), p.getValue());
        }
        for (Map.Entry<String, Object> p : matrixParams.entrySet()) {
            uriBuilder.replaceMatrixParam(p.getKey(), p.getValue());
        }
       
        uri = uriBuilder.buildFromMap(pathParams);
        Resource resource = restClient.resource(uri);
       
View Full Code Here

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

    }

    @Test
    public void testReplaceMatrixParamWithNull() {
        UriBuilder builder = new UriBuilderImpl().matrixParam("matrix", "param1", "param2");
        builder.replaceMatrixParam("matrix", (Object[]) null);
        assertEquals(builder.build().toString(), "");
    }

    @Test
    public void testReplaceNullMatrixParam() {
View Full Code Here

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

      client.abortIfClosed();
      if (name == null) throw new NullPointerException("name was null");
      UriBuilder copy = uriBuilder.clone();
      if (values.length == 1 && values[0] == null)
      {
         copy.replaceMatrixParam(name, null);
      }
      else
      {
         String[] stringValues = toStringValues(values);
         copy = uriBuilder.clone().matrixParam(name, stringValues);
View Full Code Here

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

   {
      URI bu = UriBuilder.fromUri("http://localhost:8080/a/b/c;a=x;b=y").
              replaceMatrix("x=a;y=b").build();
      Assert.assertEquals(URI.create("http://localhost:8080/a/b/c;x=a;y=b"), bu);
      UriBuilder builder = UriBuilder.fromUri("http://localhost:8080/a").path("/{b:A{0:10}}/c;a=x;b=y");
      builder.replaceMatrixParam("a", "1", "2");
      bu = builder.build("b");
      Assert.assertEquals(URI.create("http://localhost:8080/a/b/c;b=y;a=1;a=2"), bu);

      // test removal
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.