本文整理汇总了Java中org.apache.sling.api.resource.SyntheticResource类的典型用法代码示例。如果您正苦于以下问题:Java SyntheticResource类的具体用法?Java SyntheticResource怎么用?Java SyntheticResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyntheticResource类属于org.apache.sling.api.resource包,在下文中一共展示了SyntheticResource类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: renderNavCart
import org.apache.sling.api.resource.SyntheticResource; //导入依赖的package包/类
private String renderNavCart(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
// We wrap the original POST request in a GET and wrap the response in a string buffer
GetRequestWrapper requestWrapper = new GetRequestWrapper(request);
BufferingResponseWrapper responseWrapper = new BufferingResponseWrapper(response);
RequestDispatcherOptions options = new RequestDispatcherOptions();
options.setReplaceSelectors("");
SyntheticResource resource = new SyntheticResource(request.getResourceResolver(), NAV_CART_PATH, NAV_CART_PATH);
request.getRequestDispatcher(resource, options).include(requestWrapper, responseWrapper);
return responseWrapper.toStrippedOutput();
}
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-sample-we-retail,代码行数:15,代码来源:CartEntryServlet.java
示例2: evaluate
import org.apache.sling.api.resource.SyntheticResource; //导入依赖的package包/类
@Override
public final boolean evaluate(final Object object) {
if (object instanceof SyntheticResource) {
// If the object is a Synthetic Resource
final Resource resource = (Resource) object;
final ValueMap properties = resource.getValueMap();
// Check the Synthetic Resource as needed to figure out if it should be filtered in or out.
return StringUtils.equals(properties.get("cat", String.class), "meow");
} else {
// If not a SyntheticResource then use AbstractNodePredicate's "default" evaluation rules, which will
// in turn call this.evaluate(Node node) defined below if the object is a/adaptable to a JCR Node.
return super.evaluate(object);
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:16,代码来源:SamplePredicate.java
示例3: FakeSlingHttpServletRequest
import org.apache.sling.api.resource.SyntheticResource; //导入依赖的package包/类
public FakeSlingHttpServletRequest(ResourceResolver resolver, String scheme, String server, int port) {
this.resource = new SyntheticResource(null, "", RESOURCE_TYPE);
this.scheme = scheme;
this.server = server;
this.port = port;
setMethod(null);
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:9,代码来源:FakeSlingHttpServletRequest.java
示例4: getResource
import org.apache.sling.api.resource.SyntheticResource; //导入依赖的package包/类
public Resource getResource(ResourceResolver resourceResolver, String path) {
// handle resources for the virtual container resources
if (path.equals(SYSTEM_PATH)) {
return new SyntheticResource(resourceResolver, path,
"playweb/console");
} else if (path.equals(SYSTEM_LOGIN_PATH)) {
return new SyntheticResource(resourceResolver, path, "playweb/auth");
} else if (path.equals(SYSTEM_ENTITY_FIELD_PATH)) {
return new SyntheticResource(resourceResolver, path,
"playweb/field");
} else if (path.equals(SYSTEM_ENTITY_CONTENTYPE_PATH)) {
return new SyntheticResource(resourceResolver, path,
"playweb/contenttype");
} else if (path.equals(SYSTEM_ENTITY_QUERY_PATH)) {
return new SyntheticResource(resourceResolver, path,
"playweb/entity");
}
Session session = resourceResolver.adaptTo(Session.class);
if (session != null) {
try {
if (path.startsWith(SYSTEM_ENITITY_FIELD_PREFIX)) {
Field field = getEntity(new FieldManagerImpl(session),
path, SYSTEM_ENITITY_FIELD_PREFIX);
if(field != null){
return new EntityResource(field, FIELD_RESOURCE_TYPE,
resourceResolver, path);
}
} else if (path.startsWith(SYSTEM_ENITITY_CONTENT_TYPE_PREFIX)) {
ContentType contentType = getEntity(new ContentTypeManagerImpl(session), path, SYSTEM_ENITITY_CONTENT_TYPE_PREFIX);
if(contentType != null){
return new EntityResource(contentType,
CONTENT_TYPE_RESOURCE_TYPE, resourceResolver, path);
}
}
} catch (RepositoryException e) {
e.printStackTrace();
}
}
return null;
}
开发者ID:hlta,项目名称:playweb,代码行数:57,代码来源:PlaywebResourceProvider.java
注:本文中的org.apache.sling.api.resource.SyntheticResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论