Examples of JellyContext


Examples of org.apache.commons.jelly.JellyContext

     * @throws IOException
     */
    protected void doRequest(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {

        JellyContext context = createContext(req, res);
        try {
            URL script = getScript(req);
            runScript(script, context, req, res);
        }
        catch (Exception e) {
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

     */
    protected JellyContext createContext(
        HttpServletRequest req,
        HttpServletResponse res) {

        JellyContext ctx = new JellyServletContext(getServletContext());
        ctx.setVariable(REQUEST, req);
        ctx.setVariable(RESPONSE, res);
        return ctx;
    }
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

            jelly.setScript(scriptFile);

            Script script = jelly.compileScript();

            // add the system properties and the command line arguments
            JellyContext context = jelly.getJellyContext();
            context.setVariable("args", args);
            context.setVariable("commandLine", cmdLine);
            script.run(context, output);

            // now lets wait for all threads to close
            Runtime.getRuntime().addShutdownHook(new Thread() {
                    public void run() {
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

            log.debug("Invoking dynamic tag with attributes: " + attributes);
        }
        attributes.put("org.apache.commons.jelly.body", getBody());

        // create new context based on current attributes
        JellyContext newJellyContext = context.newJellyContext(attributes);
        Map attrMap = new HashMap();
        for ( Iterator keyIter = this.attributes.keySet().iterator();
              keyIter.hasNext();) {
            String key = (String) keyIter.next();
            if ( key.endsWith( "Attr" ) ) {
                Object value = this.attributes.get( key );
                attrMap.put( key, value );
                attrMap.put( key.substring( 0, key.length()-4 ), value );
            }
        }
        newJellyContext.setVariable( "attrs", attrMap );
        getTemplate().run(newJellyContext, output);
    }
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

            throw new MissingAttributeException(message);

        try {
            Class type     = ClassLoaderUtils.getClassLoader(getClass()).loadClass(className);
            Object result  = type.getField(field).get(null);
            JellyContext context = getContext();

            context.setVariable(var, result);

        } catch(Throwable t) {
            throw
                new JellyTagException("Could not access " + className + "." +
                                      var + ".  Original exception message: " +
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

public class ScopeTag extends TagSupport {

    // Tag interface
    //-------------------------------------------------------------------------
    public void doTag(XMLOutput output) throws JellyTagException {
        JellyContext newContext = context.newJellyContext();
        getBody().run(newContext, output);
    }
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

                throw new JellyTagException(e);
            }
        }

        // lets create a child context
        final JellyContext newContext = context.newJellyContext();

        Thread thread = new Thread(
            new Runnable() {
                public void run() {
                    try {
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

     *
     * @param script is the URL to the script which should create a TestSuite
     * @return a newly created TestSuite
     */
    public static TestSuite createTestSuite(URL script) throws Exception {
        JellyContext context = new JellyContext(script);
        XMLOutput output = XMLOutput.createXMLOutput(System.out);
        context = context.runScript(script, output);
        TestSuite answer = (TestSuite) context.getVariable("org.apache.commons.jelly.junit.suite");
        if ( answer == null ) {
            log.warn( "Could not find a TestSuite created by Jelly for the script:" + script );
            // return an empty test suite
            return new TestSuite();
        }
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

        // or something?
        TestCase testCase = new TestCase(name) {
            protected void runTest() throws Throwable {
                // create a new child context so that each test case
                // will have its own variable scopes
                JellyContext newContext = new JellyContext( context );

                // disable inheritence of variables and tag libraries
                newContext.setExportLibraries(false);
                newContext.setExport(false);

                // invoke the test case
                getBody().run(newContext, output);
            }
        };
View Full Code Here

Examples of org.apache.commons.jelly.JellyContext

    public static TestSuite suite() throws Exception {
        return new TestSuite(TestXMLParserCache.class);
    }

    public void setUp(String scriptName) throws Exception {
        context = new JellyContext();
        xmlOutput = XMLOutput.createXMLOutput(new StringWriter());

        jelly = new Jelly();

        String script = scriptName;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.