public Map act( Redirector redirector,
                    SourceResolver resolver,
                    Map objectModel,
                    String source,
                    Parameters par )
    throws Exception {
        Source src = null;
        try {
            // Figure out what script to open.  A missing script name is caught
            // by the resolver/SystemId grouping later on and causes an exception
            String scriptName = source;
            // Locate the appropriate file on the filesytem
            src = resolver.resolve(scriptName);
            String systemID = src.getSystemId();
            if (this.getLogger().isDebugEnabled()) {
                getLogger().debug("script source [" + scriptName + "]");
                getLogger().debug("script resolved to [" + systemID + "]");
            }
            // TODO: why doesn't this work?
            // Reader in = src.getCharacterStream();
            Reader in = new InputStreamReader(src.getInputStream());
            // Set up the BSF manager and register relevant helper "beans"
            BSFManager mgr = new BSFManager();
            HashMap actionMap = new HashMap();
            // parameters to act(...)
            mgr.registerBean("resolver", resolver);
            mgr.registerBean("objectModel", objectModel);
            mgr.registerBean("parameters", par);
            // ScriptAction housekeeping
            mgr.registerBean("actionMap", actionMap);
            // helpers
            // TODO: should we check for a null request object here or let the script handle it?
            mgr.registerBean("logger", getLogger());
            mgr.registerBean("request", ( (Request) objectModel.get(Constants.REQUEST_OBJECT) ) );
            mgr.registerBean("scriptaction", this );
            mgr.registerBean("manager", this.manager );
            getLogger().debug("BSFManager execution begining");
            // Execute the script
            mgr.exec(BSFManager.getLangFromFilename(systemID), systemID, 0, 0,
                    IOUtils.getStringFromReader(in));
            getLogger().debug("BSFManager execution complete");
            // Figure out what to return
            // TODO: decide on a more robust communication method
            if ( actionMap.containsKey( "scriptaction-continue" ) )
            {
                return ( Collections.unmodifiableMap(actionMap) );
            }
            else
            {
                return ( null );
            }
        } catch (ProcessingException e) {
            throw e;
        } catch (Exception e) {
            throw new ProcessingException(
                    "Exception in ScriptAction.act()", e);
        } finally {
            if (src != null) src.recycle();
        } // try/catch
    }
public Map act( Redirector redirector,
                    SourceResolver resolver,
                    Map objectModel,
                    String source,
                    Parameters par )
    throws Exception {
        Source src = null;
        try {
           
           
            String scriptName = source;
           
            src = resolver.resolve(scriptName);
            String systemID = src.getSystemId();
            if (this.getLogger().isDebugEnabled()) {
                getLogger().debug("script source [" + scriptName + "]");
                getLogger().debug("script resolved to [" + systemID + "]");
            }
           
           
            Reader in = new InputStreamReader(src.getInputStream());
           
            BSFManager mgr = new BSFManager();
            HashMap actionMap = new HashMap();
           
            mgr.registerBean("resolver", resolver);
            mgr.registerBean("objectModel", objectModel);
            mgr.registerBean("parameters", par);
           
            mgr.registerBean("actionMap", actionMap);
           
           
            mgr.registerBean("logger", getLogger());
            mgr.registerBean("request", ( (Request) objectModel.get(Constants.REQUEST_OBJECT) ) );
            mgr.registerBean("scriptaction", this );
            mgr.registerBean("manager", this.manager );
            getLogger().debug("BSFManager execution begining");
           
            mgr.exec(BSFManager.getLangFromFilename(systemID), systemID, 0, 0,
                    IOUtils.getStringFromReader(in));
            getLogger().debug("BSFManager execution complete");
           
           
            if ( actionMap.containsKey( "scriptaction-continue" ) )
            {
                return ( Collections.unmodifiableMap(actionMap) );
            }
            else
            {
                return ( null );
            }
        } catch (ProcessingException e) {
            throw e;
        } catch (Exception e) {
            throw new ProcessingException(
                    "Exception in ScriptAction.act()", e);
        } finally {
            if (src != null) src.recycle();
        }
    }
public map act( redirector redirector, sourceresolver resolver, map objectmodel, string source, parameters par ) throws exception { source src = null; try { string scriptname = source; src = resolver.resolve(scriptname); string systemid = src.getsystemid(); if (this.getlogger().isdebugenabled()) { getlogger().debug("script source [" + scriptname + "]"); getlogger().debug("script resolved to [" + systemid + "]"); } reader in = new inputstreamreader(src.getinputstream()); bsfmanager mgr = new bsfmanager(); hashmap actionmap = new hashmap(); mgr.registerbean("resolver", resolver); mgr.registerbean("objectmodel", objectmodel); mgr.registerbean("parameters", par); mgr.registerbean("actionmap", actionmap); mgr.registerbean("logger", getlogger()); mgr.registerbean("request", ( (request) objectmodel.get(constants.request_object) ) ); mgr.registerbean("scriptaction", this ); mgr.registerbean("manager", this.manager ); getlogger().debug("bsfmanager execution begining"); mgr.exec(bsfmanager.getlangfromfilename(systemid), systemid, 0, 0, ioutils.getstringfromreader(in)); getlogger().debug("bsfmanager execution complete"); if ( actionmap.containskey( "scriptaction-continue" ) ) { return ( collections.unmodifiablemap(actionmap) ); } else { return ( null ); } } catch (processingexception e) { throw e; } catch (exception e) { throw new processingexception( "exception in scriptaction.act()", e); } finally { if (src != null) src.recycle(); } }