You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2021/03/02 16:48:09 UTC
Re: Run servlets on Nashorn written in server-side JavaScript
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Run servlets on Nashorn written in server-side JavaScript
Posted by Christopher Schultz <ch...@christopherschultz.net>.
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] org.apache.jasper.servlet.TldScanner.scanJars At least one
> JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a
> complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs
> during scanning can improve startup time and JSP compilation time.
>
> Going after the TldScanner documentation/information led me to its JavaDocs, but also to [1] which
> seems to indicate that one could define them in web.xml but can only refer to its WEB-INF/lib location.
>
> As the standard tag library can do it, I went after stl's META-INF directory where there are a few
> pointers like a file "permittedTaglibs.tld" and other tld files. However, not having a conceptual
> overview it is currently impossible to see which parts need play together how. It may be the case
> that for some in the know it is probably an easy task. :)
>
> As placing the script-jsr223.tld or/and script-bsf.tld files into WEB-INF is probably o.k., I will
> just leave it for the time being. This way it works no matter where the taglib is located, in
> CATALINA_HOME/lib or in WEB-INF/lib. My reference group, my business administration students, seem
> to not have a problem with it, so I follow the KISS :) principle here too...
>
> Personally I prefer CATALINA_HOME/lib especially during the transition from Java EE ("javax.") to
> Jakarta EE ("jakarta.") for the next years: one single location where one copies either
> "javax.ScriptTagLibs.jar" or "jakarta.ScriptTagLibs.jar" and all dependent JSPs work. It makes it
> also simple to use Tomcat 9 or earlier for the time being and once changing to Tomcat 10 all the web
> apps remain intact (no need to change anything) as there is a single shared taglib that needs to be
> replaced.
I pretty much avoid JSP like the plague, so I'm definitely not the best
resource, here. I wrote a JSP tag library in 2000 - 2002 and it was ...
interesting. But I have purged all that from my brain to make room for
more useful things to me these days :)
I recommend you post a separate question to this list to get some
attention to that specific question.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Run servlets on Nashorn written in server-side JavaScript
Posted by "Rony G. Flatscher (Apache)" <ro...@apache.org>.
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 WEB-INF/lib. The startup-log states in either case:
04-Mar-2021 12:15:20.624 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one
JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a
complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs
during scanning can improve startup time and JSP compilation time.
Going after the TldScanner documentation/information led me to its JavaDocs, but also to [1] which
seems to indicate that one could define them in web.xml but can only refer to its WEB-INF/lib location.
As the standard tag library can do it, I went after stl's META-INF directory where there are a few
pointers like a file "permittedTaglibs.tld" and other tld files. However, not having a conceptual
overview it is currently impossible to see which parts need play together how. It may be the case
that for some in the know it is probably an easy task. :)
As placing the script-jsr223.tld or/and script-bsf.tld files into WEB-INF is probably o.k., I will
just leave it for the time being. This way it works no matter where the taglib is located, in
CATALINA_HOME/lib or in WEB-INF/lib. My reference group, my business administration students, seem
to not have a problem with it, so I follow the KISS :) principle here too...
Personally I prefer CATALINA_HOME/lib especially during the transition from Java EE ("javax.") to
Jakarta EE ("jakarta.") for the next years: one single location where one copies either
"javax.ScriptTagLibs.jar" or "jakarta.ScriptTagLibs.jar" and all dependent JSPs work. It makes it
also simple to use Tomcat 9 or earlier for the time being and once changing to Tomcat 10 all the web
apps remain intact (no need to change anything) as there is a single shared taglib that needs to be
replaced.
---rony
[1] "jsp-config": <https://docs.oracle.com/cd/E14571_01/web.1111/e13712/web_xml.htm#i1071164>
Re: Run servlets on Nashorn written in server-side JavaScript
Posted by Christopher Schultz <ch...@christopherschultz.net>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Run servlets on Nashorn written in server-side JavaScript
Posted by "Rony G. Flatscher (Apache)" <ro...@apache.org>.
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:
<https://sourceforge.net/projects/bsf4oorexx/files/Sandbox/rgf/taglibs/beta/>.
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:
<https://sourceforge.net/p/bsf4oorexx/code/HEAD/tree/sandbox/rgf/taglibs/>
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org