本文整理汇总了Java中org.apache.sling.api.resource.Resource.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getPath方法的具体用法?Java Resource.getPath怎么用?Java Resource.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sling.api.resource.Resource
的用法示例。
在下文中一共展示了Resource.getPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PatternModel
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
public PatternModel(Resource resource, String patternsPath, String patternId, String jsonDataFile, String templateName, ResourceResolver resourceResolver) throws IOException {
this.id = PatternLabUtils.constructPatternId(resource.getPath(), patternsPath, templateName, jsonDataFile);
this.name = StringUtils.lowerCase(StringUtils.isBlank(jsonDataFile) ? templateName : jsonDataFile);
this.template = templateName;
this.path = resource.getPath();
this.dataPath = StringUtils.isNotBlank(jsonDataFile) ? resource.getParent().getPath() + PatternLabConstants.SLASH + jsonDataFile : StringUtils.EMPTY;
this.displayed = StringUtils.isBlank(patternId) || StringUtils.startsWith(getId(), patternId);
this.breadcrumb = Lists.newArrayList(new BreadcrumbItemModel(PatternLabUtils.constructPatternId(resource.getPath(), patternsPath), PatternLabUtils.getResourceTitleOrName(resource)));
if (StringUtils.isNotBlank(jsonDataFile)) {
this.breadcrumb.add(new BreadcrumbItemModel(PatternLabUtils.constructPatternId(resource.getPath(), patternsPath, templateName), templateName));
}
this.breadcrumb.add(new BreadcrumbItemModel(id, name));
this.code = PatternLabUtils.getDataFromFile(path, resourceResolver);
this.data = PatternLabUtils.getDataFromFile(dataPath, resourceResolver);
this.description = constructDescription(jsonDataFile, templateName, resourceResolver);
this.embeddedPatterns = Sets.newHashSet();
this.includingPatterns = Sets.newHashSet();
}
示例2: constructPatternLabPageModel
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
@PostConstruct
private void constructPatternLabPageModel() {
final Resource pageContentResource = request.getResource();
rawMode = PatternLabUtils.isRawSelectorPresent(request);
patternId = PatternLabUtils.getPatternIdFromSelector(request);
patternCategoryFactory = new PatternPatternCategoryFactoryImpl(request.getResourceResolver());
currentPagePath = pageContentResource.getPath();
try {
constructCategories(pageContentResource);
constructSearchPatternResults();
constructPatternsReferences();
} catch (IOException e) {
LOGGER.error("Error during constructing Pattern Lab page:", e);
}
}
示例3: findContainingComponent
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
/**
* Takes resource and returns component
*
* @param resource The resource to fetch the component from
* @return null or component
*/
public static Component findContainingComponent(final Resource resource) {
ResourceResolver resourceResolver = resource.getResourceResolver();
ComponentManager componentManager = resourceResolver.adaptTo(ComponentManager.class);
Resource componentResource = findParentAs(resource, NT_COMPONENT);
if (componentResource != null) {
String componentPath = componentResource.getPath();
if (StringUtils.isNotBlank(componentPath)) {
return componentManager.getComponent(componentPath);
}
}
return null;
}
示例4: getSrc
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
@Deprecated
public static String getSrc(Resource imageResource) {
return imageResource.getPath() + IMG_EXT + PNG_EXT;
}
示例5: getTransformedImagePath
import org.apache.sling.api.resource.Resource; //导入方法依赖的package包/类
@Deprecated
public static String getTransformedImagePath(Resource resource, String renditionName) {
return resource.getPath() + TRANSFORM_SELECTOR + "/" + renditionName + "/" + IMAGE + JPG_EXT;
}