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

Java SlingBindings类代码示例

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

本文整理汇总了Java中org.apache.sling.api.scripting.SlingBindings的典型用法代码示例。如果您正苦于以下问题:Java SlingBindings类的具体用法?Java SlingBindings怎么用?Java SlingBindings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SlingBindings类属于org.apache.sling.api.scripting包,在下文中一共展示了SlingBindings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getResource

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
/**
 * get a resource
 *
 * @param path
 * @param depth
 * @return json string
 */
public String getResource(final String path, final Integer depth) {
  SlingHttpServletRequest request = (SlingHttpServletRequest) context.getBindings(ScriptContext.ENGINE_SCOPE).get(SlingBindings.REQUEST);

  int actualDepth;
  try {
    if (depth == null || depth < 1) {
      actualDepth = -1;
    } else {
      actualDepth = depth.intValue();
    }

    Resource resource = request.getResourceResolver().getResource(path);
    if (resource == null) {
      return null;
    }
    return JsonObjectCreator.create(resource, actualDepth).toString();

  } catch (JSONException e) {
    throw new TechnicalException("could not get current resource", e);
  }

}
 
开发者ID:sinnerschrader,项目名称:aem-react,代码行数:30,代码来源:Sling.java


示例2: prepareRequestResponsePair

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Pair<MockSlingHttpServletRequest, MockSlingHttpServletResponse> prepareRequestResponsePair(String resourcePath,
                                                                                                   long lastModifiedDate,
                                                                                                   String selectorString,
                                                                                                   String requestExtension,
                                                                                                   String suffixExtension) {
    final MockSlingHttpServletRequest request =
            new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    final MockSlingHttpServletResponse response = new MockSlingHttpServletResponse();
    Resource resource = resourceResolver.getResource(resourcePath);
    request.setResource(resource);
    MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) request.getRequestPathInfo();
    requestPathInfo.setSuffix("/" + lastModifiedDate + "." + suffixExtension);
    requestPathInfo.setSelectorString(selectorString);
    requestPathInfo.setExtension(requestExtension);
    requestPathInfo.setResourcePath(resourcePath);
    request.setContextPath(CONTEXT_PATH);
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.REQUEST, request);
    bindings.put(SlingBindings.RESPONSE, response);
    bindings.put(SlingBindings.SLING, CONTEXT.slingScriptHelper());
    bindings.put(SlingBindings.RESOLVER, resourceResolver);
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return new RequestResponsePair(request, response);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:25,代码来源:AdaptiveImageServletTest.java


