private static JaggeryContext createJaggeryContext( OutputStream out, String scriptPath, HttpServletRequest request, HttpServletResponse response) { WebAppContext context = new WebAppContext(); context.setTenantId(Integer.toString(CarbonContext.getCurrentContext().getTenantId())); context.setOutputStream(out); context.setServletRequest(request); context.setServletResponse(response); context.setServletConext(request.getServletContext()); context.setScriptPath(scriptPath); context.getIncludesCallstack().push(scriptPath); context.getIncludedScripts().put(scriptPath, true); return context; }