I need to pass parameter to remote beanshell script which is run through
java -cp bsh-2.0b4.jar bsh.Remote http://10.0.0.1/beanshell script.bsh p1 p2 p3
call.
Is it somehow possible to read params 'p1', 'p2' and 'p3' from within the script.bsh
?
p.s. Local params passing through bsh.args
works fine, but it's unusable with remote scripting.
I suppose, you are using beanshell library. There is no way to do so, according to sources: the utility takes only 2 arguments: the URL and the local script filename. It even does not support several script filenames, as it claim to.
public class Remote
{
public static void main( String args[] ) throws Exception
{
if ( args.length < 2 ) {
System.out.println("usage: Remote URL(http|bsh) file [ file ] ... ");
System.exit(1);
}
String url = args[0];
String text = getFile(args[1]);
int ret = eval( url, text );
System.exit( ret );
}
Also the server-side should be aware about the arguments passed.
The ways out for you:
bsh.Remote
bsh.Remote
.