On Thu, 26 Jun 2003, David N. Welton wrote:

> Date: 26 Jun 2003 14:55:02 +0200
> From: David N. Welton <[EMAIL PROTECTED]>
> Reply-To: [email protected]
> To: [email protected]
> Subject: Java + Scripting languages
>
>
> Hi guys, I saw this:
>
> http://www.jcp.org/en/jsr/detail?id=223
>
>         The specification may include a Java API that can be used,
>         possibly through JNI, by an scripting language engine to
>         access the desired Java objects.
>
> Can anyone give us a more concrete description of what this is really
> about?
>

The basis for this is exactly what that sentence states -- scripting
language users have said they would like to be able to access business
logic and data objects inside a servlet-based application from their
scripts, in a portable manner.  The point of the JSR is to make that sort
of thing possible.

As Stefano points out, Sam did indeed create some code to do this.  Just
two little problem though, it's non-thread safe (uses instance variables
for per-request state), and it's not scalable.  And, it only deals with
PHP, but there's lots of other scripting languages (and scripting language
users) in the world that could benefit from the same ability.

Doing this kind of integration for a scripting language written in Java
(or indirectly wrapped by something like BSF) is pretty easy, because the
Java code can directly talk to servlet APIs.  It's not quite that easy for
a scripting language implemented in a non-Java language (like PHP), where
you have to create some additional mechanisms to access web application
resources from a scripting page.

Accessing Java objects defined in the system class loader doesn't require
anything new -- JNI provides all the necessary hooks.  But, to interact
with web app resources, you need to do things like load classes from the
webapp's class loader, and gain access to the ServletContext instance,
and perhaps even do nice things like utilize the servlet container's
session mechanism for scripting languages that don't have such a notion.
Such things can be designed and built for a particular server today, but
there's no standard approach; hence the JSR.

> It looks interesting, because... hey, who wouldn't want to associate
> with a million dollar marketing machine:-)

It's actually going to be a pretty good win-win ... scripting language
users gain access to business logic and services already written in Java,
and the Java community has the opportunity to grow by virtue of being
useful to people who don't currently use it.

>
> --
> David N. Welton

Craig McClanahan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to