Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-04 Thread Christopher Schultz

Rony,

On 3/4/21 07:00, Rony G. Flatscher (Apache) wrote:

Hi Chris,

On 03.03.2021 22:33, Christopher Schultz wrote:

Rony,

On 3/3/21 06:42, Rony G. Flatscher (Apache) wrote:

Hi Chris,

On 02.03.2021 17:48, Christopher Schultz wrote:

Rony,

On 2/28/21 11:33, Rony G. Flatscher (Apache) wrote:

Leo,

On 26.02.2021 01:52, leo wrote:

On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:


P.S.: Have tested my implementation with Nashorn on Java 8 and it works out of 
the box!
Still, you
would need to test the implementation thoroughly yourself (stability, 
performance, resources)
and
would be asked to come back with feedback on each of these qualities. So stay 
tuned, will
publish a
link to the implementation with a proper Nashorn/JavaScript sample war in this 
mail thread in a
few
days.


How cool is this! Let me know when you it ready, please. Thanks a lot!


O.K., had a few things I could finalize. Created two war files, 
"demoJavaScript.war" and
"demoRhino.war". The first got tested against Nashorn, the second - you guessed 
it ;) - against
Rhino (7.1.13). They are meant as little proof-of-concepts that should help you 
to get up and
running with them.

Please note that the libraries are beta, though appear to be stable. Yet, there 
may be
errors/problems in them or there may be changes coming up.

If you have feedback of any sorts, please come forward (stability, usability, 
performance,
resources, etc.).

Basically you just need to go to [1] and get the two war-files (copy to 
$CATALINA_HOME/webapps)
plus
either javax.ScriptTagLibs.jar (for Tomcat 9 or earlier) or 
jakarta.ScriptTagLibs.jar (for Tomcat
10) which you should copy to the shared directory at $CATALINA_HOME/lib and 
restart Tomcat to get
them recognized. If you want to test with Rhino you should follow the 
directions at [1] and
copy the
mentioned two rhino jar files to the shared library directory as well.

In general you should take the time and look over that page at [1], I tried to 
remain as brief as
possible. :)

Also please do not forget that the target audience of [1] has been so far the 
Rexx community
and my
BA students who learned programming using ooRexx in a semester and with that 
knowledge should now
become able to create little web sites for their own purposes and maybe with 
some experience for
small businesses/organizations given the information at [1] as a starting point.

Of course, if there are any questions please do not hesitate and please ask 
them!


Any source available?


Sure, sorry forgot to point that out explicitly!

You can get at it either in the ScriptTagLibs jar files from [1] (yes, in this 
case I have the
source and also the tld files in the jar for completeness as well) or from [2] 
with the appropriate
checkout strings given in the upper half.

Also, the license is AL 2.0, of course (dual licensed with the CPL 1.0 license 
in addition which the
ooRexx project uses).

Please note: currently the state is beta, it is functional and appears to be 
stable.


This is a pretty awesome effort.

Thank you!

Since you work at a university, perhaps some of your students would be 
interested in working on
the library itself and not just in being an end-user. Maybe CS students at the 
same uni though not
in your program. They could probably get credit for working on it, too.


Currently there are only BA students available, some of them with an interest 
in CS and rarely some
that have already good programming skills in Java when coming to my "business 
programming" classes.
That situation has been the main motivation for creating this tag library. 
Depending on feedback and
free time I will enhance/overhaul it.


Maybe you can find some other related university where the CS talent 
pool is stronger and see if you can partner with their CS department.


I just see this as a good way for students to work with other students 
(suppliers and users) and also to get everyone familiar with Open Open 
Source software.



A request: if you see something questionable, improvable or missing, please be 
so kind and let me
know!

There is certainly room for improvements, especially through the eyes of an 
Tomcat/Servlet expert
like yourself! :) E.g., it would be nice to put the tld files into the jar and 
allow the JSPs to
refer to them without the need to copy them to WEB-INF as is possible with the 
STL ; if I knew how
to do that, I would do it as it improves usability (ran out of time to research 
that specific
feature).


