本文整理了Java中org.apache.sling.api.resource.Resource.getPath
方法的一些代码示例,展示了Resource.getPath
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getPath
方法的具体详情如下:
包路径:org.apache.sling.api.resource.Resource
类名称:Resource
方法名:getPath
[英]Returns the absolute path of this resource in the resource tree.
[中]返回资源树中此资源的绝对路径。
代码示例来源:origin: org.apache.sling/org.apache.sling.api
public DeepReadValueMapDecorator(final Resource resource, final ValueMap base) {
super(base);
this.pathPrefix = resource.getPath() + "/";
this.resolver = resource.getResourceResolver();
this.base = base;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public Workspace(Resource resource) {
this.resource = resource;
this.properties = resource.adaptTo(ModifiableValueMap.class);
this.jobName = "acs-commons@bulk-workflow-execution:/" + this.resource.getPath();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.api
/**
* Returns the value of calling <code>getPath</code> on the
* {@link #getResource() wrapped resource}.
*/
@Override
public String getPath() {
return getResource().getPath();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.servlets.post
/**
* Returns the path of the resource of the request as the item path.
* <p>
* This method may be overwritten by extension if the operation has
* different requirements on path processing.
* @param request The http request
* @return The item path
*/
protected String getItemPath(SlingHttpServletRequest request) {
return request.getResource().getPath();
}
代码示例来源:origin: adobe/aem-core-wcm-components
public String getImagePath() {
Resource image = getImageResource();
if (image == null) {
return null;
}
return image.getPath();
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
private static Set<String> getPathsFromQuery(ResourceResolver resourceResolver, String language, String query) {
if (StringUtils.isBlank(query)) {
return Collections.emptySet();
}
Set<String> paths = new HashSet<>();
language = StringUtils.defaultIfEmpty(language, "xpath");
Iterator<Resource> resources = resourceResolver.findResources(query, language);
while (resources.hasNext()) {
paths.add(resources.next().getPath());
}
return paths;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public void accept(final Resource head) throws TraversalException {
if (head == null) {
return;
}
stack.clear();
stack.add(head);
int headLevel = getDepth(head.getPath());
while (!stack.isEmpty()) {
visitNodesInStack(headLevel);
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
/**
* Disables an index, so it's no longer updated by Oak.
*
* @param oakIndex the index
* @throws PersistenceException
*/
public void disableIndex(@Nonnull Resource oakIndex) throws PersistenceException {
final ModifiableValueMap oakIndexProperties = oakIndex.adaptTo(ModifiableValueMap.class);
oakIndexProperties.put(PN_TYPE, DISABLED);
log.info("Disabled index at {}", oakIndex.getPath());
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public static void serializeToResource(Resource r, Object sourceObject) {
Map<String, Object> map = r.adaptTo(ModifiableValueMap.class);
if (map == null) {
LOG.error("Unable to get modifiable value map for resource " + r.getPath());
} else {
serializeToMap(map, sourceObject);
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
/**
* Creates a new SyntheticChildAsPropertyResource.
*
* @param parent the synthetic nodes parent (a real JCR Resource)
* @param nodeName the name of the synthetic child resource
*/
public SyntheticChildAsPropertyResource(Resource parent, String nodeName) {
super(parent.getResourceResolver(), parent.getPath() + "/" + nodeName, RESOURCE_TYPE);
this.data = new JSONModifiableValueMapDecorator();
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
SlingHttpServletRequest req = (SlingHttpServletRequest) request;
SlingHttpServletResponse res = (SlingHttpServletResponse) response;
if (needsFiltering(req.getResource().getPath())) {
doFilterInternal(req, res);
}
chain.doFilter(request, response);
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
private String getReplicatedResourcePath(WorkItem workItem, ResourceResolver resourceResolver) {
String payloadPath = workItem.getWorkflowData().getPayload().toString();
Resource resource = replStatusMgr.getReplicationStatusResource(payloadPath, resourceResolver);
return resource.getPath();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.commons.testing
public void setResourceResolver(ResourceResolver resolver) {
this.mockResourceResolver = resolver;
// recreate request resource with the new resolver
if (resource.getResourceResolver() == null) {
this.resource = new SyntheticResource(resolver, resource.getPath(),
resource.getResourceType());
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
protected void trackScriptEnd(Resource statusResource, String status) {
try {
ModifiableValueMap properties = statusResource.adaptTo(ModifiableValueMap.class);
properties.put(SCRIPT_STATUS, status);
properties.put(SCRIPT_DATE_END, Calendar.getInstance());
statusResource.getResourceResolver().commit();
} catch (PersistenceException e) {
logger.error("On-deploy script status node could not be updated: {} - status: {}", statusResource.getPath(), status);
throw new OnDeployEarlyTerminationException(e);
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public CurrentEvolutionEntryImpl(Resource resource, EvolutionConfig config) {
this.config = config;
this.type = EvolutionEntryType.RESOURCE;
this.name = resource.getName();
this.depth = EvolutionPathUtil.getLastDepthForPath(resource.getPath());
this.path = resource.getParent().getName();
this.value = null;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
private void handleReplication(Resource twitterResource) throws ReplicationException {
if (isReplicationEnabled(twitterResource)) {
Session session = twitterResource.getResourceResolver().adaptTo(Session.class);
replicator.replicate(session, ReplicationActionType.ACTIVATE, twitterResource.getPath());
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public void init() {
if (getField() != null) {
ParameterizedType type = (ParameterizedType) getField().getGenericType();
Class clazz = (Class) type.getActualTypeArguments()[0];
extractFieldComponents(clazz);
}
if (sling != null && sling.getRequest() != null) {
setPath(sling.getRequest().getResource().getPath());
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.servlets.post
public boolean isVersionable(final Resource rsrc) throws PersistenceException {
try {
final Node node = rsrc.adaptTo(Node.class);
return node != null && isVersionable(node);
} catch ( final RepositoryException re) {
throw new PersistenceException(re.getMessage(), re, rsrc.getPath(), null);
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
public void run(final Resource resource) throws Exception {
if (processArgs.isThrottle()) {
throttledTaskRunner.waitForLowCpuAndLowMemory();
}
replicator.replicate(resource.getResourceResolver().adaptTo(Session.class),
processArgs.getReplicationActionType(),
resource.getPath(),
processArgs.getReplicationOptions(resource));
count.incrementAndGet();
}
};
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
public AbstractCacheKey(SlingHttpServletRequest request, HttpCacheConfig cacheConfig) {
this.authenticationRequirement = cacheConfig.getAuthenticationRequirement();
this.uri = request.getRequestURI();
this.resourcePath = unmangle(request.getResource().getPath());
this.hierarchyResourcePath = makeHierarchyResourcePath(this.resourcePath);
this.customExpiryTime = cacheConfig.getExpiryOnCreate();
this.expiryForAccessTime = cacheConfig.getExpiryOnCreate();
this.expiryForUpdateTime = cacheConfig.getExpiryForUpdate();
this.expiryForAccessTime = cacheConfig.getExpiryForAccess();
}
内容来源于网络,如有侵权,请联系作者删除!