Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.BaseURLSource


    public void get_base_URL(boolean secureRequest, boolean securePage, String expectedURL)
    {
        Request request = mockRequest();
        Response response = mockResponse();
        MetaDataLocator locator = mockMetaDataLocator();
        BaseURLSource source = mockBaseURLSource();
        ComponentEventLinkEncoder encoder = newMock(ComponentEventLinkEncoder.class);

        train_isSecure(request, secureRequest);

        train_isSecure(locator, PAGE_NAME, securePage);
View Full Code Here


        binder.bind(MessageAccess.class);
    }

    public void contributeAlias(Configuration<AliasContribution> configuration)
    {
        BaseURLSource source = new BaseURLSource()
        {
            public String getBaseURL(boolean secure)
            {
                String protocol = secure ? "https" : "http";
View Full Code Here

    public void asset_client_URL_fully_qualified()
    {
        Context context = mockContext();
        Request request = mockRequest();

        BaseURLSource baseURLSource = newMock(BaseURLSource.class);

        Resource r = new ContextResource(context, "foo/Bar.txt");

        train_getContextPath(request, "/context");
        train_getBaseSource(baseURLSource, request);
View Full Code Here

        expect(request.getServerName()).andReturn("localhost").once();
        expect(request.getServerPort()).andReturn(80).once();

        replay();

        BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "", 0, 0);
        assertEquals(baseURLSource.getBaseURL(false), "http://localhost");

        verify();
    }
View Full Code Here

    {
        expect(request.getServerPort()).andReturn(80).once();

        replay();

        BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "my.server.com", 0, 0);

        assertEquals(baseURLSource.getBaseURL(false), "http://my.server.com");

        verify();
    }
View Full Code Here

    {
        expect(request.getServerPort()).andReturn(80).once();

        replay();

        BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "$HOSTNAME", 0, 0);

        assertEquals(baseURLSource.getBaseURL(false), "http://" + System.getenv("HOSTNAME"));

        verify();
    }
View Full Code Here

    @Test
    public void insecure_url_using_default_port()
    {
        replay();

        BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "localhost", 80, 443);

        assertEquals(baseURLSource.getBaseURL(false), "http://localhost");

        verify();
    }
View Full Code Here

    @Test
    public void secure_url_using_default_port()
    {
        replay();

        BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "localhost", 80, 443);

        assertEquals(baseURLSource.getBaseURL(true), "https://localhost");

        verify();
    }
View Full Code Here

    @Test
    public void getBaseURLWithContributedNonStandardSecurePort()
    {
        replay();

        BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "localhost", 80, 8443);

        assertEquals(baseURLSource.getBaseURL(true), "https://localhost:8443");

        verify();
    }
View Full Code Here

    @Test
    public void absolute_URI_for_default_insecure_link()
    {
        Response response = mockResponse();
        BaseURLSource baseURLSource = mockBaseURLSource();

        train_getBaseURL(baseURLSource, false, INSECURE_BASE_URL);

        train_encodeURL(response, INSECURE_BASE_URL + BASE_PATH, ENCODED);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.BaseURLSource

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.