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: <http://portals.apache.org/bridges/index.html> [2] JSR-168, Portlet Specification: <http://www.jcp.org/en/jsr/detail?id=168> [3] JRS-286, Portlet Specification 2.0: <http://www.jcp.org/en/jsr/detail?id=286> [4] Nilang, Servlet vs Portlet: <https://www.opensource-techblog.com/2014/10/servlet-vs-portlet.html> [5] Sarin A., Portlets vs. Servlets: Request Processing with Web Components: <https://www.developer.com/java/web/article.php/3891786/Portlets-vs-Servlets-Request-Processing-with-Web-Components.htm> > On Thu, Feb 18, 2021 at 11:09 AM Rony G. Flatscher (Apache) > <r...@apache.org> 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: >> <https://sling.apache.org/apidocs/sling10/org/apache/sling/api/scripting/package-summary.html> >> [2] Java's Scripting Framework (Since Java 6): >> <https://docs.oracle.com/javase/8/docs/api/index.html?javax/script/package-summary.html> >> [3] JCP JSR-223: <https://www.jcp.org/en/jsr/detail?id=223> >> [4] Apache BSF: <https://commons.apache.org/proper/commons-bsf/> >> >> >