Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.ResourceResolver.map()


        buildResource("/factory/test", EMPTY_RESOURCE_LIST, resourceResolver, factoryResourceProvider);
        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
        Mockito.when(request.getScheme()).thenReturn("http");
        Mockito.when(request.getServerPort()).thenReturn(80);
        Mockito.when(request.getServerName()).thenReturn("localhost");
        String path = resourceResolver.map(request,"/factory/test?q=123123");
        Assert.assertEquals("/factory/test?q=123123", path);
        path = resourceResolver.map(request,"/factory/test");
        Assert.assertEquals("/factory/test", path);

        // test path mapping without a request.
View Full Code Here


        Mockito.when(request.getScheme()).thenReturn("http");
        Mockito.when(request.getServerPort()).thenReturn(80);
        Mockito.when(request.getServerName()).thenReturn("localhost");
        String path = resourceResolver.map(request,"/factory/test?q=123123");
        Assert.assertEquals("/factory/test?q=123123", path);
        path = resourceResolver.map(request,"/factory/test");
        Assert.assertEquals("/factory/test", path);

        // test path mapping without a request.
        path = resourceResolver.map("/factory/test");
        Assert.assertEquals("/factory/test", path);
View Full Code Here

        Assert.assertEquals("/factory/test?q=123123", path);
        path = resourceResolver.map(request,"/factory/test");
        Assert.assertEquals("/factory/test", path);

        // test path mapping without a request.
        path = resourceResolver.map("/factory/test");
        Assert.assertEquals("/factory/test", path);

        buildResource("/content", EMPTY_RESOURCE_LIST, resourceResolver, factoryResourceProvider);
        path = resourceResolver.map("/content.html");
        Assert.assertEquals("/content.html", path);
View Full Code Here

        // test path mapping without a request.
        path = resourceResolver.map("/factory/test");
        Assert.assertEquals("/factory/test", path);

        buildResource("/content", EMPTY_RESOURCE_LIST, resourceResolver, factoryResourceProvider);
        path = resourceResolver.map("/content.html");
        Assert.assertEquals("/content.html", path);

    }

View Full Code Here

            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
            rr.map("/somepath");
            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
View Full Code Here

            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
            rr.map(null, "/somepath");
            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
View Full Code Here

                // map or resolve as instructed
                Object result;
                if ("Map".equals(request.getParameter(ATTR_SUBMIT))) {
                    if (helper.getServerName() == null) {
                        result = resolver.map(helper.getPathInfo());
                    } else {
                        result = resolver.map(helper, helper.getPathInfo());
                    }
                } else {
                    result = resolver.resolve(helper, helper.getPathInfo());
View Full Code Here

                Object result;
                if ("Map".equals(request.getParameter(ATTR_SUBMIT))) {
                    if (helper.getServerName() == null) {
                        result = resolver.map(helper.getPathInfo());
                    } else {
                        result = resolver.map(helper, helper.getPathInfo());
                    }
                } else {
                    result = resolver.resolve(helper, helper.getPathInfo());
                }
View Full Code Here

        String actionPath = path;

        ResourceResolver adminResourceResolver = null;
        try {
            adminResourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
            actionPath = adminResourceResolver.map(path);
        } catch (LoginException e) {
            log.error("Could not attain an admin ResourceResolver to map the Form's Action URI");
            // Use the unmapped ActionPath
        } finally {
            if (adminResourceResolver != null && adminResourceResolver.isLive()) {
View Full Code Here

                ResourceResolver resolver = resolverFactory.getResourceResolver(session);

                // map or resolve as instructed
                Object result;
                if ("Map".equals(request.getParameter(ATTR_SUBMIT))) {
                    result = resolver.map(helper, helper.getPathInfo());
                } else {
                    result = resolver.resolve(helper, helper.getPathInfo());
                }

                // set the result to render the result
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.