Rhino in Spring 1.1 released

Home

News: Rhino in Spring 1.1 released

  1. Rhino in Spring 1.1 released (10 messages)

    The Rhino in Spring has now reached its next evolutionary release, 1.1. Rhino in Spring aims to integrate the Mozilla Foundation's Rhino JavaScript interpreter for Java with the Spring Framework. The current release includes a controller component for the Spring Web MVC that allows you to express complex multipage flows in your web applications as server-side JavaScript programs. You can use all the amenities of a full-blown imperative programming language while designing flows. You can write libraries of reusable code encapsulated into functions (i.e. validators), you can use the familiar for(), if(), while(), switch/case etc. statements to express the control flow, and so on. Other features and functionalities include;
    • Use of Rhino’s continuations to support high scalability
    • support for back and forward button semantics
    • Support for “new window” split flow semantics
    • client side, in-memory or RDB storage of server state
    • compression, encryption and digital signing of state
    • Support for generic Spring bean factories
    The 1.1 release includes numerous improvements driven by requirements of the project being used in real-world enterprise systems, mostly aimed at adding numerous customization and extension points. Among these are;
    • interceptors for customizing flow pre and postprocessing
    • pluggable script selection strategies
    • support for Rhino's integration with Java security policies
    • support for custom Rhino context factories
    For further detail please visit the Rino in Spring project page.

    Threaded Messages (10)

  2. Spring Web? MVC? thats so yesterday
  3. Advantage?[ Go to top ]

    What would be some advantages to having server-side JavaScript ?
  4. Re: Advantage?[ Go to top ]

    I think the main reason here is that it will allow you to construct your web app using the continuation support provided with Rhino. Of course, whether that's a good idea or not is debatable. This guy certainly doesn't think so. The notion of defining the application flow with a script of some kind is an idea with some merit though, I think. This project seems similar to the concept of flowscripting in Cocoon. It's more intuitive (to me, anyway) than declaring the flow in an xml file as you do with Spring Webflow (although, I believe the xml format is not mandatory). It is immediately obvious from the script how the application is supposed to progress; I'm not sure you can say the same about the xml format.
  5. Re: Advantage?[ Go to top ]

    I think the main reason here is that it will allow you to construct your web app using the continuation support provided with Rhino. Of course, whether that's a good idea or not is debatable. This guy certainly doesn't think so
    Indeed he doesn't. His reasons are: Abandoned sessions: he claims that a flowscript in an abandoned session simply "hangs" in its last continuation, not being able to clean up the resources it holds. This can be true, but it's a bad idea to cling onto resources between requests anyway. External resources are best managed using request-scoped servlet filters and/or interceptors, so the continuations don't hold on to any external resource (i.e. a Hibernate session) between requests but have it managed for them with a session interceptor around the request. This problem is in no way limited to continuation-based state management systems. Thread affinity: true, you lose thread affinity. This is not worse than either COM+ object model or EJB model where you never could assume logical threads of execution have 1-1 mapping to any other (VM or OS) threads. Just don't assume it. Web farm: (aka distributing the HTTP session over several machines for failover and load balancing). Right, your script might end up running different stages of itself on different machines. But the framework must make this transparent, and Rhino-in-Spring makes lots of efforts to deliver on this promise. It uses by-name serialization stubs to mark beans from WebApplicationContext and ServletContext reachable from the continuation, and resolves them to actual beans with by-name lookup on deserialization, thus correctly rebinds the continuation to its global context no matter which physical JVM it is resurrected in. I use a similar approach in a distributed enterprise script execution system I work on for living, and the execution site transparency does wonders for scalability (we can just add another script executor JVM as we need, connecting it to our messaging middleware, and it sucks up load consisting of already running scripts immediately). The Back Button and Branching: in my eyes, it's the best feature of all. You write a single procedural flow script, and it can handle user going back and forth and branching multiple browser tabs. His misconception is that old continuations share local variables and thus you just introduced free-range gotos into your code that operates on a single set of local variables. This is fortunately (for me) and unfortunately (for him) not true. When multiple continuations per session are allowed, then each continuation has a deep copy of its local variables, acquired by serializing/deserializing in memory, so two continuations can't interfere any way with one another. Of course, you must take care to check the validity of the non-local variables between continuations, i.e. not cache results of database queries across requests etc. But you can rest assured that your local variables are safe. They're deeply copied when execution forks.
  6. Re: Advantage?[ Go to top ]

    Alfresco features support for Rhino. You'll find examples of usage here - http://wiki.alfresco.com/wiki/JavaScript_API. It looks pretty cool.
  7. Re: Advantage?[ Go to top ]

    The sense of Server Side Javascript is to use a scripting language instead of Java. Benchmarks show Rhino is the fastest Java Scripting engine. Ciao, Luca Garulli
  8. Re: Advantage?[ Go to top ]

    I am using Rhino and Python to support online dynamic requirements in run time to support J2EE/Spring biz applications. Some thing like Rule engine or Work flow systems. Both of them are platform independent and easy to use. I believe JavaScript is most popular programming language. It is interesting to let the business using of some powerfull logic and programming engine as Rhino.
  9. reinventing the problem...[ Go to top ]

    workflows are definition, not processing, and requires "programming in the large". javascript is a processing language, not a definition language. xml is a more natural choice despite scripting languages enjoying more attention lately. there's also a zillion other reasons why i would never use a highly dynamic language like javascript as a definition language. i guess some people have to learn this the hard way!
  10. Re: reinventing the problem...[ Go to top ]

    there's also a zillion other reasons why i would never use a highly dynamic language like javascript as a definition language.
    I'd really be interested in hearing about concrete examples.
  11. Re: reinventing the problem...[ Go to top ]

    Maybe, but tell me there isn't a clearer, less verbose way of defining this (which is just about the simplest flow imaginable): <!-- The initial state --> <!-- Continue the initial state --> <!-- The initial or error state, depending on where we're coming from --> <!-- To the bat mobile! --> <!-- The submission state --> <!-- To the success state --> <!-- To the error state --> <!-- The success state --> If that's "natural", then it's lost on me.