public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response, String view) throws JellyException, IOException { WebApp webApp = WebApp.getCurrent(); final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript(view); if (s!=null) { JellyFacet facet = webApp.getFacet(JellyFacet.class); request.setAttribute("taskTags",this); // <l:task> will look for this variable and populate us request.setAttribute("mode","side-panel"); // run sidepanel but ignore generated HTML facet.scriptInvoker.invokeScript(request,response,new Script() { public Script compile() throws JellyException { return this; } public void run(JellyContext context, XMLOutput output) throws JellyTagException { Functions.initPageVariables(context); s.run(context,output); } },self,new XMLOutput(new DefaultHandler())); } else if (self instanceof Actionable) { // fallback this.addAll(((Actionable)self).getAllActions()); } return this; } }
public JellyClassTearOff(MetaClass owner) { super(owner,JellyClassLoaderTearOff.class); facet = owner.webApp.getFacet(JellyFacet.class); }
public JellyRequestDispatcher(Object it, Script script) { this.it = it; this.script = script; facet = WebApp.getCurrent().getFacet(JellyFacet.class); }
public JellyRequestDispatcher(Object it, Script script) { this.it = it; this.script = script; facet = WebApp.getCurrent().getFacet(JellyFacet.class); }
public JellyClassTearOff(MetaClass owner) { super(owner,JellyClassLoaderTearOff.class); facet = WebApp.getCurrent().getFacet(JellyFacet.class); }
/** * Loads the resource bundle associated with the Jelly script. */ public static ResourceBundle load(String jellyUrl) { if(jellyUrl.endsWith(".jelly")) // cut the trailing .jelly jellyUrl = jellyUrl.substring(0,jellyUrl.length()-".jelly".length()); JellyFacet facet = WebApp.getCurrent().getFacet(JellyFacet.class); return facet.resourceBundleFactory.create(jellyUrl); } }
/** * Loads the resource bundle associated with the Jelly script. */ public static ResourceBundle load(String jellyUrl) { if(jellyUrl.endsWith(".jelly")) // cut the trailing .jelly jellyUrl = jellyUrl.substring(0,jellyUrl.length()-".jelly".length()); JellyFacet facet = WebApp.getCurrent().getFacet(JellyFacet.class); return facet.resourceBundleFactory.create(jellyUrl); }
public Script parseScript(URL res) throws IOException { return WebApp.getCurrent().getFacet(JRubyFacet.class).parseScript(res); }
@Override public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException { try { if (req.tokens.hasMore()) return false; if(LOGGER.isLoggable(FINE)) LOGGER.fine("Invoking index"+ rt.getDefaultScriptExtension()+" on " + node); WebApp.getCurrent().getFacet(JellyFacet.class).scriptInvoker.invokeScript(req, rsp, script, node); return true; } catch (JellyTagException e) { throw new ServletException(e); } }
protected boolean invokeScript(RequestImpl req, ResponseImpl rsp, Object node, String next, Script script) throws IOException, ServletException { try { if(script==null) return false; req.tokens.next(); if(traceable()) trace(req,rsp,"Invoking "+next+" on "+node+" for "+req.tokens); WebApp.getCurrent().getFacet(JellyFacet.class).scriptInvoker.invokeScript(req, rsp, script, node); return true; } catch (RuntimeException e) { throw e; } catch (IOException e) { throw e; } catch (Exception e) { throw new ServletException(e); } }
public void write(StaplerRequest req, XMLOutput out) throws SAXException, IOException { if(inclusionFragment!=null) { out.write(inclusionFragment); return; } if (script!=null) try { WebApp.getCurrent().getFacet(JellyFacet.class).scriptInvoker.invokeScript(req, Stapler.getCurrentResponse(), script, this, out); } catch (JellyTagException e) { throw new IOException("Failed to execute Jelly script for adjunct "+name,e); } if(hasCss) out.write("<link rel='stylesheet' href='" + getBaseName(req)+".css' type='text/css' />"); if(hasJavaScript) out.write("<script src='" + getBaseName(req) +".js' type='text/javascript'></script>"); }
public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response, String view) throws JellyException, IOException { WebApp webApp = WebApp.getCurrent(); final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript(view); if (s!=null) { JellyFacet facet = webApp.getFacet(JellyFacet.class); request.setAttribute("taskTags",this); // <l:task> will look for this variable and populate us request.setAttribute("mode","side-panel"); // run sidepanel but ignore generated HTML facet.scriptInvoker.invokeScript(request,response,new Script() { public Script compile() throws JellyException { return this; } public void run(JellyContext context, XMLOutput output) throws JellyTagException { Functions.initPageVariables(context); s.run(context,output); } },self,new XMLOutput(new DefaultHandler())); } else if (self instanceof Actionable) { // fallback this.addAll(((Actionable)self).getAllActions()); } return this; } }
trace(req,rsp,"Invoking "+next+".groovy"+" on "+node+" for "+req.tokens); WebApp.getCurrent().getFacet(JellyFacet.class).scriptInvoker.invokeScript(req, rsp, script, node);
public void write(StaplerRequest req, XMLOutput out) throws SAXException, IOException { if(inclusionFragment!=null) { out.write(inclusionFragment); return; } if (script!=null) try { WebApp.getCurrent().getFacet(JellyFacet.class).scriptInvoker.invokeScript(req, Stapler.getCurrentResponse(), script, this, out); } catch (JellyTagException e) { throw new IOException2("Failed to execute Jelly script for adjunct "+name,e); } if(hasCss) out.write("<link rel='stylesheet' href='" + getBaseName(req)+".css' type='text/css' />"); if(hasJavaScript) out.write("<script src='" + getBaseName(req) +".js' type='text/javascript'></script>"); }