本文整理汇总了Java中org.apache.sling.api.resource.NonExistingResource类的典型用法代码示例。如果您正苦于以下问题:Java NonExistingResource类的具体用法?Java NonExistingResource怎么用?Java NonExistingResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NonExistingResource类属于org.apache.sling.api.resource包,在下文中一共展示了NonExistingResource类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteProject
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Override
public void deleteProject(SlingHttpServletRequest request) throws OperationException {
if (request.getResource() instanceof NonExistingResource) {
throw new OperationException("Nonexisting resource", 400);
}
if (!mayDelete(request.getResource())) {
throw new OperationException("Not allowed", 400);
}
ResourceResolver serviceUserResolver = null;
try {
serviceUserResolver =
resourceResolverFactory.getServiceResourceResolver(Collections.singletonMap(
ResourceResolverFactory.SUBSERVICE, (Object) UGC_WRITER));
deleteProject(request.getResource().getPath(), serviceUserResolver);
} catch (LoginException e) {
throw new OperationException("Not allowed", e, 400);
} finally {
if (serviceUserResolver != null && serviceUserResolver.isLive()) {
serviceUserResolver.close();
}
}
}
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-scf-sample-components-customize,代码行数:25,代码来源:TaskServiceImpl.java
示例2: IronImage
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
public IronImage(Resource resource) {
super(resource);
if (null == getFileReference() ||
resource instanceof NonExistingResource) {
setStyle(IronImage.CLASS_PLACEHOLDER);
setSrc(IronImage.SRC_PLACEHOLDER);
setPath(IronImage.SRC_PLACEHOLDER);
} else {
empty = false;
setHash(WCMUtil.getFastHash(resource.getPath()));
setLink(resource.adaptTo(ValueMap.class).get(PN_LINK, String.class));
setTarget(resource.adaptTo(ValueMap.class).get(PN_TARGET, String.class));
try {
setExtension(MimeTypeExtension.getExtensionByMimeType(super.getMimeType()));
} catch (RepositoryException re) {
// NO OP
// eat this exception
}
}
}
开发者ID:steeleforge,项目名称:ironsites,代码行数:21,代码来源:IronImage.java
示例3: appliesTo
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
public boolean appliesTo(Resource resource) {
if (resource == null || resource instanceof NonExistingResource) {
return this == NON_EXISTING;
}
String resourceType = resource.getResourceType();
if (isTypeEqualTo(resourceType)) {
return true;
}
Resource contentResource = resource.getChild(JCR_CONTENT);
return contentResource != null && isTypeEqualTo(contentResource.getResourceType());
}
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:13,代码来源:ResourceType.java
示例4: execute
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Override
public CharSequence execute(String path)
throws Exception {
String responseString = "";
if (!isInvalidPath(path)) {
TemplateContentModelImpl contentModel = contentModel();
SlingHttpServletRequest request = contentModel.request();
ResourceResolver resourceResolver = request.getResourceResolver();
Resource resource = request.getResource();
if (path != null) {
path = interpolate(path);
path = attachSuffixOrPrefix(path, (String) param("prefix"), (String) param("suffix"));
if (!path.startsWith("/")) {
path = request.getResource().getPath() + "/" + path;
}
path = ResourceUtil.normalize(path);
}
ComponentManager componentManager = resourceResolver.adaptTo(ComponentManager.class);
Resource tmp = request.getResourceResolver().resolve(path);
String resourceType = interpolate((String) param("resourceType"));
final RequestDispatcherOptions opts = new RequestDispatcherOptions();
opts.setForceResourceType(resourceType);
RequestDispatcher dispatcher;
if (tmp != null) {
if (tmp instanceof NonExistingResource) {
if (resourceType != null) {
resource = new IncludeHelperSyntheticResource(request.getResourceResolver(), path, resourceType);
opts.remove(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE);
}
} else {
resource = tmp;
}
}
com.day.cq.wcm.api.components.Component component = componentManager.getComponentOfResource(resource);
dispatcher = request.getRequestDispatcher(resource, opts);
HttpServletResponse wrappedResponse = contentModel().wrappedResponse();
dispatcher.include(request, wrappedResponse);
responseString = wrappedResponse.toString();
} else {
LOG.error("{} It is not valid", path);
}
return new Handlebars.SafeString(responseString);
}
开发者ID:DantaFramework,项目名称:AEM,代码行数:46,代码来源:IncludeResourceHelperFunction.java
示例5: ActionTypeResource
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
ActionTypeResource(FormsManager.ComponentDescription description, ResourceResolver resourceResolver) {
super(resourceResolver, StringUtils.EMPTY, NonExistingResource.RESOURCE_TYPE_NON_EXISTING);
this.description = description;
}
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:5,代码来源:FormActionTypeDataSourceServlet.java
示例6: resolve
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Override
public Resource resolve(HttpServletRequest request, String absPath) {
String path = absPath != null ? absPath : "/";
Resource resource = getResource(path);
return resource != null ? resource : new NonExistingResource(this, path);
}
开发者ID:TWCable,项目名称:jackalope,代码行数:7,代码来源:ResourceResolverImpl.java
示例7: testFindErrorPage_subResource
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Test
public void testFindErrorPage_subResource() {
assertEquals("/content/project/test/error-pages.html", new ErrorPageHandlerImpl().findErrorPage(request, new NonExistingResource(resourceResolver, "/content/project/test/jcr:content/root/non-existing-resource")));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:ErrorPageHandlerImplTest.java
示例8: testFindErrorPage_nonExistingPage
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Test
public void testFindErrorPage_nonExistingPage() {
assertEquals("/content/project/test/error-pages.html", new ErrorPageHandlerImpl().findErrorPage(request, new NonExistingResource(resourceResolver, "/content/project/test/non-existing-page")));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:ErrorPageHandlerImplTest.java
示例9: testFindErrorPage_nonExistingPageSubResource
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Ignore // does not work at the moment because the mocked resourceResolver does not support NonExistingResource in the used version
@Test
public void testFindErrorPage_nonExistingPageSubResource() {
assertEquals("/content/project/test/error-pages.html", new ErrorPageHandlerImpl().findErrorPage(request, new NonExistingResource(resourceResolver, "/content/project/test/non-existing-page/jcr:content/test1/test2")));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:6,代码来源:ErrorPageHandlerImplTest.java
示例10: testFindErrorPage_nonExistingPageWithoutExtension
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Test
public void testFindErrorPage_nonExistingPageWithoutExtension() {
assertEquals("/content/project/test/error-pages.html", new ErrorPageHandlerImpl().findErrorPage(request, new NonExistingResource(resourceResolver, "/content/project/non-existing-page")));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:ErrorPageHandlerImplTest.java
示例11: testFindErrorPage_JcrContent0
import org.apache.sling.api.resource.NonExistingResource; //导入依赖的package包/类
@Test
public void testFindErrorPage_JcrContent0() {
assertEquals("/content/project/test/error-pages.html",
new ErrorPageHandlerImpl().findErrorPage(request,
new NonExistingResource(resourceResolver, "/content/project/jcr:content/non-existing")));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:7,代码来源:ErrorPageHandlerImplTest.java
注:本文中的org.apache.sling.api.resource.NonExistingResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论