Package org.apache.sling.api.resource

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


        if (includeLoginForm && (resourceResolverFactory != null)) {
            ResourceResolver resourceResolver = null;
            try {
                resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
                Resource loginFormResource = resourceResolver.resolve(loginForm);
                Servlet loginFormServlet = loginFormResource.adaptTo(Servlet.class);
                if (loginFormServlet != null) {
                    try {
                        loginFormServlet.service(request, response);
                        return true;
View Full Code Here


        final String path = (query > 0) ? localTarget.substring(0, query) : localTarget;

        ResourceResolver resolver = getResourceResolver(request);
        if (resolver != null) {
            // assume all is fine if the path resolves to a resource
            if (!ResourceUtil.isNonExistingResource(resolver.resolve(request, path))) {
                return true;
            }

            // not resolving to a resource, check for illegal characters
        }
View Full Code Here

                    closeTr(pw);
                }

                if (StringUtils.isNotBlank(requestPathInfo.getResourcePath())) {
                    final Collection<Resource> servlets;
                    Resource resource = resourceResolver.resolve(requestPathInfo.getResourcePath());
                    if (resource.adaptTo(Servlet.class) != null) {
                        servlets = Collections.singleton(resource);
                    } else {
                        final ResourceCollector locationUtil = ResourceCollector.create(
                                resource,
View Full Code Here

      String scriptName = ScriptRuntime.toString(arg);

      Resource loadScript = null;
      if (!scriptName.startsWith("/")) {
        String absScriptName = scriptParent + "/" + scriptName;
        loadScript = resolver.resolve(absScriptName);
      }

      // not resolved relative to the current script
      if (loadScript == null) {
        loadScript = resolver.resolve(scriptName);
View Full Code Here

        loadScript = resolver.resolve(absScriptName);
      }

      // not resolved relative to the current script
      if (loadScript == null) {
        loadScript = resolver.resolve(scriptName);
      }

      if (loadScript == null) {
        throw Context.reportRuntimeError("Script file " + scriptName
            + " not found");
View Full Code Here

    ResourceResolver resrev = sling.getScript().getScriptResource().getResourceResolver();

    Resource script = null;
    String scriptName = null;
    for (String basepath : resrev.getSearchPath()) {
      script = resrev.resolve(basepath + absolutePath);
      if (script!=null&&!(script instanceof NonExistingResource)) {
        scriptName = basepath + absolutePath;
        break;
      }
    }
View Full Code Here

    }

    InputStream scriptStream = script.adaptTo(InputStream.class);
    if (scriptStream == null) {
      //try once again
       scriptStream = resrev.resolve(scriptName).adaptTo(InputStream.class);
      if (scriptStream==null) {
        throw Context.reportRuntimeError("Script file " + script.getPath()
            + " cannot be read");
      }
    }
View Full Code Here

            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
            rr.resolve((HttpServletRequest)null);
            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
View Full Code Here

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

            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
            rr.resolve(null, "/path");
            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
    }
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.