Package org.apache.sling.api.scripting

Examples of org.apache.sling.api.scripting.SlingBindings


     * </ul>
     *
     * @return always {@link #EVAL_PAGE}.
     */
    public int doEndTag() {
        final SlingBindings bindings = (SlingBindings)pageContext.getRequest().getAttribute(SlingBindings.class.getName());
        final SlingScriptHelper scriptHelper = bindings.getSling();

        pageContext.setAttribute(requestName, scriptHelper.getRequest());
        pageContext.setAttribute(responseName, scriptHelper.getResponse());
        final Resource resource = scriptHelper.getRequest().getResource();
        pageContext.setAttribute(resourceName, resource);
        pageContext.setAttribute(resourceResolverName, scriptHelper.getRequest().getResourceResolver());
        pageContext.setAttribute(slingName, scriptHelper);
        pageContext.setAttribute(logName, bindings.getLog());
        final Node node = resource.adaptTo(Node.class);
        if (node != null) {
            pageContext.setAttribute(nodeName, node);
        }

View Full Code Here


    return slingScriptHelper.getService(InjectorsRepository.class);
  }

  private static SlingScriptHelper getSlingScriptHelper(final PageContext pageContext) {
    ServletRequest request = pageContext.getRequest();
    SlingBindings bindings = (SlingBindings) request.getAttribute(SlingBindings.class.getName());
    return bindings.getSling();
  }
View Full Code Here

     * @param request
     * @return
     */
    public static SlingScriptHelper getSlingScriptHelper(SlingHttpServletRequest request) {
        // Get SlingScriptHelper from SlingBindings included as an attribute on the Sling HTTP Request
        SlingBindings slingBindings = (SlingBindings) request.getAttribute(SlingBindings.class.getName());
        if (slingBindings == null) {
            throw new IllegalArgumentException(
                    "SlingHttpServletRequest most have contain a SlingBindings object at key: " + SlingBindings.class.getName());
        }

        return slingBindings.getSling();
    }
View Full Code Here

            throw new IllegalArgumentException(
                    "Sling HTTP Request must NOT be null.");
        }

        // Get SlingScriptHelper from SlingBindings included as an attribute on the Sling HTTP Request
        SlingBindings slingBindings = (SlingBindings) this.request.getAttribute(SlingBindings.class.getName());
        if (slingBindings == null) {
            throw new IllegalArgumentException(
                    "SlingHttpServletRequest most have contain a SlingBindings object at key: " + SlingBindings.class.getName());
        }

        // Sling Script Helper
        this.slingScriptHelper = slingBindings.getSling();
        if (this.slingScriptHelper == null) {
            throw new IllegalArgumentException(
                    "SlingScriptHelper must NOT be null.");
        }
View Full Code Here

    return slingScriptHelper.getService(InjectorsRepository.class);
  }

  private static SlingScriptHelper getSlingScriptHelper(final PageContext pageContext) {
    ServletRequest request = pageContext.getRequest();
    SlingBindings bindings = (SlingBindings) request.getAttribute(SlingBindings.class.getName());
    return bindings.getSling();
  }
View Full Code Here

TOP

Related Classes of org.apache.sling.api.scripting.SlingBindings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.