rhino

building java script debugger for rhino

hi, i am using tomcat server and i have added a rhino engine to able some scripting abilities on my users. the second phase is to provide some debug environment. i know rhino has a debug API but i could not find any documentation/code samples about how to work with it, and build a debugger around it any one knows? ...

how to build javascript debugger with the java scripting engine

Possible Duplicate: is it possible to build a debugger around the java scripting engine? Duplicate of is it possible to build a debugger around the java scripting engine? hi, i have enabled in my application to write java script code and for that i have used the java scripting engine, as the next step i would like to enable c...

getting debug information from the rhino debugFrame

hi, i am using the rhino 1.7 javaScript engine in my project. i have implemented the debugger and debugFrame interfaces, and now i am getting to the public void onDebuggerStatement(Context cx) function. how can i get from the context all the debug information that i need e.g. the list of variables and their value? regards, me :-) ...

Is there a good Rhino Javascript compiler available as Maven plug-in?

Commons JCI project doesn't seem to be maintained since a long time. Are there other options? ...

Mozilla Rhino: Different ways of adding Java object to scope

I've got this piece of Java code with embedded Rhino (irrelevant bits omitted): Context cx = Context.enter(); Scriptable scope = cx.initStandardObjects(); scope.put("foo", scope, Context.toObject(foo, scope)); ScriptableObject.putProperty(scope, "bar", Context.javaToJS(bar, scope)); where foo extends ScriptableObject and bar is just...

How to configure pub sub for multiple subscribers with Rhino Service Bus?

I am trying to set up pub-sub between 1 publisher and multiple subscribers using Rhino Service Bus. However, all I ever seem to get is competing consumers (where messges are distributed between 1 consumer or the other, but not sent to both). My current publisher configuration looks like this (Note: I'm using the new OnewayRhinoServiceB...

No Array.filter() in Rhino?

Why can't I use Array.filter() in Rhino? The code is like this: var simple_reason = ["a", "b", "c"]; print(typeof simple_reason.filter); var not_so_simple_reason = new Array("a", "b", "c"); print(typeof not_so_simple_reason.filter); Both cases output "undefined". ...

Server side Javascript best practices?

We have a CMS built on Java and it has Mozilla Rhino for the server side JS. At the moment the JS code base is small but growing. Before it is too late and code has become a horrible mess I want to introduce some best practices and coding style. Obviously the name space control is pretty important. But how about other best practices - e...

Call javascript interpreter from a script

I've written some scripts in Javascript under Rhino 1.7, one of them starts a minimal http server and accepts JS commands in input. Now, if I call (from within Rhino): engine = ScriptEngineManager().getEngineByName("JavaScript"); I get the builtin JS engine (from Java 1.6), that is an older version of Rhino, and lacks some functions ...

eclipse E4\eclipse 3.6 debuging java script with rhino

hi, i am interested in the E4 eclipse project or eclipse 3.6 this platform offers few thinks that i really find interesting, like debugging javaScript with rhino. unfortunately (but expected) i could not find any material about this platform (in case i succeed i would love to share the knowledge) does anybody knows if the they have ...

Convert a date to string in Javascript

I'm looking for a way to convert a Javascript Date object to a string. I'm converting my site from Ruby to server side Javascript, and I'm looking for something analogous to strftime in Ruby, C, and many other languages. I found plenty of simple scripts that do this kind of conversion, but I'd prefer not to include a custom implementati...

Error when running Rhino

I have downloaded and compiled the newest version of Rhino by going ant compile ant jar When I run it like so I get the following error java -jar js.jar Rhino 1.7 release 2 2009 05 12 Exception in thread "main" java.lang.NullPointerException at org.mozilla.javascript.Kit.classOrNull(Kit.java:92) at org.mozilla...

Rhino Security implementation for use case "user can only see entities for customers assigned to him"

We're building/designing next generation of our sales/ordering/CRM system which comprises of entities like customer (customer hierarchy in particular), order, promotion action, ... Each user of the system should have assigned one or more customers. Users should be organized in a form of organizational hierarchy. The system should con...

Is it possible to create or exchange Javascript properties on access

I would like to have some sort of lazy initialied object properties in javascript and would thus want to somehow overload the property read and write access i.e.: var someval = myobj.lazyprop; // invokes myobj.get("lazyprop"); myobj.lazyprop = someval; // invokes myobj.set("lazyprop",someval); where myobj is some object I provide ...

rhino embedding

Anyone understands the rhino javascript Contexts? I cannot find any useful documentation about it. My main problem is the Context.exit() (really should be cx.exit()) which from what I understand exits the context associated with the current thread? Does that mean I need to keep track of what which thread does? main thread: Context...

[Java > ScriptEngine] Validate JavaScript-Code

Hello, I use Java's ScriptEngine to execute JavaScript Code. I use the Invocable Interface, so that I can use the Script Code as a normal Java Object implementing a Java Interface. If the JavaScript Code is invalid does not follow the interface (missing methods, wrong return type, throws an exception etc.) I get an internal Excepti...

How to access external JAR files from JavaScript using Rhino and Eclipse?

Hi, I'm using Mozilla Rhino to write a JavaScript server application. I would like to include the HttpClient classes in my project to easily access the web, but I can't figure out how to configure my Eclipse project to get Rhino to load the HttpClient JAR file. I have added js.jar (from Rhino) and httpclient-4.0.1.jar to my project's b...

Allocating a char buffer with JNA, Rhino, JavaScript

In Narwhal, we are using JNA to make libc calls like getcwd and chdir. I've only been able to use this with my limited knowledge of the JNA interface as it pertains to JavaScript in Rhino, dealing exclusively with primitives. I need to know how to allocate a char buffer so I can pass it to getcwd, retrieve a JavaScript String from that...

Rhino JavaScript and dynamic scope var creation

I am trying to define a dynamic variable within a function in Rhino JavaScript (specifically what is embedded in Java 6), but I don't want to resort to eval, and I don't want to have to reference it via this. Basically, I want to take an object, and turn every property into a var within the scope of a function... something like: var ab...

Integrating Rhino Security with Asp.net membership providers

How does Rhino security gel with the asp.net membership providers? The reason why I am asking is because AFAIK if I need to use attributes [Authorize] then I should be implementing or extending the asp.net membership providers. In my case as I need more than what asp.net membership provider gives me. Rhino Security is a good fit in t...