Provides unlimited scriping abilities in place of writing request handlers.
This class allows you to use any Bean Scripting Framework (BSF) compatable
scripting language such as:
javascript, jacl, netrexx, java, javaclass, bml,
vbscript, jscript, perlscript, perl, jpython,
jython, lotusscript, xslt, pnuts, beanbasic,
beanshell, ruby, judoscript
or any other scripting language that works under BSF. Simply copy the JAR files
for the scripting language into the appropriate lib directory. And define:
<request id="yourRequestId" handlerClass="jwebapp.requestHandlers.Scripting">
<parameter name="scriptFileName" value="/WEB-INF/YourScript.bsh" />
</request>
The script has access to an implicit object named "serverInterface" of the ServerInterface
class. The script also has implicit object access to any additional parameters defined
for the request. The script should return the same forwarding values as any
RequestHandler method.
The script file is located with:
getServletContext().getResource(scriptFileName);
So the script file can be located anywhere including the WEB-INF directory.
The extension of the defined 'scriptFileName' defines the scripting language being used
and that scripting language will automatically be loaded to execute the script.
However, if you need to you can define:
<parameter name="scriptingLanguage" value="" />
To override the script language associated with the script extension.
You can also optionally define the BSF engine and its classpath, use:
<parameter name="scriptingEngineClass" value="" />
<parameter name="scriptingClasspath" value="" />
You can also define:
<parameter name="noCache" value="true" />
To turn script caching off. This is very usefull during the development of the scripts.
|