public RenderOnDemandClosure(JellyContext context, String attributesToCapture) { List<Script> bodyStack = new ArrayList<Script>(); for (JellyContext c = context; c!=null; c=c.getParent()) { Script script = (Script) c.getVariables().get("org.apache.commons.jelly.body"); if(script!=null) bodyStack.add(script); } this.bodyStack = bodyStack.toArray(new Script[bodyStack.size()]); assert !bodyStack.isEmpty(); // there must be at least one, which is the direct child of <l:renderOnDemand> Map<String,Object> variables = new HashMap<String, Object>(); for (String v : Util.fixNull(attributesToCapture).split(",")) variables.put(v.intern(),context.getVariable(v)); // capture the current base of context for descriptors currentDescriptorByNameUrl = Descriptor.getCurrentDescriptorByNameUrl(); this.variables = PackedMap.of(variables); Set<String> _adjuncts = AdjunctsInPage.get().getIncluded(); this.adjuncts = new String[_adjuncts.size()]; int i = 0; for (String adjunct : _adjuncts) { this.adjuncts[i++] = adjunct.intern(); } }
public RenderOnDemandClosure(JellyContext context, String attributesToCapture) { List<Script> bodyStack = new ArrayList<Script>(); for (JellyContext c = context; c!=null; c=c.getParent()) { Script script = (Script) c.getVariables().get("org.apache.commons.jelly.body"); if(script!=null) bodyStack.add(script); } this.bodyStack = bodyStack.toArray(new Script[bodyStack.size()]); assert !bodyStack.isEmpty(); // there must be at least one, which is the direct child of <l:renderOnDemand> Map<String,Object> variables = new HashMap<String, Object>(); for (String v : Util.fixNull(attributesToCapture).split(",")) variables.put(v.intern(),context.getVariable(v)); // capture the current base of context for descriptors currentDescriptorByNameUrl = Descriptor.getCurrentDescriptorByNameUrl(); this.variables = PackedMap.of(variables); Set<String> _adjuncts = AdjunctsInPage.get().getIncluded(); this.adjuncts = new String[_adjuncts.size()]; int i = 0; for (String adjunct : _adjuncts) { this.adjuncts[i++] = adjunct.intern(); } }
/** * Populate a context with variables, including parent variables if inheritance is enabled. * * @param destContext the destination context * @param sourceContext the source context */ public static void populateVariables( JellyContext destContext, JellyContext sourceContext ) { if ( sourceContext != null ) { if ( !"false".equals( sourceContext.getVariable( "maven.property.inheritance" ) ) && ( !"false".equals( destContext.getVariable( "maven.property.inheritance" ) ) ) ) { populateVariables( destContext, sourceContext.isInherit() ? sourceContext.getParent() : null ); } destContext.getVariables().putAll( sourceContext.getVariables() ); } destContext.setVariable( "context", destContext ); } }
Map m = nestedContext.getVariables(); Object oldAttrs = m.put("attrs",context.getVariable("attrs")); try {
Map m = nestedContext.getVariables(); Object oldAttrs = m.put("attrs",context.getVariable("attrs")); try {
URL rootURL = context.getRootURL(); URL currentURL = context.getCurrentURL(); final Object oldParent=context.getVariables().get(PARENT_TAG); try { Tag tag = getTag(context); return; context.getVariables().put(PARENT_TAG,tag); tag.setContext(context); setContextURLs(context); context.setRootURL(rootURL); context.setCurrentURL(currentURL); context.getVariables().put(PARENT_TAG,oldParent);
protected void exportVariables(StaplerRequest req, StaplerResponse rsp, Script script, Object it, JellyContext context) { Enumeration en = req.getAttributeNames(); // expose request attributes, just like JSP while (en.hasMoreElements()) { String name = (String) en.nextElement(); context.setVariable(name,req.getAttribute(name)); } context.setVariable("request",req); context.setVariable("response",rsp); context.setVariable("it",it); ServletContext servletContext = req.getServletContext(); context.setVariable("servletContext",servletContext); context.setVariable("app",servletContext.getAttribute("app")); // property bag to store request scope variables context.setVariable("requestScope",context.getVariables()); // this variable is needed to make "jelly:fmt" taglib work correctly context.setVariable("org.apache.commons.jelly.tags.fmt.locale",req.getLocale()); }
protected void exportVariables(StaplerRequest req, StaplerResponse rsp, Script script, Object it, JellyContext context) { Enumeration en = req.getAttributeNames(); // expose request attributes, just like JSP while (en.hasMoreElements()) { String name = (String) en.nextElement(); context.setVariable(name,req.getAttribute(name)); } context.setVariable("request",req); context.setVariable("response",rsp); context.setVariable("it",it); ServletContext servletContext = req.getServletContext(); context.setVariable("servletContext",servletContext); context.setVariable("app",servletContext.getAttribute("app")); // property bag to store request scope variables context.setVariable("requestScope",context.getVariables()); // this variable is needed to make "jelly:fmt" taglib work correctly context.setVariable("org.apache.commons.jelly.tags.fmt.locale",req.getLocale()); }
Script script = null; while (c!=null) { script = (Script) c.getVariables().get("org.apache.commons.jelly.body"); if(script!=null) break; c = c.getParent();
if (getContext().getVariables().containsKey( EventFilterTag.CURRENT_FILTER))