WCM IO测试吊索映射

时间:2018-06-07 07:43:08

标签: adobe aem sling

我正在尝试在WCM IO中测试我的吊索映射,但似乎它们没有被拾取:这就是我加载映射的方式:

context.load().json("/sample-content/sling-mappings/etc-map.json", "/etc/map");

等-map.json:

{
  "jcr:primaryType": "sling:Folder",
  "jcr:createdBy": "admin",
  "hidden": "true",
  "http": {
    "jcr:primaryType": "sling:Folder",
    "jcr:createdBy": "admin",
    "mysite_be": {
      "jcr:primaryType": "sling:Mapping",
      "jcr:createdBy": "admin",
      "sling:match": "mysite.be/nl/(.+)$",
      "sling:internalRedirect": [
        "/content/mysite/nl/$1"
      ],
      "redirect": {
        "jcr:primaryType": "sling:Mapping",
        "jcr:createdBy": "admin",
        "sling:match": "(.+)$",
        "sling:internalRedirect": [
          "/content/mysite/nl/$1"
        ]
      }
    }
  }
}

调试resourceResolver上的map方法:

enter image description here

我做错了什么?

注意:在我启动并运行的AEM环境中,当我在.../system/console/jcrresolver下试用时,映射可以正常工作。

1 个答案:

答案 0 :(得分:1)

我担心ResourceResolverMock没有实现真正的资源映射。

https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-testing-resourceresolver-mock.git;a=blob;f=src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java;hb=HEAD

随意贡献。但说实话,我也从未这样做过(对我感到羞耻)。