Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidjgonzalez/38550e36e66be3c234c6944fabf67d8f to your computer and use it in GitHub Desktop.
Save davidjgonzalez/38550e36e66be3c234c6944fabf67d8f to your computer and use it in GitHub Desktop.
SlingContextBuilder with Mapping
SlingContextBuilder slingContextBuilder = new SlingContextBuilder(ResourceResolverType.RESOURCERESOLVER_MOCK);
SlingContext context = slingContextBuilder.resourceResolverFactoryActivatorProps(ImmutableMap.<String, Object>builder()
.put("resource.resolver.mapping", new String[]{"/:/", "/content/test/</"})
.build())
.resourceResolverType(ResourceResolverType.RESOURCERESOLVER_MOCK)
.build();
context.create().resource("/content/test/simple", "sling:vanityPath", "/my-vanity");
log.debug(context.resourceResolver().map("/content/test/foo")); // --> LOGS..... /content/test/foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment