Norris Boyd wrote:
On Jan 20, 10:59 am, Patrick Dobbs <[email protected]>
wrote:
I've got a rhino shell session
starting up a webserver and then registering a javascript handler for
http requests.
However, a shell session presumably creates one Rhino Context. And there
can only be one Thread per Context (or vice versa). So what happens when
a Rhino Shell session (single threaded) starts up a multithreaded web
server, and that webserver then calls into Rhino?
Thanks
Patrick
The typical model is for each request in the web server to enter a
Context and then execute a script. This way you can have multiple
requests being processed concurrently in different threads.
--N
Sorry, my question was rubbish. We currently have a java web application
(Spring, Freemarker etc). We use Rhino in the way you describe, setting
up a new Context for each request, adding some Host objects for the
Http Request and Response etc.
However, for a related project it would be useful if we could start and
run a webserver from within Javascript (e.g. start the Rhino shell, load
a script and call Server.run()).
So, I guess my question is, can a single running script serve multiple
threads?
My understanding is "no", because a Context will reject multiple
threads, but that it would be possible for the script itself to do
something along the lines of the shell function spawn(). Are there
any more detailed examples of using spawn() other than the example
in the javadoc?
Thanks
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino