Package org.apache.sling.api.request

Examples of org.apache.sling.api.request.RequestPathInfo


     */
    private ResourceCollector(SlingHttpServletRequest request) {
        this.methodName = request.getMethod();
        this.baseResourceType = null;

        RequestPathInfo requestpaInfo = request.getRequestPathInfo();

        requestSelectors = requestpaInfo.getSelectors();
        numRequestSelectors = requestSelectors.length;
        extension = request.getRequestPathInfo().getExtension();

        isGet = "GET".equals(methodName) || "HEAD".equals(methodName);
        isHtml = isGet && "html".equals(extension);
View Full Code Here


     */
    protected static String toRedirectPath(String targetPath,
            SlingHttpServletRequest request) {

        String postFix;
        RequestPathInfo rpi = request.getRequestPathInfo();
        if (rpi.getExtension() != null) {
            StringBuffer postfixBuf = new StringBuffer();
            if (rpi.getSelectorString() != null) {
                postfixBuf.append('.').append(rpi.getSelectorString());
            }
            postfixBuf.append('.').append(rpi.getExtension());
            if (rpi.getSuffix() != null) {
                postfixBuf.append(rpi.getSuffix());
            }
            postFix = postfixBuf.toString();
        } else {
            postFix = null;
        }
View Full Code Here

        assertEquals("Selector string must not be null", "1",
            p.getSelectorString());
    }

    public void testJIRA_250_d() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource("/",
            ".json"));
        assertEquals("/", p.getResourcePath());
        assertEquals("json", p.getExtension());
        assertNull("Suffix is null",p.getSuffix());
        assertNull("Selectors are null",p.getSelectorString());
    }
View Full Code Here

            // required for a null resource
        }
    }

    public void testTrailingDot() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", "."));
        assertEquals("/some/path", p.getResourcePath());
        assertNull("Selectors are null",p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull("Extension is null",p.getExtension());
        assertNull("Suffix is null", p.getSuffix());
    }
View Full Code Here

        assertNull("Extension is null",p.getExtension());
        assertNull("Suffix is null", p.getSuffix());
    }

    public void testTrailingDotWithSuffix() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", "./suffix"));
        assertEquals("/some/path", p.getResourcePath());
        assertNull("Selectors are null",p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull("Extension is null",p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }
View Full Code Here

        assertNull("Extension is null",p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }

    public void testTrailingDotDot() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", ".."));
        assertEquals("/some/path", p.getResourcePath());
        assertNull("Selectors are null",p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull("Extension is null",p.getExtension());
        assertNull("Suffix is null",p.getSuffix());
    }
View Full Code Here

        assertNull("Extension is null",p.getExtension());
        assertNull("Suffix is null",p.getSuffix());
    }

    public void testTrailingDotDotWithSuffix() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", "../suffix"));
        assertEquals("/some/path", p.getResourcePath());
        assertNull("Selectors are null",p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull("Extension is null",p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }
View Full Code Here

        assertNull("Extension is null",p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }

    public void testTrailingDotDotDot() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", "..."));
        assertEquals("/some/path", p.getResourcePath());
        assertNull("Selectors are null",p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull("Extension is null",p.getExtension());
        assertNull("Suffix is null",p.getSuffix());
    }
View Full Code Here

        assertNull("Extension is null",p.getExtension());
        assertNull("Suffix is null",p.getSuffix());
    }

    public void testTrailingDotDotDotWithSuffix() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", ".../suffix"));
        assertEquals("/some/path", p.getResourcePath());
        assertNull("Selectors are null",p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull("Extension is null",p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }
View Full Code Here

        assertNull("Extension is null",p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }

    public void testAllOptions() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path", ".print.a4.html/some/suffix"));
        assertEquals("/some/path", p.getResourcePath());
        assertEquals("print.a4", p.getSelectorString());
        assertEquals(2, p.getSelectors().length);
        assertEquals("print", p.getSelectors()[0]);
        assertEquals("a4", p.getSelectors()[1]);
        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.api.request.RequestPathInfo

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.