Package javax.ws.rs.core

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


public class UriBuilderImplTest extends TestCase {

    public void testUriBuilderSimple() {
        UriBuilder builder = new UriBuilderImpl();
        builder.scheme("http").host("localhost").port(8080);
        builder.segment("some", "path");
        builder.segment("matrix1");
        builder.matrixParam("a", "1");
        builder.matrixParam("b", "2");
        builder.segment("matrix2");
        builder.matrixParam("c", "3");
View Full Code Here


    public void testUriBuilderSimple() {
        UriBuilder builder = new UriBuilderImpl();
        builder.scheme("http").host("localhost").port(8080);
        builder.segment("some", "path");
        builder.segment("matrix1");
        builder.matrixParam("a", "1");
        builder.matrixParam("b", "2");
        builder.segment("matrix2");
        builder.matrixParam("c", "3");
        builder.fragment("fragment");
View Full Code Here

        builder.scheme("http").host("localhost").port(8080);
        builder.segment("some", "path");
        builder.segment("matrix1");
        builder.matrixParam("a", "1");
        builder.matrixParam("b", "2");
        builder.segment("matrix2");
        builder.matrixParam("c", "3");
        builder.fragment("fragment");
        URI uri = builder.build();
        assertEquals("http://localhost:8080/some/path/matrix1;a=1;b=2/matrix2;c=3#fragment", uri
            .toString());
View Full Code Here

    }

    public void testPath() throws Exception {
        // vars
        UriBuilder builder = new UriBuilderImpl();
        builder.segment("path1");
        URI uri = builder.build();
        assertEquals("path1", uri.toString());

        builder.segment("seg1/{var1}");
        uri = builder.build("segment1");
View Full Code Here

        UriBuilder builder = new UriBuilderImpl();
        builder.segment("path1");
        URI uri = builder.build();
        assertEquals("path1", uri.toString());

        builder.segment("seg1/{var1}");
        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1", uri.toString());

        builder.segment("seg2/{var1}");
        uri = builder.build("segment1");
View Full Code Here

        builder.segment("seg1/{var1}");
        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1", uri.toString());

        builder.segment("seg2/{var1}");
        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1", uri.toString());
        uri = builder.build("segment2");
        assertEquals("path1/seg1%2Fsegment2/seg2%2Fsegment2", uri.toString());
View Full Code Here

        uri = builder.build("segment1");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1", uri.toString());
        uri = builder.build("segment2");
        assertEquals("path1/seg1%2Fsegment2/seg2%2Fsegment2", uri.toString());

        builder.segment("{var2}").segment("{var1}");
        uri = builder.build("segment1", "segment2");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1/segment2/segment1", uri.toString());

        uri = builder.build("segment1", "segment2", "segment3");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1/segment2/segment1", uri.toString());
View Full Code Here

        uri = builder.build("segment1", "segment2", "segment3");
        assertEquals("path1/seg1%2Fsegment1/seg2%2Fsegment1/segment2/segment1", uri.toString());

        // vars with special character
        builder = new UriBuilderImpl();
        builder.segment("path1").segment("{var1}");
        uri = builder.build("/s1,s2");
        assertEquals("path1//s1,s2", uri.toString());

        builder.replacePath("/r1/{v1}");
        uri = builder.build("r2");
View Full Code Here

        assertEquals("r1/r2", uri.toString());
    }

    public void testMatrix() {
        UriBuilder builder = new UriBuilderImpl();
        builder.segment("path1");

        builder.matrixParam("mat1", "val1");
        String uriString = builder.build().toString();
        assertEquals("path1;mat1=val1", uriString);
View Full Code Here

    }

    public void testClone() {
        UriBuilder builder1 = new UriBuilderImpl();
        builder1.scheme("http").host("localhost").port(80);
        builder1.segment("path1", "path2");
        builder1.matrixParam("mat1", "{var1}", "v2");
        builder1.queryParam("q1", "abc");
        builder1.fragment("fragment");
        UriBuilder builder2 = builder1.clone();
        String uri1 = builder1.build("v1").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.