示例3: getContainerUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Container getContainerUnderTest(String resourcePath) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Does the test resource " + resourcePath + " exist?");
    }
    SlingBindings bindings = new SlingBindings();
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    MockSlingHttpServletResponse response = new MockSlingHttpServletResponse();
    request.setContextPath(CONTEXT_PATH);
    request.setResource(resource);
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    bindings.put(SlingBindings.REQUEST, request);
    bindings.put(SlingBindings.RESPONSE, response);
    Page page = CONTEXT.currentPage(CONTAINING_PAGE);
    bindings.put(WCMBindings.CURRENT_PAGE, page);
    request.setRequestDispatcherFactory(requestDispatcherFactory);
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(Container.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:21,代码来源:ContainerImplTest.java


示例4: getBreadcrumbUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Breadcrumb getBreadcrumbUnderTest(String resourcePath, Style style) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Did you forget to define test resource " + resourcePath + "?");
    }
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    request.setResource(resource);
    request.setContextPath("");
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    bindings.put(WCMBindings.CURRENT_PAGE, CONTEXT.pageManager().getPage(CURRENT_PAGE));
    if (style == null) {
        style = mock(Style.class);
        when(style.get(any(), any(Object.class))).thenAnswer(
                invocation -> invocation.getArguments()[1]
        );
    }
    bindings.put(WCMBindings.CURRENT_STYLE, style);
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(Breadcrumb.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:23,代码来源:BreadcrumbImplTest.java


示例5: getListUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private List getListUnderTest(String resourcePath) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Did you forget to defines test resource " + resourcePath + "?");
    }
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    request.setResource(resource);
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(SlingBindings.REQUEST, request);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    Style style = mock(Style.class);
    when(style.get(any(), any(Object.class))).thenAnswer(
            invocation -> invocation.getArguments()[1]
    );
    bindings.put(WCMBindings.CURRENT_STYLE, style);
    bindings.put(WCMBindings.CURRENT_PAGE, CONTEXT.pageManager().getPage(CURRENT_PAGE));
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(List.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:21,代码来源:ListImplTest.java


示例6: getSocialMediaHelperUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private SocialMediaHelper getSocialMediaHelperUnderTest(String pagePath) {
    Resource currentResource = CONTEXT.resourceResolver().getResource(pagePath);
    Page currentPage = currentResource.adaptTo(Page.class);
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    MockSlingHttpServletResponse response = new MockSlingHttpServletResponse();
    request.setContextPath(CONTEXT_PATH);
    request.setResource(currentResource);
    MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) request.getRequestPathInfo();
    requestPathInfo.setExtension(EXTENSION);
    requestPathInfo.setResourcePath(currentResource.getPath());
    SlingBindings slingBindings = new SlingBindings();
    slingBindings.put(WCMBindings.CURRENT_PAGE, currentPage);
    slingBindings.put(SlingBindings.RESOLVER, CONTEXT.resourceResolver());
    slingBindings.put(SlingBindings.RESPONSE, response);
    request.setAttribute(SlingBindings.class.getName(), slingBindings);
    return request.adaptTo(SocialMediaHelper.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:18,代码来源:SocialMediaHelperImplTest.java


示例7: getTitleUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Title getTitleUnderTest(String resourcePath, Style style) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Did you forget to define test resource " + resourcePath + "?");
    }
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(SlingBindings.REQUEST, request);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    bindings.put(WCMBindings.CURRENT_PAGE, CONTEXT.pageManager().getPage(TEST_PAGE));
    if (style == null) {
        style = mock(Style.class);
    }
    bindings.put(WCMBindings.CURRENT_STYLE, style);
    request.setResource(resource);
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(Title.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:20,代码来源:TitleImplTest.java


示例8: getListUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private List getListUnderTest(String resourcePath) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Did you forget to defines test resource " + resourcePath + "?");
    }
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    request.setResource(resource);
    request.setContextPath(CONTEXT_PATH);
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(SlingBindings.REQUEST, request);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    Style style = mock(Style.class);
    when(style.get(any(), any(Object.class))).thenAnswer(
            invocation -> invocation.getArguments()[1]
    );
    bindings.put(WCMBindings.CURRENT_STYLE, style);
    bindings.put(WCMBindings.CURRENT_PAGE, CONTEXT.pageManager().getPage(CURRENT_PAGE));
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(List.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:22,代码来源:ListImplTest.java


示例9: init

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
@Override
public void init(Bindings bindings) {
    Resource resource = (Resource) bindings.get(SlingBindings.RESOURCE);

    Object location = bindings.get("location");
    if (location != null) {
        if (location instanceof Resource) {
            resource = (Resource) location;
        } else {
            if (location instanceof String) {
                resource = resource.getResourceResolver().getResource((String) location);
            }
        }
    }

    String name = (String) bindings.get("name");
    if (StringUtils.isBlank(name)) {
        log.info("Invalid property name");
        return;
    }

    values = MultiFieldPanelFunctions.getMultiFieldPanelValues(resource, name);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:24,代码来源:MultiFieldPanelWCMUse.java


示例10: doEndTag

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int doEndTag() throws JspException {
    final SlingHttpServletRequest request = TagUtil.getRequest(pageContext);
    final SlingBindings bindings = (SlingBindings) request.getAttribute(SlingBindings.class.getName());
    final DesignHtmlLibraryManager manager = bindings.getSling().getService(DesignHtmlLibraryManager.class);
    if (manager != null) {
        try {
            if (js && css) {
                manager.writeIncludes(request, getDesign(), region, pageContext.getOut());
            } else if (js) {
                manager.writeJsInclude(request, getDesign(), region, pageContext.getOut());
            } else if (css) {
                manager.writeCssInclude(request, getDesign(), region, pageContext.getOut());
            }
        } catch (IOException e) {
            throw new JspException("Unable to write client library includes", e);
        }
    }
    reset();
    return EVAL_PAGE;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:25,代码来源:IncludeDesignLibrariesTag.java


示例11: currentResource

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
/**
 * get the current resource
 *
 * @param depth
 * @return
 */
public String currentResource(int depth) {
  SlingHttpServletRequest request = (SlingHttpServletRequest) context.getBindings(ScriptContext.ENGINE_SCOPE).get(SlingBindings.REQUEST);

  try {
    return JsonObjectCreator.create(request.getResource(), depth).toString();
  } catch (JSONException e) {
    throw new TechnicalException("could not get current resource", e);
  }
}
 
开发者ID:sinnerschrader,项目名称:aem-react,代码行数:16,代码来源:Sling.java


示例12: getTextUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Text getTextUnderTest(String resourcePath) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    request.setResource(resource);
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(Text.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:11,代码来源:TextImplTest.java


示例13: getButtonUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Button getButtonUnderTest(String resourcePath) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    request.setResource(resource);
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(Button.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:10,代码来源:ButtonImplTest.java


示例14: prepareHiddenFieldForTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Field prepareHiddenFieldForTest(String resourcePath) {
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    request.setResource(resource);
    Page currentPage = CONTEXT.pageManager().getPage(CONTAINING_PAGE);
    SlingBindings slingBindings = new SlingBindings();
    slingBindings.put(WCMBindings.CURRENT_PAGE, currentPage);
    slingBindings.put(SlingBindings.RESOURCE, resource);
    slingBindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    request.setAttribute(SlingBindings.class.getName(), slingBindings);
    return request.adaptTo(Field.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:13,代码来源:HiddenImplTest.java


示例15: getImageUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
protected <T> T getImageUnderTest(String resourcePath, Class<T> imageClass) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Does the test resource " + resourcePath + " exist?");
    }
    ContentPolicyMapping mapping = resource.adaptTo(ContentPolicyMapping.class);
    ContentPolicy contentPolicy = null;
    if (mapping != null) {
        contentPolicy = mapping.getPolicy();
    }
    SlingBindings slingBindings = new SlingBindings();
    Style style = null;
    if (contentPolicy != null) {
        when(contentPolicyManager.getPolicy(resource)).thenReturn(contentPolicy);
        style = new MockContentPolicyStyle(contentPolicy);
    }
    if (style == null) {
        style = mock(Style.class);
        when(style.get(anyString(), (Object) Matchers.anyObject())).thenAnswer(
                invocationOnMock -> invocationOnMock.getArguments()[1]
        );
    }
    slingBindings.put(SlingBindings.RESOURCE, resource);
    final MockSlingHttpServletRequest request =
            new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    request.setContextPath(CONTEXT_PATH);
    request.setResource(resource);
    Page page = CONTEXT.pageManager().getPage(PAGE);
    slingBindings.put(WCMBindings.CURRENT_PAGE, page);
    slingBindings.put(WCMBindings.WCM_MODE, new SightlyWCMMode(request));
    slingBindings.put(WCMBindings.PAGE_MANAGER, CONTEXT.pageManager());
    slingBindings.put(WCMBindings.CURRENT_STYLE, style);
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    request.setAttribute(SlingBindings.class.getName(), slingBindings);
    return request.adaptTo(imageClass);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:37,代码来源:ImageImplTest.java


示例16: getTextUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
protected <T> T getTextUnderTest(Class<T> model, String resourcePath) {
    Resource resource = CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Did you forget to define test resource " + resourcePath + "?");
    }
    MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(CONTEXT.resourceResolver(), CONTEXT.bundleContext());
    SlingBindings bindings = new SlingBindings();
    bindings.put(SlingBindings.RESOURCE, resource);
    bindings.put(SlingBindings.REQUEST, request);
    bindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    request.setResource(resource);
    request.setAttribute(SlingBindings.class.getName(), bindings);
    return request.adaptTo(model);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:15,代码来源:TextImplTest.java


示例17: getLanguageNavigationUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private LanguageNavigation getLanguageNavigationUnderTest(String resourcePath) {
    Resource resource = AEM_CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Does the test resource " + resourcePath + " exist?");
    }
    ContentPolicyMapping mapping = resource.adaptTo(ContentPolicyMapping.class);
    ContentPolicy contentPolicy = null;
    if (mapping != null) {
        contentPolicy = mapping.getPolicy();
    }
    final MockSlingHttpServletRequest request =
            new MockSlingHttpServletRequest(AEM_CONTEXT.resourceResolver(), AEM_CONTEXT.bundleContext());
    request.setContextPath(CONTEXT_PATH);
    request.setResource(resource);
    Page currentPage = AEM_CONTEXT.pageManager().getContainingPage(resource);
    SlingBindings slingBindings = new SlingBindings();
    Style currentStyle;
    if (contentPolicy != null) {
        ContentPolicyManager policyManager = mock(ContentPolicyManager.class);
        when(policyManager.getPolicy(resource)).thenReturn(contentPolicy);
        currentStyle = new MockContentPolicyStyle(contentPolicy);
    } else {
        currentStyle = mock(Style.class);
        when(currentStyle.get(anyString(), (Object) Matchers.anyObject())).thenAnswer(
                invocation -> invocation.getArguments()[1]
        );
    }
    slingBindings.put(SlingBindings.RESOURCE, resource);
    slingBindings.put(WCMBindings.CURRENT_PAGE, currentPage);
    slingBindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    slingBindings.put(WCMBindings.CURRENT_STYLE, currentStyle);
    request.setAttribute(SlingBindings.class.getName(), slingBindings);
    return request.adaptTo(LanguageNavigation.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:35,代码来源:LanguageNavigationImplTest.java


示例18: setUp

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
@Before
public void setUp() {
    slingBindings = (SlingBindings) context.request().getAttribute(SlingBindings.class.getName());
    slingBindings.put(WCMBindings.CURRENT_STYLE, slingBindings = (SlingBindings) context.request().getAttribute(SlingBindings.class
            .getName()));
    slingBindings.put(WCMBindings.CURRENT_PAGE, context.currentPage("/content/en/search/page"));
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:8,代码来源:SearchImplTest.java


示例19: getNavigationUnderTest

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
private Navigation getNavigationUnderTest(String resourcePath) {
    Resource resource = AEM_CONTEXT.resourceResolver().getResource(resourcePath);
    if (resource == null) {
        throw new IllegalStateException("Does the test resource " + resourcePath + " exist?");
    }
    ContentPolicyMapping mapping = resource.adaptTo(ContentPolicyMapping.class);
    ContentPolicy contentPolicy = null;
    if (mapping != null) {
        contentPolicy = mapping.getPolicy();
    }
    final MockSlingHttpServletRequest request =
            new MockSlingHttpServletRequest(AEM_CONTEXT.resourceResolver(), AEM_CONTEXT.bundleContext());
    request.setContextPath(CONTEXT_PATH);
    request.setResource(resource);
    Page currentPage = AEM_CONTEXT.pageManager().getContainingPage(resource);
    SlingBindings slingBindings = new SlingBindings();
    Style currentStyle;
    if (contentPolicy != null) {
        when(POLICY_MANAGER.getPolicy(resource)).thenReturn(contentPolicy);
        currentStyle = new MockContentPolicyStyle(contentPolicy);
    } else {
        currentStyle = mock(Style.class);
        when(currentStyle.get(anyString(), (Object) Matchers.anyObject())).thenAnswer(
                invocation -> invocation.getArguments()[1]
        );
    }
    slingBindings.put(SlingBindings.RESOURCE, resource);
    slingBindings.put(WCMBindings.CURRENT_PAGE, currentPage);
    slingBindings.put(WCMBindings.PROPERTIES, resource.getValueMap());
    slingBindings.put(WCMBindings.CURRENT_STYLE, currentStyle);
    request.setAttribute(SlingBindings.class.getName(), slingBindings);
    return request.adaptTo(Navigation.class);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:34,代码来源:NavigationImplTest.java


示例20: doGet

import org.apache.sling.api.scripting.SlingBindings; //导入依赖的package包/类
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
        throws ServletException, IOException {
    SlingBindings bindings = (SlingBindings) request.getAttribute(SlingBindings.class.getName());
    Page currentPage = (Page) bindings.get(WCMBindings.CURRENT_PAGE);
    final Locale pageLocale = currentPage.getLanguage(true);
    final ResourceBundle bundle = request.getResourceBundle(pageLocale);
    i18n = new I18n(bundle);
    SimpleDataSource countriesDataSource = new SimpleDataSource(buildCountriesList(request.getResourceResolver()).iterator());
    request.setAttribute(DataSource.class.getName(), countriesDataSource);
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-sample-we-retail,代码行数:12,代码来源:CountriesFormOptionsDataSource.java



注:本文中的org.apache.sling.api.scripting.SlingBindings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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