Java Code Examples for org.apache.sling.api.resource.ResourceUtil#isNonExistingResource()

The following examples show how to use org.apache.sling.api.resource.ResourceUtil#isNonExistingResource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeometrixxMediaArticleBody.java    From aem-solr-search with Apache License 2.0 6 votes vote down vote up
public GeometrixxMediaArticleBody(Resource resource) throws SlingModelsException {

        if (null == resource) {
            LOG.info("Resource is null");
            throw new SlingModelsException("Resource is null");
        }

        if (ResourceUtil.isNonExistingResource(resource)) {
            LOG.warn("Can't adapt non existent resource: '{}'", resource.getPath());
            throw new SlingModelsException(
                "Can't adapt non existent resource." + resource.getPath());
        }

        this.resource = resource;

    }
 
Example 2
Source File: LongSessionService.java    From AEM-Rules-for-SonarQube with Apache License 2.0 5 votes vote down vote up
public String getLoginPage(final HttpServletRequest request) {
    final String loginPage = request.getParameter("loignPage");
    if (loginPage != null) {
        if (ResourceUtil.isNonExistingResource(resolver.resolve(loginPage))) {
            System.out.println("Login page " + loginPage);
        }
    }
    return loginPage;
}
 
Example 3
Source File: LongSessionService.java    From AEM-Rules-for-SonarQube with Apache License 2.0 5 votes vote down vote up
public String getPath(final HttpServletRequest request) {
    String path = request.getParameter("resource");
    final Resource mappedResource = resolver.resolve(request, path);
    if (!ResourceUtil.isNonExistingResource(mappedResource)) {
        path = mappedResource.getPath();
    }
    return path;
}
 
Example 4
Source File: LongSessionService.java    From AEM-Rules-for-SonarQube with Apache License 2.0 5 votes vote down vote up
public String toRawPath(final String path) {
    String result = "";
    if (resolver != null) {
        final Resource loginPageResource = resolver.resolve(path);
        if (!ResourceUtil.isNonExistingResource(loginPageResource)) {
            result = resolver.map(loginPageResource.getPath());
        }
    }
    return result;
}
 
Example 5
Source File: GeometrixxMediaPage.java    From aem-solr-search with Apache License 2.0 5 votes vote down vote up
public GeometrixxMediaPage(Resource resource) throws SlingModelsException {

        if (null == resource) {
            LOG.debug("resource is null");
            throw new SlingModelsException("Resource is null");
        }

        if (ResourceUtil.isNonExistingResource(resource)) {
            LOG.warn("Can't adapt non existent resource: '{}'", resource.getPath());
            throw new SlingModelsException(
                "Can't adapt non existent resource." + resource.getPath());
        }

    }
 
Example 6
Source File: PropertyPredicates.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
private ValueMap valueMapOf(Resource resource) {
    if (resource == null || ResourceUtil.isNonExistingResource(resource)) {
        return ValueMap.EMPTY;
    }
    return resource.getValueMap();
}