Package org.apache.bsf

Examples of org.apache.bsf.BSFManager.declareBean()


    public List<?> runGroovy(String script, Object... args) throws Exception {
        List<?> answer;
        BSFManager manager = new BSFManager();

        for (int x = 0; x < args.length; x++) {
            manager.declareBean("arg" + x, args[x], String.class);
        }
        answer = (List) manager.eval("groovy", "script.groovy", 0, 0, script);

        return answer;
    }
View Full Code Here


        try
        {
            IPage page = cycle.getPage();

            bsf.declareBean("component", _component, _component.getClass());
            bsf.declareBean("page", page, page.getClass());
            bsf.declareBean("cycle", cycle, cycle.getClass());

            bsf.exec(
                _language,
View Full Code Here

        try
        {
            IPage page = cycle.getPage();

            bsf.declareBean("component", _component, _component.getClass());
            bsf.declareBean("page", page, page.getClass());
            bsf.declareBean("cycle", cycle, cycle.getClass());

            bsf.exec(
                _language,
                location.getResourceLocation().toString(),
View Full Code Here

        {
            IPage page = cycle.getPage();

            bsf.declareBean("component", _component, _component.getClass());
            bsf.declareBean("page", page, page.getClass());
            bsf.declareBean("cycle", cycle, cycle.getClass());

            bsf.exec(
                _language,
                location.getResourceLocation().toString(),
                location.getLineNumber(),
View Full Code Here

    public XLoper execute(IFunctionContext context, XLoper[] args) throws RequestException {
        try {
            Object[] a = converter.convert(args, createArgHints(args));
            BSFManager manager = new BSFManager();
            manager.declareBean("context", a, IFunctionContext.class);
            manager.declareBean("args", a, Object[].class);
            Object res = manager.eval(lang, name, 1, 1, source);
            return converter.createFrom(res);
        } catch (Throwable e) {
            throw new RequestException(e);
View Full Code Here

    public XLoper execute(IFunctionContext context, XLoper[] args) throws RequestException {
        try {
            Object[] a = converter.convert(args, createArgHints(args));
            BSFManager manager = new BSFManager();
            manager.declareBean("context", a, IFunctionContext.class);
            manager.declareBean("args", a, Object[].class);
            Object res = manager.eval(lang, name, 1, 1, source);
            return converter.createFrom(res);
        } catch (Throwable e) {
            throw new RequestException(e);
        }
View Full Code Here

        HttpSession session = request.getSession();
        ServletContext application = getServlet().getServletContext();

        Script script = loadScript(scriptName, application);

        bsfManager.declareBean("request", request,
                HttpServletRequest.class);

        bsfManager.declareBean("response", response,
                HttpServletResponse.class);
View Full Code Here

        Script script = loadScript(scriptName, application);

        bsfManager.declareBean("request", request,
                HttpServletRequest.class);

        bsfManager.declareBean("response", response,
                HttpServletResponse.class);

        if (session == null) {
            LOG.debug("HTTP session is null");
        } else {
View Full Code Here

                HttpServletResponse.class);

        if (session == null) {
            LOG.debug("HTTP session is null");
        } else {
            bsfManager.declareBean("session", session, HttpSession.class);
        }

        bsfManager.declareBean("application", application,
                ServletContext.class);
View Full Code Here

            LOG.debug("HTTP session is null");
        } else {
            bsfManager.declareBean("session", session, HttpSession.class);
        }

        bsfManager.declareBean("application", application,
                ServletContext.class);

        bsfManager.declareBean("log", LOG, Log.class);
        StrutsInfo struts = new StrutsInfo(this, mapping, form,
                getResources(request));
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.