I've got Rhino running via shell and have been having fun playing
around with it from the command line, but now I'd like to try my hand
at getting Rhino to act like an interpreter to interact with the
browser client.
You say you have Rhino running via the shell. The next step for you would be
getting it running completely in a Java class.
Then, you could use a Servlet containter like tomcat. That will allow you
to, for example, run server-side Java code when a user clicks a button on a
webpage. This Java code will itself initialise Rhino and evaluate some
script, which will return a result to the Java code.
Setting this up is easy (but this is not the place to explain it). Have a
quick google for "tomcat jsp tutorial". Or even better "JSF tutorial".
Again, start off by getting Rhino up-and-running in a Java class. The Rhino
tutorials have dozens of simple examples.
Cheers,
Cormac
2008/12/23 Geuis <geuis...@gmail.com>
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> dev-tech-js-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
Cormac Redmond wrote:
> Hi,
>
> You say you have Rhino running via the shell. The next step for you would be
> getting it running completely in a Java class.
> Then, you could use a Servlet containter like tomcat. That will allow you
> to, for example, run server-side Java code when a user clicks a button on a
> webpage. This Java code will itself initialise Rhino and evaluate some
> script, which will return a result to the Java code.
>
> Setting this up is easy (but this is not the place to explain it). Have a
> quick google for "tomcat jsp tutorial". Or even better "JSF tutorial".
>
> Again, start off by getting Rhino up-and-running in a Java class. The Rhino
> tutorials have dozens of simple examples.
>
>
> Cheers,
> Cormac
>
> 2008/12/23 Geuis <geuis...@gmail.com>
>
>
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> dev-tech-js-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
--
Sent from Gmail for mobile | mobile.google.com
I've been using Rhino for web scripting a lot lately. It is nice --
especially with XML literals (E4X)
On 12/22/08, Geuis <geuis...@gmail.com> wrote:
Maks.
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> dev-tech-js-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
--
Sent from my mobile device
Throwing another option out there: FastCGI. It's is probably less than
ideal, but lots of web servers support FastCGI. Here's a "hello world"
app, a simple counter, using FastCGI's Java library:
importPackage(java.lang);
importPackage(Packages.com.fastcgi);
var count = 0;
while (new FCGIInterface().FCGIaccept() >= 0)
{
count++;
System.out.println("Content-type: text/html\n\n");
System.out.println("<html>");
System.out.println("<head><TITLE>FastCGI-Hello Java stdio</
TITLE></head>");
System.out.println("<body>");
System.out.println("<H3>FastCGI-HelloJava stdio</H3>");
System.out.println("request number " + count + " running on
host " + System.getProperty("SERVER_NAME"));
System.out.println("</body>");
System.out.println("</html>");
}
Requires the Java library from here: http://fastcgi.com/devkit/java/
I haven't been able to get mod_fastcgi to start instances
automatically, only manually by using the [apparently non-standard]
FCGI_PORT environment variable, and setting mod_fastcgi to use
localhost and the same port. Glancing at the library source, it seems
to decide to go into fcgi mode only if FCGI_PORT is set (otherwise it
goes into cgi mode; obviously not suitable for Rhino due to slow JVM
startup speed), so I think this library is outdated/incomplete/not
compatible with mod_fastcgi.
Does anyone know of a better Java FastCGI library? If not, would
anyone be interested in helping update it or write a new one for use
with Rhino?
Thanks.
> Requires the Java library from here: http://fastcgi.com/devkit/java/
>
> I haven't been able to get mod_fastcgi to start instances
> automatically, only manually by using the [apparently non-standard]
> FCGI_PORT environment variable, and setting mod_fastcgi to use
> localhost and the same port. Glancing at the library source, it seems
> to decide to go into fcgi mode only if FCGI_PORT is set (otherwise it
> goes into cgi mode; obviously not suitable for Rhino due to slow JVM
> startup speed), so I think this library is outdated/incomplete/not
> compatible with mod_fastcgi.
>
> Does anyone know of a better Java FastCGI library? If not, would
> anyone be interested in helping update it or write a new one for use
> with Rhino?
In ESXX (http://esxx.org/), I use a FastCGI library called JFast that I
found on the web a couple of years ago. I think it has disappeared since
then. It was licensed under a BSD license.
I've made it available via Subversion, including a few small bug fixes,
at http://svn.berlios.de/svnroot/repos/esxx/ext/jfast/ if anybody is
interested.
(It only supports FastCGI external mode, but that's what I prefer so I
don't mind.)