Package org.restlet.ext.jaxrs

Examples of org.restlet.ext.jaxrs.ExtendedUriBuilder


        if (actualQuery != null) {
            actualQuery = actualQuery.toString();
        }
        assertEquals(expectedQuery, actualQuery);
        if (compareResult) {
            ExtendedUriBuilder expectedUriBuilder = ExtendedUriBuilder
                    .newInstance();
            if (expectedScheme != null) {
                expectedUriBuilder.scheme(expectedScheme);
            }
            if (expectedUserInfo != null) {
                expectedUriBuilder.userInfo(expectedUserInfo);
            }
            if (expectedHost != null) {
                expectedUriBuilder.host(expectedHost);
            }
            expectedUriBuilder.port(expectedPort);
            expectedUriBuilder.path(expectedPath);
            expectedUriBuilder.extension(expectedExtension);
            if (expectedQuery != null) {
                expectedUriBuilder.replaceQuery(expectedQuery);
            }
            String expectedURI = expectedUriBuilder.build().toString();
            String atualURI = actualUriBuilder.build().toString();
            assertEquals(expectedURI, atualURI);
        }
    }
View Full Code Here


        } catch (IllegalArgumentException e) {
            // wonderful
        }
        URI uri = this.uriBuilderWithVars.build("123", "456", "");
        assertEqualsURI("http://localhost/abc/123/def/456.", uri);
        ExtendedUriBuilder uriBuilder2 = this.uriBuilderWithVars.clone();
        assertEqualsURI("http://localhost/abc/123/def/456.html", uriBuilder2
                .build("123", "456", "html"));
        assertEquals(this.uriBuilderWithVars.toString(), uriBuilder2.toString());
        uriBuilder2.path("{var3}");
        uri = this.uriBuilderWithVars.build("123", "456", "pdf");
        assertEqualsURI("http://localhost/abc/123/def/456.pdf", uri);
        try {
            uriBuilder2.build("123", "456");
            fail("must fail, because there are not enough arguments");
        } catch (IllegalArgumentException e) {
            // wonderful
        }
        final URI uri2 = uriBuilder2.build("123", "456", "789", "");
        assertEqualsURI("http://localhost/abc/123/def/456/789.", uri2);
    }
View Full Code Here

    /**
     * Test method for {@link ExtendedUriBuilder#encode(boolean)} .
     */
    public void testEncode() throws Exception {
        ExtendedUriBuilder uriBuilder = ExtendedUriBuilder.newInstance();
        uriBuilder.host("www.xyz.de");
        uriBuilder.scheme("http");
        uriBuilder.segment("path1", "path2");
        uriBuilder.path("hh ho");
        assertEqualsURI("http://www.xyz.de/path1/path2/hh%20ho", uriBuilder,
                true);
    }
View Full Code Here

        assertEquals("http://www.domain.org/%20", this.uriBuilder.build()
                .toString());
    }

    public void testStaticFromPath() throws Exception {
        ExtendedUriBuilder uriBuilder = ExtendedUriBuilder.fromPath("path");
        assertEqualUriBuilder(null, null, null, null, "path", null, null,
                uriBuilder, true);
        assertEqualsURI("path", uriBuilder);

        uriBuilder = ExtendedUriBuilder.fromPath("path1/path2/abc.html");
        assertEqualUriBuilder(null, null, null, null, "path1/path2/abc",
                ".html", null, uriBuilder, true);
        assertEqualsURI("path1/path2/abc.html", uriBuilder);

        uriBuilder = ExtendedUriBuilder
                .fromPath("path1/path2;mp1=mv 1;mp2=mv2/abc.html");
        assertEqualUriBuilder(null, null, null, null,
                "path1/path2;mp1=mv%201;mp2=mv2/abc", ".html", null,
                uriBuilder, false);
        assertEquals("path1/path2;mp1=mv%201;mp2=mv2/abc.html", uriBuilder
                .build().toString());

        final String path = "path1/path2;mp1=mv1" + Reference.encode("?")
                + ";mp2=mv2/abc.html";
        uriBuilder = ExtendedUriBuilder.fromPath(path);
View Full Code Here

            if (html) {
                stb.append("</p><ul>");
            }
            stb.append("\n");
            for (final Variant variant : supportedVariants) {
                final ExtendedUriBuilder uriBuilder = this.uriInfo
                        .getRequestUriBuilder();
                final boolean added = addExtensions(uriBuilder, variant);
                if (!added) {
                    continue;
                }
                final String uri = uriBuilder.build().toString();
                if (html) {
                    stb.append("<li><a href=\"");
                } else {
                    stb.append("* ");
                }
View Full Code Here

        b.fragment(ref.getFragment(false));
        return b;
    }

    private ExtendedUriBuilder createExtendedUriBuilder(Reference ref) {
        ExtendedUriBuilder b = new ExtendedUriBuilder();
        fillUriBuilder(ref, b);
        String extension = ref.getExtensions();
        b.extension(extension);
        return b;
    }
View Full Code Here

    public UriBuilder getBaseUriBuilder() {
        return UriBuilder.fromUri(getBaseUriStr());
    }

    ExtendedUriBuilder getBaseUriBuilderExtended() {
        ExtendedUriBuilder uriBuilder = ExtendedUriBuilder
                .fromUri(getBaseUriStr());
        ExtendedUriBuilder originalRef = createExtendedUriBuilder(this.referenceOriginal);
        uriBuilder.extension(originalRef.getExtension());
        return uriBuilder;
    }
View Full Code Here

TOP

Related Classes of org.restlet.ext.jaxrs.ExtendedUriBuilder

Copyright © 2018 www.massapicom. 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.