-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JavaScriptFactory [SPR-1933] #6626
Comments
James Tikalsky commented Some notes: You will need rhino.jar in your classpath for this to work. Download one here: http://www.mozilla.org/rhino/download.html ---- BEGIN JS ---- Your functions can return other JavaScript objects, but you'll be exposing your Java code to the Rhino's classes that represent JavaScript native types. Better to return simple values (String, Double, boolean) for now. I hope that in the future there will be a way to coerce method return types to the Java interface of your choice. |
James Tikalsky commented I noticed a bug: The method requiresConfigInterface() should return true, not false. |
Dave Syer commented I would vote for this if the coercion can be sorted, and if we can add a lang:javascript schema support. The other supported dynamic languages seem to handle the "coercion" (I assume by proxying), so it should't be difficult. Maybe Rick should comment...? |
James Tikalsky commented I've sorted out the return type coercion. I have no idea (right now, anyway) where the schema support is. I'll package up my code and attach it to this bug in the near future. |
James Tikalsky commented Please ignore the old attached .java files. The attached spring-rhino-0-1.jar includes a fix for the return type coercion. lang:javascript support is possible if you apply the attached patch file to the LangNamespaceSupport.java and spring-lang-2.0.xsd files. Please see the attached readme.html file for more info. |
Andrew Fink commented Rhino support in Spring would be "good thing". |
Andrew Fink commented My bug fixed, improved, multi-thread safe, spring 3.0 compatible version "on steroids". I have also enhanced junit tests and can upload them too. |
Andrew Fink commented comment fix: org.springframework.scripting.rhino.zip It is my bug fixed, improved, multi-thread safe, spring 3.0 compatible version "on steroids". I have also enhanced junit tests and can upload them too. |
Andrew Fink commented Some examples: #1 no spring
} #2 full Sprig access <!-- ApplicationListener in js --> var o = new Object(); new Packages.org.springframework.context.ApplicationListener(o); <!-- some prototype bean handler. You can use Spring property to access all ApplicationContext --> function ICR () {}; ICR.prototype.setSocket = function (socket) { Spring.getBean("testSpringAppEventsListener").onApplicationEvent( //just for demo ICR.prototype.getSocket = function () { return null; }; ICR.prototype.run = function () {};//Runnable.run new ICR(); |
Andrew Fink commented Last version: org.springframework.scripting.rhino_100204.zip Ok! Now it is really bug fixed and improved. |
Andrew Fink commented Last version: org.springframework.scripting.rhino_100205.zip
|
Andrew Fink commented Please add JS support to Spring. |
Juergen Hoeller commented Superseded by #9888. |
James Tikalsky opened SPR-1933 and commented
Affects: 2.0 M4
Attachments:
Issue Links:
9 votes, 8 watchers
The text was updated successfully, but these errors were encountered: