Search in sources :

Example 1 with JellyRequestDispatcher

use of org.kohsuke.stapler.jelly.JellyRequestDispatcher in project hudson-2.x by hudson.

the class Hudson method doEval.

/**
     * 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);
    }
}
Also used : ServletException(javax.servlet.ServletException) Script(org.apache.commons.jelly.Script) InputSource(org.xml.sax.InputSource) JellyException(org.apache.commons.jelly.JellyException) MetaClass(org.kohsuke.stapler.MetaClass) JellyRequestDispatcher(org.kohsuke.stapler.jelly.JellyRequestDispatcher)

Aggregations

ServletException (javax.servlet.ServletException)1 JellyException (org.apache.commons.jelly.JellyException)1 Script (org.apache.commons.jelly.Script)1 MetaClass (org.kohsuke.stapler.MetaClass)1 JellyRequestDispatcher (org.kohsuke.stapler.jelly.JellyRequestDispatcher)1 InputSource (org.xml.sax.InputSource)1