Package org.apache.sling.api.request

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


        assertEquals("html", p.getExtension());
        assertEquals("/something", p.getSuffix());
    }

    public void testSelectorsSplit() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path"), "/some/path.print.a4.html/some/suffix");
        assertEquals("/some/path", p.getResourcePath());
        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


        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }

    public void testPartialResolutionB() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/some/path"), "/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

        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }

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

        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }

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

        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }

    public void testJIRA_250_a() {
      RequestPathInfo p =
            new SlingRequestPathInfo(
                    new MockResource("/bunkai"),
                    "/bunkai.1.json"
            );
        assertEquals("/bunkai", p.getResourcePath());
        assertEquals("json", p.getExtension());
        assertEquals("1", p.getSelectorString());
    }
View Full Code Here

        assertEquals("json", p.getExtension());
        assertEquals("1", p.getSelectorString());
    }
   
    public void testJIRA_250_b() {
      RequestPathInfo p =
            new SlingRequestPathInfo(
                    new MockResource("/"),
                    "/.1.json"
            );
        assertEquals("/", p.getResourcePath());
        assertEquals("json", p.getExtension());
        assertNull(p.getSuffix());
        assertEquals("Selector string must not be null", "1", p.getSelectorString());
    }
View Full Code Here

        assertNull(p.getSuffix());
        assertEquals("Selector string must not be null", "1", p.getSelectorString());
    }
   
    public void testJIRA_250_c() {
      RequestPathInfo p =
            new SlingRequestPathInfo(
                    new MockResource("/"),
                    "/.1.json/my/suffix"
            );
        assertEquals("/", p.getResourcePath());
        assertEquals("json", p.getExtension());
        assertEquals("/my/suffix",p.getSuffix());
        assertEquals("Selector string must not be null", "1", p.getSelectorString());
    }
View Full Code Here

        assertEquals("/my/suffix",p.getSuffix());
        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(p.getSuffix());
        assertNull(p.getSelectorString());
    }
View Full Code Here

    private final boolean isHtmlRequest;

    ResourceCollectorGet(SlingHttpServletRequest request) {
        super(request.getMethod(), null);

        RequestPathInfo requestpaInfo = request.getRequestPathInfo();
        String rs = requestpaInfo.getSelectorString();
        if (rs == null || rs.length() == 0) {
            requestSelectors = null;
            numRequestSelectors = 0;
        } else {
            requestSelectors = rs.replace('.', '/');
            numRequestSelectors = requestpaInfo.getSelectors().length;
        }

        extension = requestpaInfo.getExtension();
        isHtmlRequest = "html".equals(extension);
    }
View Full Code Here

        return resource;
    }

    public void initServlet(final Resource resource) {
        // the resource and the request path info, will never be null
        RequestPathInfo requestPathInfo = new SlingRequestPathInfo(resource);
        ContentData contentData = pushContent(resource, requestPathInfo);

      requestProgressTracker.log("Resource Path Info: {0}", requestPathInfo);

        // finally resolve the servlet for the resource
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.