rhino

Scripting Eclipse with Rhino: classloader belongs to the plugin providing Rhino, not the plugin using it

I am using Rhino to script an Eclipse (RCP) application. The problem is that from Javascript I only have access to classes available to the plugin that provides Rhino, and not to all the classes available to the plugin that runs the scripts. The obvious answer would be to put Rhino in the scripting plugin, but this doesn't work because ...

how to run a javascript function asynchronously, without using setTimeout?

its a server side Javascript (rhino engine), so setTimeout is not available. how to run a function asynchronously? ...

Rhino object browser

Hi, I'm looking for an object browser (in sense of smalltalk class browser) either desktop or better through web, for Rhino. Could anybody point me to such? ...

Load files on a relative path to the current file in Rhino

I am writing a JavaScript program in Rhino which needs to load other JavaScript files. However the built-in load() function loads files relatively to the current directory and I need to load them relatively to the location of the script (so that the program can be called form any directory). In other languages I would use something like...

rhino serverside js licensing

any future plan for rhino to change licensing to lgpl? currently it is gpl, also mean if we use it we required to open source our application right? ...

How do you use Java to call the Rhino Javascript interpreter?

is there any example on using java method to call rhino-javascript function and return it back to java? The only example i found for rhino is only typing command on the rhino shell. ...

Java 6 ScriptEngine and JSON.parse problem

The Rhino release that is included in Java 6 ScriptEngine does not have a JSON parser. I've tried including crockfords JSON2.js in my script on the scriptengine.eval(). When I try to do the JSON.parse, it ends up giving me a script error that .replace is an unknown function. .replace is referenced several places in JSON2, and it works ...

Mocking tools for c# on .NET

Im new to C#/.NET . But Ive been doing TDD for quite some time now. I wanted to what is the best framework that can be used for mocking objects while writing tests in c3 ...

Rhino service bus Loadbalancer

Does anyone know if you can host the LoadBalancing facility within the Rhino.ServiceBus.Host or do i need to build my own windows service purely to run the Load balancer? ...

How to use the Rhino javascript engine in an applet

For my java program I'm using Rhino to execute JS scripts. Now I'm trying to convert it to an applet which works great, except that everytime it's calling evaluateString(...) the JVM throws an AccessControlException. After some (a lot) of research I found out that this is caused by Rhino's custom classloader. My problem is that after hou...

reciving an Element object from rhino when using e4x

hi, i have a java object called myObject with function foo(Element e) that i am binding to the rhino context. in the script i am creating an XML using E4X, my question is how can i would pass this XML object as a parameter to foo? there is one solution to work with Strings something like: var data = new XML(); //Set data using E4X da...

Rhino Mocks - Difference between GenerateStub<T> & GenerateMock<T>

Can any of the Rhino experts explain me by giving a suitable example of the differnce between the above methods on the MockRepository class (Rhino Mocks framework).Where should one use Stub over Mock method or otherwise? ...

How can I add methods from a Java class as global functions in Javascript using Rhino?

I have a simple Java class that has some methods: public class Utils { public void deal(String price, int amount) { // .... } public void bid(String price, int amount) { // .... } public void offer(String price, int amount) { // .... } } I would like to create an instance of this class a...

Rhino: How to get all properties from ScriptableObject?

Hi guys. I am using a Javascript object as an object with configuration properties. E.g. I have this object in javascript: var myProps = {prop1: 'prop1', prop2: 'prop2', 'prop3': 'prop3'}; This object (NativeObject) is returned to me in Java function. E.g. public Static void jsStaticFunction_test(NativeObject obj) { //work with o...

Get all variables of javascript in JAVA

Hello... I am using rhino and Scripting for the Java Platform in order to allow the user extend my application. However the user can write some cases eg (ASTO.value>440) || (ASTO.bellowNormal) etc... The problem is that before running the script from my JAVA application using ScriptEngine i want to get the names of all the variables! B...

Parsing and replacing Javascript identifiers with Rhino in Java

Suppose I let the user to write a condition using Javascript, the user can write conditions to perform a test and return true or false. E.g.: INS>5 || ASTO.valueBetween(10,210) I want to find which variables are used in the script that the user wrote. I tried to find a way to get the identifier names in Java. The Rhino library didn't ...

Mock a void method which change the input value

Hi, How could I mock a void method with parameters and change the value parameters? I want to test a class (SomeClassA) which has a dependency on another class (SomeClassB). I would like to mock SomeClassB. public class SomeClassA { private SomeClassB objectB; private bool GetValue(int x, object y) { objectB.GetVa...

Rhino and Javascript 1.8?

Is it possible to have Rhino use a newer implementation of JS than 1.7? Do we have to wait for mozilla to do this, or is there a community project that has taken the lead? Thanks. ...

Rhino - Convert Paramater Map to Native JS object

What's the "right" way to convert the parameters from request into a native JS object? It seems that no matter what I do, I end up with a java object. ...

How can I specify my own Rhino context in Java?

I'm trying to ensure that my Rhino scripts (running under Java 6) are strict so that if a script developer misspells an expression I want an exception to be thrown. Currently what happens is the expression simply evaluates to "undefined". Now according to Mozilla org https://developer.mozilla.org/en/New_in_Rhino_1.6R6 there are feature...