/** * Evaluates the Jelly script submitted by the client. * * This is useful for system administration as well as unit testing. */ @RequirePOST public void doEval(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(RUN_SCRIPTS); try { MetaClass mc = WebApp.getCurrent().getMetaClass(getClass()); Script script = mc.classLoader.loadTearOff(JellyClassLoaderTearOff.class).createContext().compileScript(new InputSource(req.getReader())); new JellyRequestDispatcher(this,script).forward(req,rsp); } catch (JellyException e) { throw new ServletException(e); } }
try { WebApp webapp = WebApp.getCurrent(); MetaClass meta = webapp.getMetaClass(this); Script s = meta.loadTearOff(JellyClassTearOff.class).findScript("newInstanceDetail"); if (s == null) {
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; } }
/** * Obtains a {@link MetaClass} that represents the type of the given object. * * <p> * This code consults all facets to handle scripting language objects correctly. */ public MetaClass getMetaClass(Object o) { return getMetaClass(getKlass(o)); }
/** * Obtains a {@link MetaClass} that represents the type of the given object. * * <p> * This code consults all facets to handle scripting language objects correctly. */ public MetaClass getMetaClass(Object o) { return getMetaClass(getKlass(o)); }
public MetaClass getMetaClass(Class c) { return getMetaClass(Klass.java(c)); }
public MetaClass getMetaClass(Class c) { return getMetaClass(Klass.java(c)); }
/*package*/ MetaClass(WebApp webApp, Class clazz) { this.clazz = clazz; this.webApp = webApp; this.baseClass = webApp.getMetaClass(clazz.getSuperclass()); this.classLoader = MetaClassLoader.get(clazz.getClassLoader()); buildDispatchers( new ClassDescriptor(clazz,null/*support wrappers*/)); }
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass type, Object it, String viewName) throws IOException { MetaClass mc = request.stapler.getWebApp().getMetaClass(type); return createDispatcher(it, viewName, mc); }
/*package*/ MetaClass(WebApp webApp, Klass<?> klass) { this.clazz = klass.toJavaClass(); this.klass = klass; this.webApp = webApp; this.baseClass = webApp.getMetaClass(klass.getSuperClass()); this.classLoader = MetaClassLoader.get(clazz.getClassLoader()); buildDispatchers(); }
/** * Returns true if this descriptor has <tt>config.jelly</tt>. */ public final boolean hasConfigScreen() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
/** * Returns true if this descriptor has <tt>config.jelly</tt>. */ public final boolean hasConfigScreen() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
/** * Returns true if this descriptor has <tt>config.jelly</tt>. */ public final boolean hasConfigScreen() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
/*package*/ MetaClass(WebApp webApp, Klass<?> klass) { this.clazz = klass.toJavaClass(); this.klass = klass; this.webApp = webApp; this.baseClass = webApp.getMetaClass(klass.getSuperClass()); this.classLoader = MetaClassLoader.get(clazz.getClassLoader()); buildDispatchers(); }
/** * Returns true if this descriptor has <tt>config.jelly</tt>. */ public final boolean hasConfigScreen() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException { TearOffSupport mc = request.stapler.getWebApp().getMetaClass(type); return mc.loadTearOff(ERbClassTearOff.class).createDispatcher(it,viewName); }
/** * Returns true if this descriptor has <tt>config.jelly</tt>. */ public final boolean hasConfigScreen() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
public RequestDispatcher createRequestDispatcher(RequestImpl request, Class type, Object it, String viewName) throws IOException { TearOffSupport mc = request.stapler.getWebApp().getMetaClass(type); return mc.loadTearOff(JellyClassTearOff.class).createDispatcher(it,viewName); }
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException { TearOffSupport mc = request.stapler.getWebApp().getMetaClass(type); return mc.loadTearOff(JellyClassTearOff.class).createDispatcher(it,viewName); }
/** * Evaluates the Jelly script submitted by the client. * * This is useful for system administration as well as unit testing. */ public void doEval(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(ADMINISTER); requirePOST(); try { MetaClass mc = WebApp.getCurrent().getMetaClass(getClass()); Script script = mc.classLoader.loadTearOff(JellyClassLoaderTearOff.class).createContext().compileScript(new InputSource(req.getReader())); new JellyRequestDispatcher(this, script).forward(req, rsp); } catch (JellyException e) { throw new ServletException(e); } }