|
Sponsored Links
Resources
Enterprise Java Research Library
Get Java white papers, product information, case studies and webcasts
|
News
News
News
|
Messages: 10
Messages: 10
Messages: 10
Printer friendly
Printer friendly
Printer friendly
Post reply
Post reply
Post reply
XML
XML
XML
|
 |
Rhino in Spring 1.1 released
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.
|
|
Message #228160
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: Advantage?
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.
|
|
Message #228168
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
reinventing the problem...
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!
|
|
Message #228171
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: reinventing the problem...
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.
|
|
Message #228174
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: reinventing the problem...
Maybe, but tell me there isn't a clearer, less verbose way of defining this (which is just about the simplest flow imaginable):
<webflow id="orderFlow" start-state="setupForm"> <!-- The initial state --> <action-state id="setupForm"> <action bean="formAction"/> <transition on="success" to="personalDetailsView"/> <!-- Continue the initial state --> </action-state>
<!-- The initial or error state, depending on where we're coming from --> <view-state id="personalDetailsView" view="enterPersonalDetails"> <transition on="submit" to="bindAndValidatePersonalDetails"/> <!-- To the bat mobile! --> </view-state>
<!-- The submission state -->
<action-state id="bindAndValidatePersonalDetails"> <action bean="formAction" method="bindAndValidate"/> <transition on="success" to="submissionSuccessful"/> <!-- To the success state --> <transition on="error" to="personalDetailsView"/> <!-- To the error state --> </action-state>
<!-- The success state --> <end-state id="submissionSuccessful" view="orderComplete"/> </webflow>
If that's "natural", then it's lost on me.
|
|
Message #228178
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: Advantage?
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.
|
|
Message #228238
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: Advantage?
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
|
|
Message #268386
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: Advantage?
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.
|
|
 |
New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com |
 |
 |
Reza Rahman continues to explore the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6.
(January 21, Article)
Ted Neward is an independent consultant specializing in high-scale enterprise systems, and an authority in Java and .NET technologies. He is the author and co-author of several books, including Effective Enterprise Java. At TheServerSide Java Symposium in March, he will be presenting sessions on pragmatic architecture, ECMAScript and Scala.
(January 15, Article)
Now that Oracle is absorbing Sun Microsystems, there mixed views on what should come of the Java Community Process (JCP). While some say Oracle should become the new steward of Java and keep the JCP much as it was, others argue that it may be time to open-source this widespread language.
(November 24, Article)
Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6.
(November 2, Article)
SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options.
(September 28, Article)
Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team.
(September 22, Article)
Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies.
(July 14, Article)
JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags.
(June 29, Article)
In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project.
(June 23, Tech Talk)
Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now.
(June 15, Tech Talk)
In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements.
(June 15, Tech Talk)
In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls.
(June 4, Tech Talk)
Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable.
(May 28, Tech Talk)
This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work.
(May 26, Tech Talk)
Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers.
(May 21, Tech Talk)
Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application.
(May 19, Article)
Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)
The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)
|
|