How to retrieve SlingHttpServletRequest from ResourceResolver
I would like to retrieve the request used to resolve the resources I retrieve from the ResourceResolver.
I am performing integration testing using Teleporter Rule And can resolve the resource but can't find its corresponding request.
@Rule public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "Launchpad");
@Test public void testPage() throws LoginException {
ResourceResolverFactory resourceResolverFactory = teleporter.getService(ResourceResolverFactory.class);
ResourceResolver resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
Resource resource = resourceResolver.getResource("/content/test/en");
PageModel page = resource.adaptTo(PageModel.class);
} I would like to be able to retrieve the request like I can with my unit tests using SlingContext.
SlingContextImpl slingContext = new SlingContextImpl();
slingContext.currentResource("/content/test/en");
slingContext.request() I would like to retrieve the request like I can with my unit tests and properly test my sling models that inject the request.