/** * Does the resource exist ? * @param resource * @return */ private boolean resourceExists(final Resource resource) { return (resource != null && !ResourceUtil.isSyntheticResource(resource)); }
private String buildUrl(Configuration config, SlingHttpServletRequest request) { final boolean synthetic = ResourceUtil.isSyntheticResource(request.getResource()); final Resource resource = request.getResource(); final StringBuilder builder = new StringBuilder(); final RequestPathInfo pathInfo = request.getRequestPathInfo(); final String resourcePath = pathInfo.getResourcePath(); builder.append(resourcePath); if (pathInfo.getSelectorString() != null) { builder.append('.').append(sanitize(pathInfo.getSelectorString())); } builder.append('.').append(config.getIncludeSelector()); builder.append('.').append(pathInfo.getExtension()); if (synthetic) { builder.append('/').append(resource.getResourceType()); } else { builder.append(sanitize(pathInfo.getSuffix())); } return builder.toString(); }
String suffix; Resource currentResource = request.getResource(); if (ResourceUtil.isSyntheticResource(currentResource)) {
this.isSyntheticResource = isSyntheticResource(resource);
if ( r != null && !ResourceUtil.isSyntheticResource(r)) { startingResource = resolver.getResource(startingResourcePath); updateNodeType(resolver, startingResourcePath, reqProperties, changes, versioningConfiguration); if (child != null && !ResourceUtil.isSyntheticResource(child)) { resource = child; updateNodeType(resolver, resource.getPath(), reqProperties, changes, versioningConfiguration);
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request; final String resourceType = getResourceTypeFromSuffix(slingRequest); final Configuration config = configurationWhiteboard.getConfiguration(slingRequest, resourceType); if (config == null || !config.hasIncludeSelector(slingRequest) || !ResourceUtil.isSyntheticResource(slingRequest.getResource())) { chain.doFilter(request, response); return; } final RequestDispatcherOptions options = new RequestDispatcherOptions(); options.setForceResourceType(resourceType); final RequestDispatcher dispatcher = slingRequest.getRequestDispatcher(slingRequest.getResource(), options); dispatcher.forward(request, response); }
if ( ResourceUtil.isSyntheticResource(parent) ) { Resource grandParent = parent.getParent(); if (grandParent != null) {
private String buildCrxDeLinkToResourceType(HttpServletRequest request, String type) { return getResourceResolver().map(r -> { try { String path = resourceTypeToPath(type); Resource resource = null; Resource iconResource = null; for (String searchPath : r.getSearchPath()) { resource = r.getResource(searchPath + path); if (resource != null && !isNonExistingResource(resource) && !isSyntheticResource(resource)) { iconResource = resource.getChild("icon.png"); break; } } return resource != null ? "<a href=\"" + request.getContextPath() + "/crx/de/#" + resource.getPath() + "\" " + "class=\"crxdelink\">" + "<img class=\"componentIcon\" src=\"" + getLabel() + API_PATH + API_COMPONENTICON + (iconResource == null ? "" : resource.getPath()) + "\"/>" + type + "</a>" : "<span class=\"unresolved\">" + type + "</span>"; } finally { r.close(); } }).orElse("#"); }
/** * Create resource(s) according to current request * * @throws PersistenceException if a resource error occurs */ protected void processCreate(final ResourceResolver resolver, final Map<String, RequestProperty> reqProperties, final PostResponse response, final List<Modification> changes, final VersioningConfiguration versioningConfiguration) throws PersistenceException { final String path = response.getPath(); final Resource resource = resolver.getResource(path); if ( resource == null || ResourceUtil.isSyntheticResource(resource) ) { deepGetOrCreateResource(resolver, path, reqProperties, changes, versioningConfiguration); response.setCreateRequest(true); } else { updateNodeType(resolver, path, reqProperties, changes, versioningConfiguration); updateMixins(resolver, path, reqProperties, changes, versioningConfiguration); } }
if (fileRes != null && !ResourceUtil.isSyntheticResource(fileRes)) {