Package org.apache.sling.api.scripting

Examples of org.apache.sling.api.scripting.SlingScript.eval()


        final boolean webClient = "webconsole".equals(WebConsoleUtil.getParameter(req,"client"));

        SlingScript slingScript = resource.adaptTo(SlingScript.class);
        try {
            log.debug("Executing script {}",script);
            slingScript.eval(bindings);
        } catch (Throwable t){
            if(!webClient){
                resp.setStatus(500);
            }
            pw.println(exceptionToString(t));
View Full Code Here


   
    // Execute the script without providing a request or response, in the simplest possible way
    final SlingBindings bindings = new SlingBindings();
    final StringWriter sw = new StringWriter();
    bindings.put("StandaloneScriptExecutionServletOutput", sw);
    script.eval(bindings);
   
    response.setContentType("text/plain");
    response.getWriter().write(sw.toString());
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.