org.apache.sling.engine.SlingRequestProcessor Java Examples
The following examples show how to use
org.apache.sling.engine.SlingRequestProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlingResource.java From sling-whiteboard with Apache License 2.0 | 6 votes |
@GET public Response sling(@PathParam("resourcePath") String resourcePath) throws IOException, LoginException { final SlingRequestProcessor p = SlingContext.get().getService(SlingRequestProcessor.class); assert (p != null); final ResourceResolverFactory fac = SlingContext.get().getService(ResourceResolverFactory.class); assertNotNull("Expecting a ResourceResolverFactory", fac); final ResourceResolver resolver = fac.getResourceResolver(new HashMap<String, Object>()); assertNotNull("Expecting a ResourceResolver", resolver); request.setAttribute(RequestProgressTracker.class.getName(), new SlingRequestProgressTracker(request)); try { p.processRequest(request, new HttpResponse(), resolver); } catch (Exception e) { throw new RuntimeException(e); } final Resource r = (Resource)request.getAttribute(MockServletResolver.RESOURCE_ATTR); return Response.ok(r).build(); }