Package org.apache.sling.api.request

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


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

    public void testJIRA_250_a() {
        RequestPathInfo p = new SlingRequestPathInfo(new MockResource(
            "/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("Suffix is null",p.getSuffix());
        assertEquals("Selector string must not be null", "1",
            p.getSelectorString());
    }
View Full Code Here

        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

     * @param request
     * @param index
     * @return null if selector cannot be found at the specified index
     */
    public static String getSelector(SlingHttpServletRequest request, int index) {
        RequestPathInfo pathInfo = request.getRequestPathInfo();
        if(pathInfo == null || pathInfo.getSelectors() == null) { return null; }

        if(index >= 0 && index < pathInfo.getSelectors().length) {
            return pathInfo.getSelectors()[index];
        } else {
            return null;
        }
    }
View Full Code Here

     * @param request
     * @param index
     * @return null if suffix segment cannot be found at the specified index
     */
    public static String getSuffixSegment(SlingHttpServletRequest request, int index) {
        RequestPathInfo pathInfo = request.getRequestPathInfo();
        if(pathInfo == null || pathInfo.getSuffix() == null) { return null; }

        String []suffixes  = StringUtils.split(pathInfo.getSuffix(), '/');

        if(index >= 0 && index < suffixes.length) {
            return suffixes[index];
        } else {
            return null;
View Full Code Here

     *
     * @param request
     * @return Returns null if Request's pathInfo or Suffix is null
     */
    public static String getSuffix(SlingHttpServletRequest request) {
        RequestPathInfo pathInfo = request.getRequestPathInfo();
        if(pathInfo == null || pathInfo.getSuffix() == null) { return null; }

        return pathInfo.getSuffix();
    }
View Full Code Here

    private boolean accepts(Resource resource, HttpServletRequest request) {
        if(resource == null || request == null) {
            return false;
        }

        final RequestPathInfo pathInfo = new PathInfo(request.getRequestURI());
        final String suffix = getSuffix(request.getRequestURI());
        final String extension = pathInfo.getExtension();
        final String quick = parseSuffix(suffix, com.activecq.tools.quickimage.Constants.KEY_QUICK, 0, null);

        if(StringUtils.isBlank(extension) ||
                StringUtils.isBlank(suffix) ||
                !ResourceUtil.isA(resource, JcrConstants.NT_FILE) ||
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.