@Test public void addSlingBindings() { ServletHelper servletHelper = ctx.getService(ServletHelper.class); servletHelper.addSlingBindings(ctx.request(), ctx.response()); SlingBindings actual = (SlingBindings) ctx.request().getAttribute(SlingBindings.class.getName()); assertEquals(ctx.resourceResolver(), actual.getResourceResolver()); assertNotNull(actual.get(SLING)); assertEquals(ctx.request(), actual.getRequest()); assertEquals(ctx.response(), actual.getResponse()); assertEquals(ctx.currentResource(), actual.getResource()); }
public void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { final SimpleBindings bindings = new SimpleBindings(); final ScriptHelper scriptHelper = new ScriptHelper(bundleContext, null, request, response); bindings.put(SLING, scriptHelper); bindings.put(RESPONSE, response); bindings.put(REQUEST, request); bindings.put(RESOURCE, request.getResource()); bindings.put(RESOLVER, request.getResourceResolver()); final SlingBindings slingBindings = new SlingBindings(); slingBindings.putAll(bindings); request.setAttribute(SlingBindings.class.getName(), slingBindings); }
ServletHelperImpl implements ServletHelper { public void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { final SimpleBindings bindings = new SimpleBindings(); final ScriptHelper scriptHelper = new ScriptHelper(bundleContext, null, request, response); bindings.put(SLING, scriptHelper); bindings.put(RESPONSE, response); bindings.put(REQUEST, request); bindings.put(RESOURCE, request.getResource()); bindings.put(RESOLVER, request.getResourceResolver()); final SlingBindings slingBindings = new SlingBindings(); slingBindings.putAll(bindings); request.setAttribute(SlingBindings.class.getName(), slingBindings); } }
ServletHelperImpl implements ServletHelper { public void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { final SimpleBindings bindings = new SimpleBindings(); final ScriptHelper scriptHelper = new ScriptHelper(bundleContext, null, request, response); bindings.put(SLING, scriptHelper); bindings.put(RESPONSE, response); bindings.put(REQUEST, request); bindings.put(RESOURCE, request.getResource()); bindings.put(RESOLVER, request.getResourceResolver()); final SlingBindings slingBindings = new SlingBindings(); slingBindings.putAll(bindings); request.setAttribute(SlingBindings.class.getName(), slingBindings); }  }
ServletHelperImpl implements ServletHelper { public void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { final SimpleBindings bindings = new SimpleBindings(); final ScriptHelper scriptHelper = new ScriptHelper(bundleContext, null, request, response); bindings.put(SLING, scriptHelper); bindings.put(RESPONSE, response); bindings.put(REQUEST, request); bindings.put(RESOURCE, request.getResource()); bindings.put(RESOLVER, request.getResourceResolver()); final SlingBindings slingBindings = new SlingBindings(); slingBindings.putAll(bindings); request.setAttribute(SlingBindings.class.getName(), slingBindings); }  void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response); }
ServletHelperImpl implements ServletHelper { public void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { final SimpleBindings bindings = new SimpleBindings(); final ScriptHelper scriptHelper = new ScriptHelper(bundleContext, null, request, response); bindings.put(SLING, scriptHelper); bindings.put(RESPONSE, response); bindings.put(REQUEST, request); bindings.put(RESOURCE, request.getResource()); bindings.put(RESOLVER, request.getResourceResolver()); final SlingBindings slingBindings = new SlingBindings(); slingBindings.putAll(bindings); request.setAttribute(SlingBindings.class.getName(), slingBindings); }  void addSlingBindings(final SlingHttpServletRequest request, final SlingHttpServletResponse response);  }