172 CHAPTER 9 SCRIPTING AND JSR 223
172 CHAPTER 9 SCRIPTING AND JSR 223 the framework is there for tighter enterprise integration; it is just that Mustang only requires Mustang to run its classes, not some enterprise edition of the Java platform. At least with Mustang, you won t find any servlet objects related to JSR 223. Scripting Engines The scripting package added with Mustang is rather small, at least from the public API perspective: six interfaces, five classes, and an exception. Looking behind the scenes, though, there are many nonpublic elements involved. For instance, the embedded Rhino JavaScript engine has over 140 classes you just never see them or know that you re working with them, thanks to those six interfaces that are defined in the javax.script package. What you ll learn here is how to use the interfaces, not how to create your own engine. The main class of the javax.script package is called ScriptEngineManager. The class provides a discovery mechanism to the installed ScriptEngineFactory objects, which in turn provide access to an actual ScriptEngine. Listing 9-1 demonstrates this relationship from ScriptEngineManager to ScriptEngineFactory to ScriptEngine, displaying information about each factory found. Nothing is actually done with the engine just yet. Listing 9-1. Listing Available Scripting Engine Factories import javax.script.*; import java.io.*; import java.util.*; public class ListEngines { public static void main(String args[]) { ScriptEngineManager manager = new ScriptEngineManager(); List
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services