Just put your .tld files in META-INF/ in your JAR file and Tomcat should detect 
them. You will
need to put those files into the web application's WEB-INF/lib directory. (I 
think... I can't
remember if Tomcat checks CATALINA_BASE/lib/*.jar for TLD files or not.)


Thank you for these pointers. Took some time to experiment with it, but it did 
not work out, neither
in CATALINA_BASE/lib nor in WEB-INF/lib. The startup-log states in either case:

 04-Mar-2021 12:15:20.624 INFO [main] 

Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-04 Thread Rony G. Flatscher (Apache)
Hi Chris,

On 03.03.2021 22:33, Christopher Schultz wrote:
> Rony,
>
> On 3/3/21 06:42, Rony G. Flatscher (Apache) wrote:
>> Hi Chris,
>>
>> On 02.03.2021 17:48, Christopher Schultz wrote:
>>> Rony,
>>>
>>> On 2/28/21 11:33, Rony G. Flatscher (Apache) wrote:
 Leo,

 On 26.02.2021 01:52, leo wrote:
> On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:
>
>> P.S.: Have tested my implementation with Nashorn on Java 8 and it works 
>> out of the box!
>> Still, you
>> would need to test the implementation thoroughly yourself (stability, 
>> performance, resources)
>> and
>> would be asked to come back with feedback on each of these qualities. So 
>> stay tuned, will
>> publish a
>> link to the implementation with a proper Nashorn/JavaScript sample war 
>> in this mail thread in a
>> few
>> days.
>
> How cool is this! Let me know when you it ready, please. Thanks a lot!

 O.K., had a few things I could finalize. Created two war files, 
 "demoJavaScript.war" and
 "demoRhino.war". The first got tested against Nashorn, the second - you 
 guessed it ;) - against
 Rhino (7.1.13). They are meant as little proof-of-concepts that should 
 help you to get up and
 running with them.

 Please note that the libraries are beta, though appear to be stable. Yet, 
 there may be
 errors/problems in them or there may be changes coming up.

 If you have feedback of any sorts, please come forward (stability, 
 usability, performance,
 resources, etc.).

 Basically you just need to go to [1] and get the two war-files (copy to 
 $CATALINA_HOME/webapps)
 plus
 either javax.ScriptTagLibs.jar (for Tomcat 9 or earlier) or 
 jakarta.ScriptTagLibs.jar (for Tomcat
 10) which you should copy to the shared directory at $CATALINA_HOME/lib 
 and restart Tomcat to get
 them recognized. If you want to test with Rhino you should follow the 
 directions at [1] and
 copy the
 mentioned two rhino jar files to the shared library directory as well.

 In general you should take the time and look over that page at [1], I 
 tried to remain as brief as
 possible. :)

 Also please do not forget that the target audience of [1] has been so far 
 the Rexx community
 and my
 BA students who learned programming using ooRexx in a semester and with 
 that knowledge should now
 become able to create little web sites for their own purposes and maybe 
 with some experience for
 small businesses/organizations given the information at [1] as a starting 
 point.

 Of course, if there are any questions please do not hesitate and please 
 ask them!
>>>
>>> Any source available?
>>
>> Sure, sorry forgot to point that out explicitly!
>>
>> You can get at it either in the ScriptTagLibs jar files from [1] (yes, in 
>> this case I have the
>> source and also the tld files in the jar for completeness as well) or from 
>> [2] with the appropriate
>> checkout strings given in the upper half.
>>
>> Also, the license is AL 2.0, of course (dual licensed with the CPL 1.0 
>> license in addition which the
>> ooRexx project uses).
>>
>> Please note: currently the state is beta, it is functional and appears to be 
>> stable.
>
> This is a pretty awesome effort. 
Thank you!
> Since you work at a university, perhaps some of your students would be 
> interested in working on
> the library itself and not just in being an end-user. Maybe CS students at 
> the same uni though not
> in your program. They could probably get credit for working on it, too.

Currently there are only BA students available, some of them with an interest 
in CS and rarely some
that have already good programming skills in Java when coming to my "business 
programming" classes.
That situation has been the main motivation for creating this tag library. 
Depending on feedback and
free time I will enhance/overhaul it.

>
>> A request: if you see something questionable, improvable or missing, please 
>> be so kind and let me
>> know!
>>
>> There is certainly room for improvements, especially through the eyes of an 
>> Tomcat/Servlet expert
>> like yourself! :) E.g., it would be nice to put the tld files into the jar 
>> and allow the JSPs to
>> refer to them without the need to copy them to WEB-INF as is possible with 
>> the STL ; if I knew how
>> to do that, I would do it as it improves usability (ran out of time to 
>> research that specific
>> feature).
>
> Just put your .tld files in META-INF/ in your JAR file and Tomcat should 
> detect them. You will
> need to put those files into the web application's WEB-INF/lib directory. (I 
> think... I can't
> remember if Tomcat checks CATALINA_BASE/lib/*.jar for TLD files or not.)

Thank you for these pointers. Took some time to experiment with it, but it did 
not work out, neither
in CATALINA_BASE/lib nor in 

Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-03 Thread Christopher Schultz

Rony,

On 3/3/21 06:42, Rony G. Flatscher (Apache) wrote:

Hi Chris,

On 02.03.2021 17:48, Christopher Schultz wrote:

Rony,

On 2/28/21 11:33, Rony G. Flatscher (Apache) wrote:

Leo,

On 26.02.2021 01:52, leo wrote:

On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:


P.S.: Have tested my implementation with Nashorn on Java 8 and it works out of 
the box! Still, you
would need to test the implementation thoroughly yourself (stability, 
performance, resources) and
would be asked to come back with feedback on each of these qualities. So stay 
tuned, will
publish a
link to the implementation with a proper Nashorn/JavaScript sample war in this 
mail thread in a
few
days.


How cool is this! Let me know when you it ready, please. Thanks a lot!


O.K., had a few things I could finalize. Created two war files, 
"demoJavaScript.war" and
"demoRhino.war". The first got tested against Nashorn, the second - you guessed 
it ;) - against
Rhino (7.1.13). They are meant as little proof-of-concepts that should help you 
to get up and
running with them.

Please note that the libraries are beta, though appear to be stable. Yet, there 
may be
errors/problems in them or there may be changes coming up.

If you have feedback of any sorts, please come forward (stability, usability, 
performance,
resources, etc.).

Basically you just need to go to [1] and get the two war-files (copy to 
$CATALINA_HOME/webapps) plus
either javax.ScriptTagLibs.jar (for Tomcat 9 or earlier) or 
jakarta.ScriptTagLibs.jar (for Tomcat
10) which you should copy to the shared directory at $CATALINA_HOME/lib and 
restart Tomcat to get
them recognized. If you want to test with Rhino you should follow the 
directions at [1] and copy the
mentioned two rhino jar files to the shared library directory as well.

In general you should take the time and look over that page at [1], I tried to 
remain as brief as
possible. :)

Also please do not forget that the target audience of [1] has been so far the 
Rexx community and my
BA students who learned programming using ooRexx in a semester and with that 
knowledge should now
become able to create little web sites for their own purposes and maybe with 
some experience for
small businesses/organizations given the information at [1] as a starting point.

Of course, if there are any questions please do not hesitate and please ask 
them!


Any source available?


Sure, sorry forgot to point that out explicitly!

You can get at it either in the ScriptTagLibs jar files from [1] (yes, in this 
case I have the
source and also the tld files in the jar for completeness as well) or from [2] 
with the appropriate
checkout strings given in the upper half.

Also, the license is AL 2.0, of course (dual licensed with the CPL 1.0 license 
in addition which the
ooRexx project uses).

Please note: currently the state is beta, it is functional and appears to be 
stable.


This is a pretty awesome effort. Since you work at a university, perhaps 
some of your students would be interested in working on the library 
itself and not just in being an end-user. Maybe CS students at the same 
uni though not in your program. They could probably get credit for 
working on it, too.



A request: if you see something questionable, improvable or missing, please be 
so kind and let me know!

There is certainly room for improvements, especially through the eyes of an 
Tomcat/Servlet expert
like yourself! :) E.g., it would be nice to put the tld files into the jar and 
allow the JSPs to
refer to them without the need to copy them to WEB-INF as is possible with the 
STL ; if I knew how
to do that, I would do it as it improves usability (ran out of time to research 
that specific feature).


Just put your .tld files in META-INF/ in your JAR file and Tomcat should 
detect them. You will need to put those files into the web application's 
WEB-INF/lib directory. (I think... I can't remember if Tomcat checks 
CATALINA_BASE/lib/*.jar for TLD files or not.)


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-03 Thread Rony G. Flatscher (Apache)
Hi Leo,

On 03.03.2021 00:40, leo wrote:
> Rony,
>
>> O.K., had a few things I could finalize. Created two war files, 
>> "demoJavaScript.war" and
>> "demoRhino.war". The first got tested against Nashorn, the second - you 
>> guessed it ;) - against
>> Rhino (7.1.13). They are meant as little proof-of-concepts that should help 
>> you to get up and
>> running with them.
>> […]
>
> Thank you very much. Will check it out!

Fine, please be so kind and give feedback of any sorts you have!

---rony


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-03 Thread Rony G. Flatscher (Apache)
Hi Chris,

On 02.03.2021 17:48, Christopher Schultz wrote:
> Rony,
>
> On 2/28/21 11:33, Rony G. Flatscher (Apache) wrote:
>> Leo,
>>
>> On 26.02.2021 01:52, leo wrote:
>>> On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:
>>>
 P.S.: Have tested my implementation with Nashorn on Java 8 and it works 
 out of the box! Still, you
 would need to test the implementation thoroughly yourself (stability, 
 performance, resources) and
 would be asked to come back with feedback on each of these qualities. So 
 stay tuned, will
 publish a
 link to the implementation with a proper Nashorn/JavaScript sample war in 
 this mail thread in a
 few
 days.
>>>
>>> How cool is this! Let me know when you it ready, please. Thanks a lot!
>>
>> O.K., had a few things I could finalize. Created two war files, 
>> "demoJavaScript.war" and
>> "demoRhino.war". The first got tested against Nashorn, the second - you 
>> guessed it ;) - against
>> Rhino (7.1.13). They are meant as little proof-of-concepts that should help 
>> you to get up and
>> running with them.
>>
>> Please note that the libraries are beta, though appear to be stable. Yet, 
>> there may be
>> errors/problems in them or there may be changes coming up.
>>
>> If you have feedback of any sorts, please come forward (stability, 
>> usability, performance,
>> resources, etc.).
>>
>> Basically you just need to go to [1] and get the two war-files (copy to 
>> $CATALINA_HOME/webapps) plus
>> either javax.ScriptTagLibs.jar (for Tomcat 9 or earlier) or 
>> jakarta.ScriptTagLibs.jar (for Tomcat
>> 10) which you should copy to the shared directory at $CATALINA_HOME/lib and 
>> restart Tomcat to get
>> them recognized. If you want to test with Rhino you should follow the 
>> directions at [1] and copy the
>> mentioned two rhino jar files to the shared library directory as well.
>>
>> In general you should take the time and look over that page at [1], I tried 
>> to remain as brief as
>> possible. :)
>>
>> Also please do not forget that the target audience of [1] has been so far 
>> the Rexx community and my
>> BA students who learned programming using ooRexx in a semester and with that 
>> knowledge should now
>> become able to create little web sites for their own purposes and maybe with 
>> some experience for
>> small businesses/organizations given the information at [1] as a starting 
>> point.
>>
>> Of course, if there are any questions please do not hesitate and please ask 
>> them!
>
> Any source available?

Sure, sorry forgot to point that out explicitly!

You can get at it either in the ScriptTagLibs jar files from [1] (yes, in this 
case I have the
source and also the tld files in the jar for completeness as well) or from [2] 
with the appropriate
checkout strings given in the upper half.

Also, the license is AL 2.0, of course (dual licensed with the CPL 1.0 license 
in addition which the
ooRexx project uses).

Please note: currently the state is beta, it is functional and appears to be 
stable.

A request: if you see something questionable, improvable or missing, please be 
so kind and let me know!

There is certainly room for improvements, especially through the eyes of an 
Tomcat/Servlet expert
like yourself! :) E.g., it would be nice to put the tld files into the jar and 
allow the JSPs to
refer to them without the need to copy them to WEB-INF as is possible with the 
STL ; if I knew how
to do that, I would do it as it improves usability (ran out of time to research 
that specific feature).

---rony

[1] Beta directory for the ScriptTagLibs and demo war files for ooRexx, 
Nashorn, Rhino, source
included in the jar files:
.
Please note: "demoRexx.war" demonstrates all attributes and in addition has two 
utility samples, one
injecting the implicit JSP objects and the current values of the getter 
methods, which might be
helpful when developing or debugging a webapp.

[2] dev directory for the ScriptTagLibs:

Please note: the dev subdirectories have Windows cmd-files for creating the jar 
files, if you create
Unix versions of them, please share (just did not have the time to create the 
appropriate shell
scripts, an item on the todo list)! :) In essence the bsf and jsr223 are 
identical except for the
compile attribute which is only available for the JSR-223.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-02 Thread leo

Rony,

O.K., had a few things I could finalize. Created two war files, 
"demoJavaScript.war" and
"demoRhino.war". The first got tested against Nashorn, the second - 
you guessed it ;) - against
Rhino (7.1.13). They are meant as little proof-of-concepts that should 
help you to get up and

running with them.
[…]


Thank you very much. Will check it out!

Leo

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-03-02 Thread Christopher Schultz

Rony,

On 2/28/21 11:33, Rony G. Flatscher (Apache) wrote:

Leo,

On 26.02.2021 01:52, leo wrote:

On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:


P.S.: Have tested my implementation with Nashorn on Java 8 and it works out of 
the box! Still, you
would need to test the implementation thoroughly yourself (stability, 
performance, resources) and
would be asked to come back with feedback on each of these qualities. So stay 
tuned, will publish a
link to the implementation with a proper Nashorn/JavaScript sample war in this 
mail thread in a few
days.


How cool is this! Let me know when you it ready, please. Thanks a lot!


O.K., had a few things I could finalize. Created two war files, 
"demoJavaScript.war" and
"demoRhino.war". The first got tested against Nashorn, the second - you guessed 
it ;) - against
Rhino (7.1.13). They are meant as little proof-of-concepts that should help you 
to get up and
running with them.

Please note that the libraries are beta, though appear to be stable. Yet, there 
may be
errors/problems in them or there may be changes coming up.

If you have feedback of any sorts, please come forward (stability, usability, 
performance,
resources, etc.).

Basically you just need to go to [1] and get the two war-files (copy to 
$CATALINA_HOME/webapps) plus
either javax.ScriptTagLibs.jar (for Tomcat 9 or earlier) or 
jakarta.ScriptTagLibs.jar (for Tomcat
10) which you should copy to the shared directory at $CATALINA_HOME/lib and 
restart Tomcat to get
them recognized. If you want to test with Rhino you should follow the 
directions at [1] and copy the
mentioned two rhino jar files to the shared library directory as well.

In general you should take the time and look over that page at [1], I tried to 
remain as brief as
possible. :)

Also please do not forget that the target audience of [1] has been so far the 
Rexx community and my
BA students who learned programming using ooRexx in a semester and with that 
knowledge should now
become able to create little web sites for their own purposes and maybe with 
some experience for
small businesses/organizations given the information at [1] as a starting point.

Of course, if there are any questions please do not hesitate and please ask 
them!


Any source available?

-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-28 Thread Rony G. Flatscher (Apache)
Leo,

On 26.02.2021 01:52, leo wrote:
> On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:
>
>> P.S.: Have tested my implementation with Nashorn on Java 8 and it works out 
>> of the box! Still, you
>> would need to test the implementation thoroughly yourself (stability, 
>> performance, resources) and
>> would be asked to come back with feedback on each of these qualities. So 
>> stay tuned, will publish a
>> link to the implementation with a proper Nashorn/JavaScript sample war in 
>> this mail thread in a few
>> days.
>
> How cool is this! Let me know when you it ready, please. Thanks a lot!

O.K., had a few things I could finalize. Created two war files, 
"demoJavaScript.war" and
"demoRhino.war". The first got tested against Nashorn, the second - you guessed 
it ;) - against
Rhino (7.1.13). They are meant as little proof-of-concepts that should help you 
to get up and
running with them.

Please note that the libraries are beta, though appear to be stable. Yet, there 
may be
errors/problems in them or there may be changes coming up.

If you have feedback of any sorts, please come forward (stability, usability, 
performance,
resources, etc.).

Basically you just need to go to [1] and get the two war-files (copy to 
$CATALINA_HOME/webapps) plus
either javax.ScriptTagLibs.jar (for Tomcat 9 or earlier) or 
jakarta.ScriptTagLibs.jar (for Tomcat
10) which you should copy to the shared directory at $CATALINA_HOME/lib and 
restart Tomcat to get
them recognized. If you want to test with Rhino you should follow the 
directions at [1] and copy the
mentioned two rhino jar files to the shared library directory as well.

In general you should take the time and look over that page at [1], I tried to 
remain as brief as
possible. :)

Also please do not forget that the target audience of [1] has been so far the 
Rexx community and my
BA students who learned programming using ooRexx in a semester and with that 
knowledge should now
become able to create little web sites for their own purposes and maybe with 
some experience for
small businesses/organizations given the information at [1] as a starting point.

Of course, if there are any questions please do not hesitate and please ask 
them!

HTH,

---rony

[1] Homepage of the ScriptTagLibs libraries:




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-25 Thread leo

Rony,

On 25 Feb 2021, at 2:47, Rony G. Flatscher (Apache) wrote:

P.S.: Have tested my implementation with Nashorn on Java 8 and it 
works out of the box! Still, you
would need to test the implementation thoroughly yourself (stability, 
performance, resources) and
would be asked to come back with feedback on each of these qualities. 
So stay tuned, will publish a
link to the implementation with a proper Nashorn/JavaScript sample war 
in this mail thread in a few

days.


How cool is this! Let me know when you it ready, please. Thanks a lot!

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-24 Thread Rony G. Flatscher (Apache)
On 23.02.2021 04:21, leo wrote:
> On 18 Feb 2021, at 3:15, André Warnier wrote:
>
>> On 17.02.2021 14:59, Christopher Schultz wrote:
>>
>> […] 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.
>
>
> Regarding why a servlet _in_ Tomcat and not a proxy: The production 
> environment is very
> restricted. We can add wars and jars to Tomcat, but we can't install new 
> separate OS native
> applications.
>
> That’s why I thought Nashorn could be a way to deal with this restriction - 
> it even is built into
> Java 8!
Note, Nashorn got removed from the standard JDK 15, but got resurrected as its 
own proper OpenJDK
module such that one can continue to use Nashorn on JDK 15 or later. [1]

---rony

[1] 

P.S.: Have tested my implementation with Nashorn on Java 8 and it works out of 
the box! Still, you
would need to test the implementation thoroughly yourself (stability, 
performance, resources) and
would be asked to come back with feedback on each of these qualities. So stay 
tuned, will publish a
link to the implementation with a proper Nashorn/JavaScript sample war in this 
mail thread in a few
days.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-22 Thread leo

On 18 Feb 2021, at 5:50, Woonsan Ko wrote:


[...]
I found one example:

https://stackoverflow.com/questions/27710407/reuse-nashorn-scriptengine-in-servlet

As a servlet implementation may embed a Jython engine to execute a
python script, it will end up embedding a JS engine in a servlet to
execute a .js like the example.


Thanks! I certainly will look at this!


I guess JS engine in Java vs. Node.js depends on whether or not you
need to allow the .js scripts to use any existing Java libraries in
the same JVM.


Well, the JavaScript code has to be able to use java.sql... to access a 
Oracle database. I would think this is possible with Nashorn.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-22 Thread leo

On 18 Feb 2021, at 3:15, André Warnier wrote:


On 17.02.2021 14:59, Christopher Schultz wrote:

[…] 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.



Regarding why a servlet _in_ Tomcat and not a proxy: The production 
environment is very restricted. We can add wars and jars to Tomcat, but 
we can't install new separate OS native applications.


That’s why I thought Nashorn could be a way to deal with this 
restriction - it even is built into Java 8!


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-22 Thread leo

Chris,

On 18 Feb 2021, at 0:59, Christopher Schultz wrote:


Weird; I never saw the OP on the list, only Rony's reply.


Weird indeed. I just posted to users@tomcat.apache.org, but maybe 
because it was my first post it was held back for a while?


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.


Well, that’s why I asked whether somebody has ‘done’ it for 
Nashorn/JavaSCript in the same way as it is done for Jython/Python 
(https://jython.readthedocs.io/en/latest/SimpleWebApps/).


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-22 Thread leo

Hi there

First apologise that I reply so late and thank you all for chiming in! 
:-)


Rony,

18:58, Rony G. Flatscher (Apache) wrote:

why would you want to do that if you could do the same with Java? What 
is the motivation, the use

case for you?


Use case is a project where I want to increase the JavaScript portion to 
make the it more uniform.


How urgent is this (I may have something for both, Java EE and Jakarta 
EE, but need a little bit of

time)?


Well, for the moment we have the backend in Java EE Servlets, but any 
time I could switch to more JavaSCript in the backend I would try it 
out!


Cheers,
Leo

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Ad Apache Sling scripting (Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-19 Thread Woonsan Ko
On Fri, Feb 19, 2021 at 7:37 AM Rony G. Flatscher (Apache)
 wrote:
>
> Woonsan,
>
> On 18.02.2021 18:02, Woonsan Ko wrote:
>
> > You might want to take a look at this, too:
> > - http://portals.apache.org/bridges/bridges-script/index.html
> >
> > Of course, there must be outdated dependencies, but the idea is the
> > same and it has working code: integrate with JSR-223 for jruby,
> > jython, bsh, js, etc.
> > The portlet api (e.g, PortletRequest, PortletResponse, PortletContext,
> > etc) should be converted to servlet-api though.
>
> thank you very much for this pointer. The overview page [1] includes 
> references to the Portlet
> specifications [2,3] which allow to learn about the motivation and also about 
> its devised features.
> It was also interesting to skim over some bird-eye's-view comparisons between 
> Portlets and Servlets
> e.g. in [4, 5].
>
> As I have an implementation already in place (with BA students trying it out 
> who have been serving a
> little bit as a very small subject group) that supports both BSF and JSR-223, 
> I would make further
> work dependent on my assessment of the student's work (and of course whatever 
> feedback comes up
> later). The goal was to keep it as simple as possible (KISS principle) such 
> that it is easy to
> understand/teach and easy to take advantage of, yet make it versatile for the 
> script developers
> (including demo script samples that will dump the request and response 
> objects and query their
> getter values such that the students get to see/learn what they convey to 
> them at the point of
> invocation; just skimming over this extensive information causes them to 
> learn what is available and
> over time get a "feeling" of what they can expect and do with each request).

That makes sense. Thanks for sharing your views!

Cheers, woonsan

>
> ---rony
>
> [1] Apache Portals Bridges Homepage: 
> 
> [2] JSR-168, Portlet Specification: 
> [3] JRS-286, Portlet Specification 2.0: 
> 
> [4] Nilang, Servlet vs Portlet: 
> 
> [5] Sarin A., Portlets vs. Servlets: Request Processing with Web Components:
> 
>
>
> > On Thu, Feb 18, 2021 at 11:09 AM Rony G. Flatscher (Apache)
> >  wrote:
> >> Chris,
> >>
> >> On 18.02.2021 15:56, Christopher Schultz wrote:
> >> ... cut ...
> >>> A BSF / JSR-233 environment that is available for any servlet container 
> >>> would certainly be an
> >>> accomplishment, and probably very useful for some shops (and students!).
> >>>
> >>> I wonder if there is anything we can learn / steal from Apache Sling.
> >> hmm, at first sight Apache Sling defines its own Scripting classes [1] and 
> >> seems to not use JSR-223
> >> [2, 3] (or BSF [4] for that matter). As a result it seems that each 
> >> scripting language that you wish
> >> to use in the Sling environment needs to get a proper SlingScript 
> >> implementation otherwise you are
> >> out of luck.
> >>
> >> Personally I think one should adhere to the standard Java scripting 
> >> framework [2] whenever possible
> >> (and I would see no compelling reason at first sight why the Sling project 
> >> created its own scripting
> >> framework). The Java scripting framework allows non-Java programmers to 
> >> create scripts that can be
> >> deployed by the Java application and allow them to interact directly with 
> >> explicitly supplied Java
> >> objects of the Java application. Loading a scripting language for the Java 
> >> application programmer is
> >> as easy as using javax.script.ScriptEngineManager methods that start with 
> >> getEngineBy...() supplying
> >> the name of the scripting language (like "groovy", "javascript", 
> >> "netrexx", "rexx" and the like),
> >> one of its mime-types or one of its file-extensions and then (re-)using 
> >> that engine to evaluate
> >> script code.
> >>
> >> The JSR-223 [3] implementation of Java 6 makes it also quite easy to 
> >> create new bindings for new
> >> programming languages (one merely needs to extend 
> >> javax.script.AbstractScriptEngine, which
> >> implements already most of the javax.script.ScriptEngine interface, and 
> >> implement the
> >> javax.script.ScriptFactory interface).
> >>
> >> ---rony
> >>
> >> [1] Sling's Scripting Framework:
> >> 
> >> [2] Java's Scripting Framework (Since Java 6):
> >> 
> >> [3] JCP JSR-223: 
> >> [4] Apache BSF: 
> >>
> >>
> >

-
To 

Re: Ad Apache Sling scripting (Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-19 Thread Rony G. Flatscher (Apache)
Woonsan,

On 18.02.2021 18:02, Woonsan Ko wrote:

> You might want to take a look at this, too:
> - http://portals.apache.org/bridges/bridges-script/index.html
>
> Of course, there must be outdated dependencies, but the idea is the
> same and it has working code: integrate with JSR-223 for jruby,
> jython, bsh, js, etc.
> The portlet api (e.g, PortletRequest, PortletResponse, PortletContext,
> etc) should be converted to servlet-api though.

thank you very much for this pointer. The overview page [1] includes references 
to the Portlet
specifications [2,3] which allow to learn about the motivation and also about 
its devised features.
It was also interesting to skim over some bird-eye's-view comparisons between 
Portlets and Servlets
e.g. in [4, 5].

As I have an implementation already in place (with BA students trying it out 
who have been serving a
little bit as a very small subject group) that supports both BSF and JSR-223, I 
would make further
work dependent on my assessment of the student's work (and of course whatever 
feedback comes up
later). The goal was to keep it as simple as possible (KISS principle) such 
that it is easy to
understand/teach and easy to take advantage of, yet make it versatile for the 
script developers
(including demo script samples that will dump the request and response objects 
and query their
getter values such that the students get to see/learn what they convey to them 
at the point of
invocation; just skimming over this extensive information causes them to learn 
what is available and
over time get a "feeling" of what they can expect and do with each request).

---rony

[1] Apache Portals Bridges Homepage: 

[2] JSR-168, Portlet Specification: 
[3] JRS-286, Portlet Specification 2.0: 

[4] Nilang, Servlet vs Portlet: 

[5] Sarin A., Portlets vs. Servlets: Request Processing with Web Components:



> On Thu, Feb 18, 2021 at 11:09 AM Rony G. Flatscher (Apache)
>  wrote:
>> Chris,
>>
>> On 18.02.2021 15:56, Christopher Schultz wrote:
>> ... cut ...
>>> A BSF / JSR-233 environment that is available for any servlet container 
>>> would certainly be an
>>> accomplishment, and probably very useful for some shops (and students!).
>>>
>>> I wonder if there is anything we can learn / steal from Apache Sling.
>> hmm, at first sight Apache Sling defines its own Scripting classes [1] and 
>> seems to not use JSR-223
>> [2, 3] (or BSF [4] for that matter). As a result it seems that each 
>> scripting language that you wish
>> to use in the Sling environment needs to get a proper SlingScript 
>> implementation otherwise you are
>> out of luck.
>>
>> Personally I think one should adhere to the standard Java scripting 
>> framework [2] whenever possible
>> (and I would see no compelling reason at first sight why the Sling project 
>> created its own scripting
>> framework). The Java scripting framework allows non-Java programmers to 
>> create scripts that can be
>> deployed by the Java application and allow them to interact directly with 
>> explicitly supplied Java
>> objects of the Java application. Loading a scripting language for the Java 
>> application programmer is
>> as easy as using javax.script.ScriptEngineManager methods that start with 
>> getEngineBy...() supplying
>> the name of the scripting language (like "groovy", "javascript", "netrexx", 
>> "rexx" and the like),
>> one of its mime-types or one of its file-extensions and then (re-)using that 
>> engine to evaluate
>> script code.
>>
>> The JSR-223 [3] implementation of Java 6 makes it also quite easy to create 
>> new bindings for new
>> programming languages (one merely needs to extend 
>> javax.script.AbstractScriptEngine, which
>> implements already most of the javax.script.ScriptEngine interface, and 
>> implement the
>> javax.script.ScriptFactory interface).
>>
>> ---rony
>>
>> [1] Sling's Scripting Framework:
>> 
>> [2] Java's Scripting Framework (Since Java 6):
>> 
>> [3] JCP JSR-223: 
>> [4] Apache BSF: 
>>
>>
>


Re: Ad Apache Sling scripting (Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-18 Thread Woonsan Ko
You might want to take a look at this, too:
- http://portals.apache.org/bridges/bridges-script/index.html

Of course, there must be outdated dependencies, but the idea is the
same and it has working code: integrate with JSR-223 for jruby,
jython, bsh, js, etc.
The portlet api (e.g, PortletRequest, PortletResponse, PortletContext,
etc) should be converted to servlet-api though.

Regards,

Woonsan

On Thu, Feb 18, 2021 at 11:09 AM Rony G. Flatscher (Apache)
 wrote:
>
> Chris,
>
> On 18.02.2021 15:56, Christopher Schultz wrote:
> ... cut ...
> > A BSF / JSR-233 environment that is available for any servlet container 
> > would certainly be an
> > accomplishment, and probably very useful for some shops (and students!).
> >
> > I wonder if there is anything we can learn / steal from Apache Sling.
>
> hmm, at first sight Apache Sling defines its own Scripting classes [1] and 
> seems to not use JSR-223
> [2, 3] (or BSF [4] for that matter). As a result it seems that each scripting 
> language that you wish
> to use in the Sling environment needs to get a proper SlingScript 
> implementation otherwise you are
> out of luck.
>
> Personally I think one should adhere to the standard Java scripting framework 
> [2] whenever possible
> (and I would see no compelling reason at first sight why the Sling project 
> created its own scripting
> framework). The Java scripting framework allows non-Java programmers to 
> create scripts that can be
> deployed by the Java application and allow them to interact directly with 
> explicitly supplied Java
> objects of the Java application. Loading a scripting language for the Java 
> application programmer is
> as easy as using javax.script.ScriptEngineManager methods that start with 
> getEngineBy...() supplying
> the name of the scripting language (like "groovy", "javascript", "netrexx", 
> "rexx" and the like),
> one of its mime-types or one of its file-extensions and then (re-)using that 
> engine to evaluate
> script code.
>
> The JSR-223 [3] implementation of Java 6 makes it also quite easy to create 
> new bindings for new
> programming languages (one merely needs to extend 
> javax.script.AbstractScriptEngine, which
> implements already most of the javax.script.ScriptEngine interface, and 
> implement the
> javax.script.ScriptFactory interface).
>
> ---rony
>
> [1] Sling's Scripting Framework:
> 
> [2] Java's Scripting Framework (Since Java 6):
> 
> [3] JCP JSR-223: 
> [4] Apache BSF: 
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Ad Apache Sling scripting (Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-18 Thread Rony G. Flatscher (Apache)
Chris,

On 18.02.2021 15:56, Christopher Schultz wrote:
... cut ...
> A BSF / JSR-233 environment that is available for any servlet container would 
> certainly be an
> accomplishment, and probably very useful for some shops (and students!).
>
> I wonder if there is anything we can learn / steal from Apache Sling.

hmm, at first sight Apache Sling defines its own Scripting classes [1] and 
seems to not use JSR-223
[2, 3] (or BSF [4] for that matter). As a result it seems that each scripting 
language that you wish
to use in the Sling environment needs to get a proper SlingScript 
implementation otherwise you are
out of luck.

Personally I think one should adhere to the standard Java scripting framework 
[2] whenever possible
(and I would see no compelling reason at first sight why the Sling project 
created its own scripting
framework). The Java scripting framework allows non-Java programmers to create 
scripts that can be
deployed by the Java application and allow them to interact directly with 
explicitly supplied Java
objects of the Java application. Loading a scripting language for the Java 
application programmer is
as easy as using javax.script.ScriptEngineManager methods that start with 
getEngineBy...() supplying
the name of the scripting language (like "groovy", "javascript", "netrexx", 
"rexx" and the like),
one of its mime-types or one of its file-extensions and then (re-)using that 
engine to evaluate
script code.

The JSR-223 [3] implementation of Java 6 makes it also quite easy to create new 
bindings for new
programming languages (one merely needs to extend 
javax.script.AbstractScriptEngine, which
implements already most of the javax.script.ScriptEngine interface, and 
implement the
javax.script.ScriptFactory interface).

---rony

[1] Sling's Scripting Framework:

[2] Java's Scripting Framework (Since Java 6):

[3] JCP JSR-223: 
[4] Apache BSF: 



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-18 Thread Christopher Schultz

Rony,

On 2/18/21 09:26, Rony G. Flatscher (Apache) wrote:

Hi Chris,

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.


Yes, somehow it appeared later (Tuesday evening here, but the date and time in 
the post is Monday),
at least I recognized it Tuesday evening for the first time.



Usually if you want to use server-side JavaScript, you use something like 
Node.js instead of a
servlet container. Why not use Node?


This may be an option if you desire to write in JavaScript.
(But it may be the case that creating web applications under e.g. Tomcat may be 
even easier than
with Node, one would have to check it out though. ;) )



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.


Well, I had a need to let Business Administration (BA) students who just 
learned programming in an
easy to learn, yet powerful programming language (ooRexx, a message based, 
dynamically typed
language, originating at IBM, but in open-source for a long time) create little 
web applications
with Tomcat. This way they experience what is basically involved when creating 
a web app in person
(even if they never will create fully fledged web apps on their own it will 
help them get a basic
understanding, better estimates for web app projects and the like).

For these BA students - even if they "experienced" - Java or JavaScript would 
be outside of their
scope, short of having enough learning and training time needed for mastering 
Java and JavaScript to
the extent that is needed to create fully-fledged web applications in Java 
(like a web-shop with
cart, e-mail-newsletter, uploading files, etc.). This has to do with the BA 
curriculum in question
that does not provide enough resources/time (in this particular case a four 
hours lecture with
homework assignments for the duration of one semester, i.e. appr. for four 
months) for learning a
programming language like Java or JavaScript to a professional extent, which 
would be possible e.g.
at a technical university or in specific IS/CIS studies.

My BA students on the other hand have a working knowledge and expierence with 
ooRexx (which they
learned in a four hour class during a semester and learned to apply it to 
interact with Windows, MS
Office, but also with Java - camouflaged as ooRexx - in an operating-system 
independent manner, i.e.
creating GUI, socket programs, OpenOffice/LibreOffice, exploiting JavaFX in an 
operating system
platform independent manner) such that ooRexx would have become feasible for 
them for using it to
learn and to experiment with creating  web apps, if they so desire. If only 
Tomcat et.al. would
allow for that somehow.

As having authored Apache BSF and JSR-223 (package javax.script introduced in 
Java 6) bindings for
ooRexx (using a combination of JNI, C++, Java, ooRexx) it would be feasible and 
desirable to create
a solution that not only supports a single scripting/programming language like 
ooRexx in this case,
but supports in general also any other programming language for which there is 
a bindings either for
Apache BSF and/or JSR-223 out of the box. As there is a JSR-223 bindings for 
Nashorn, one should be
able to apply Nashorn/JavaScript with this very same infrastructure.

Currently I am assessing the results (have yet to check-out and to grade two 
seminar papers and one
Bachelor thesis) and at first sight look quite promising, but this will take a 
little bit of time
until I get to them (planned for the end of next week), unless Leo has an 
urgent need. [In the
meantime, if there is interest, I could point to a little informal 

Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-18 Thread Rony G. Flatscher (Apache)
Hi Chris,

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.

Yes, somehow it appeared later (Tuesday evening here, but the date and time in 
the post is Monday),
at least I recognized it Tuesday evening for the first time.


> Usually if you want to use server-side JavaScript, you use something like 
> Node.js instead of a
> servlet container. Why not use Node?

This may be an option if you desire to write in JavaScript.
(But it may be the case that creating web applications under e.g. Tomcat may be 
even easier than
with Node, one would have to check it out though. ;) )


> 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.

Well, I had a need to let Business Administration (BA) students who just 
learned programming in an
easy to learn, yet powerful programming language (ooRexx, a message based, 
dynamically typed
language, originating at IBM, but in open-source for a long time) create little 
web applications
with Tomcat. This way they experience what is basically involved when creating 
a web app in person
(even if they never will create fully fledged web apps on their own it will 
help them get a basic
understanding, better estimates for web app projects and the like).

For these BA students - even if they "experienced" - Java or JavaScript would 
be outside of their
scope, short of having enough learning and training time needed for mastering 
Java and JavaScript to
the extent that is needed to create fully-fledged web applications in Java 
(like a web-shop with
cart, e-mail-newsletter, uploading files, etc.). This has to do with the BA 
curriculum in question
that does not provide enough resources/time (in this particular case a four 
hours lecture with
homework assignments for the duration of one semester, i.e. appr. for four 
months) for learning a
programming language like Java or JavaScript to a professional extent, which 
would be possible e.g.
at a technical university or in specific IS/CIS studies.

My BA students on the other hand have a working knowledge and expierence with 
ooRexx (which they
learned in a four hour class during a semester and learned to apply it to 
interact with Windows, MS
Office, but also with Java - camouflaged as ooRexx - in an operating-system 
independent manner, i.e.
creating GUI, socket programs, OpenOffice/LibreOffice, exploiting JavaFX in an 
operating system
platform independent manner) such that ooRexx would have become feasible for 
them for using it to
learn and to experiment with creating  web apps, if they so desire. If only 
Tomcat et.al. would
allow for that somehow.

As having authored Apache BSF and JSR-223 (package javax.script introduced in 
Java 6) bindings for
ooRexx (using a combination of JNI, C++, Java, ooRexx) it would be feasible and 
desirable to create
a solution that not only supports a single scripting/programming language like 
ooRexx in this case,
but supports in general also any other programming language for which there is 
a bindings either for
Apache BSF and/or JSR-223 out of the box. As there is a JSR-223 bindings for 
Nashorn, one should be
able to apply Nashorn/JavaScript with this very same infrastructure.

Currently I am assessing the results (have yet to check-out and to grade two 
seminar papers and one
Bachelor thesis) and at first sight look quite promising, but this will take a 
little bit of time
until I get to them (planned for the end of next week), unless Leo has an 

Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-17 Thread Woonsan Ko
On Wed, Feb 17, 2021 at 8:59 AM 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.

I found one example:
- 
https://stackoverflow.com/questions/27710407/reuse-nashorn-scriptengine-in-servlet

As a servlet implementation may embed a Jython engine to execute a
python script, it will end up embedding a JS engine in a servlet to
execute a .js like the example.
I guess JS engine in Java vs. Node.js depends on whether or not you
need to allow the .js scripts to use any existing Java libraries in
the same JVM.

Regards, Woonsan

>
> -chris
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-17 Thread Christopher Schultz

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



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-17 Thread tomcat/perl

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.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-17 Thread Christopher Schultz

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.


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Run servlets on Nashorn written in server-side JavaScript

2021-02-16 Thread Rony G. Flatscher (Apache)
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.
>
>


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org