• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SyntheticResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RefreshJobRetentionSettingsRequestProto类代码示例发布时间:2022-05-23
下一篇:
Java CubicLineChart类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap