public override void execute()

        {
            string path = getPwd().lookup(getFileName());

            QuercusPage page = parse(path);

            WriteStream os = new WriteStream(StdoutStream.create());

            os.setNewlineString("\n");
            os.setEncoding("iso-8859-1");

            Env env = createEnv(page, os, null, null);

            env.start();

            try {
                env.execute();
            } catch (QuercusDieException e) {
            } catch (QuercusExitException e) {
            }

            env.close();

            os.flush();
        }
Example #2
0
        public void execute(ReadStream stream)

        {
            QuercusPage page = parse(stream);

            WriteStream os = new WriteStream(StdoutStream.create());

            os.setNewlineString("\n");
            os.setEncoding("iso-8859-1");

            Env env = createEnv(page, os, null, null);

            env.start();

            try {
                env.execute();
            } catch (QuercusDieException e) {
                log.log(Level.FINER, e.ToString(), e);
            } catch (QuercusExitException e) {
                log.log(Level.FINER, e.ToString(), e);
            } catch (QuercusErrorException e) {
                log.log(Level.FINER, e.ToString(), e);
            } finally {
                env.close();

                os.flush();
            }
        }
        /**
         * Executes the script.
         */
        public Value execute(Path path)

        {
            init();

            ReadStream reader = path.openRead();

            QuercusProgram program = QuercusParser.parse(_quercus, null, reader);

            OutputStream os = _out;
            WriteStream out;

            if (os != null)
            {
                OutputStreamStream s  = new OutputStreamStream(os);
                WriteStream        ws = new WriteStream(s);

                ws.setNewlineString("\n");

                try {
                    ws.setEncoding("iso-8859-1");
                } catch (Exception e) {
                }

                @out = ws;
            }
            else
            {
                @out = new WriteStream(StdoutStream.create());
            }

            QuercusPage page = new InterpretedPage(program);

            Env env = new Env(_quercus, page, @out, null, null);

            Value value = NullValue.NULL;

            try {
                env.start();

                value = program.execute(env);
            }
            catch (QuercusExitException e) {
            }

            @out.flushBuffer();
            @out.free();

            if (os != null)
            {
                os.flush();
            }

            return(value);
        }