|
|
||
Pat Niemeyer's BlogFebruary 2005 ArchivesThe new javax.script API....Posted by pat on February 11, 2005 at 12:11 AM | Permalink | Comments (12)A few days ago the JCP cranked out a public review of JSR-223, which has so far been received with a few blog notes and relatively little discussion. This is not surprising, given that if you you read the JCP description for this group it appears to have something to do with getting PHP pages into WAR files. (Useful, not very exciting). But I'm going to let you in on a little secret. There are really two APIs buried in this specification and one of them is actually quite interesting. Java is about to get a standardized API for working with scripting languages and it's not just about web applications any more. While the original focus of JSR-223 was indeed to develop a standard API for deploying scripted pages in web applications, over the past year the expert group has actually spent most of its time on the lower level, prerequisite API for exposing scripting language engines to the Java platform. The new javax.script package provides a standardized script engine API, similar to the IBM/Apache BSF (Bean Scripting Framework), but takes the integration much further, offering: a more powerful discovery mechanism, fine grained namespace and script environment management, powerful application integration, and other advanced features. Since much of the specification is aimed at scripting engine developers, some of these user APIs may not be immediately obvious. I'll just run down some of the important points here and leave the details for an upcoming article. The Java Scripting API includes:
The reference implementation is available from the JSR-223 home page: http://jcp.org/aboutJava/communityprocess/pr/jsr223/ The download includes javax.script engine implementations for JavaScript, PHP, and Groovy. Interestingly, despite numerous references to the BeanShell Java scripting language in the specification, the development of a BeanShell engine by the spec lead, and the participation of the primary BeanShell developer (me) in the spec development, the Sun download does not include a BeanShell engine implementation or examples. (The politics of Groovy continue to amaze me.) But not to fear, the next release of BeanShell will include an engine implementation as part of its own distribution. Check it out! | ||
|
|