André,
On 2/17/21 11:15, André Warnier (tomcat/perl) wrote:
On 17.02.2021 14:59, Christopher Schultz wrote:
Rony and Leo,
On 2/17/21 02:58, Rony G. Flatscher (Apache) wrote:
Hi Leo,
why would you want to do that if you could do the same with Java?
What is the motivation, the use
case for you?
How urgent is this (I may have something for both, Java EE and
Jakarta EE, but need a little bit of
time)?
—-rony
On 15.02.2021 07:29, leo wrote:
Hi there
I am trying to find out how to process servlets written in
server-side JavaScript through Tomcat.
I looked through the Tomcat FAQ and How-To but couldn't find
anything. By googling I found a way
to hook up Python through Jython's PyServlet class. I tried this and
it works great.
But I am looking for server-side JavaScript in Tomcat. I am aware of
the JavaScript engine
Nashorn. Is there a way to hook up Nashorn with a servlet class, so
that Tomcat serves JavaScript
servlets? Something like a "JavaScript Server Page" for Tomcat would
be fine too.
Many thanks for any pointers,
Leo
ps: I use Tomcat 8.5, but I could move to another Tomcat version for
this.
Weird; I never saw the OP on the list, only Rony's reply.
Usually if you want to use server-side JavaScript, you use something
like Node.js instead of a servlet container. Why not use Node?
If you'd really like to use Tomcat, you will need to write a Servlet
that establishes a JavaScript environment (e.g. Nashhorn), provides
all the plumbing for the servlet-container provided resources (e.g.
request, response, streams, session, etc.) as well as error-handling,
etc.
It's a big job.
I'd be surprised is nobody had built something like this before. Or
maybe everybody just uses Node.js.
+1.
On the face of it, it looks much simpler to set up a local Nodejs
server, and proxy the corresponding requests from Tomcat to it.
Perhaps have a look at this ?
https://stackoverflow.com/questions/42057314/how-to-implement-an-application-proxy-in-java-on-tomcat
Or use an Apache httpd front-end to filter requests and do the proxying
to Nodejs and Tomcat.
+1 to using a different proxy. I'm sure Tomcat can be made into a fine
proxy, but there are other products which exist solely to be proxies.
You will have better luck with Apache Traffic Server, Squid, haproxy,
Apache httpd, Nginx, etc. than you will using Tomcat as a proxy.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org