You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2007/11/27 09:02:36 UTC

Re: [jira] Commented: (SLING-110) Update Script System to be JSR-223 Compatible

Hi,

Thanks alot for this. I will shortly look into the patch.

However, here are some first remarks:

Am Montag, den 26.11.2007, 11:00 -0800 schrieb Padraic Hannon (JIRA):
> Padraic Hannon commented on SLING-110:
> --------------------------------------
> 
> Currently I have a version which looks ok using the BSF 3.0-SNAPSHOT.
> However, I still have a custom SlingScriptEngine interface which I would like to get rid of. 

+1

If we are going to using Java Scripting, SlingScriptEngine interface is
not needed anymore and should be dropped.

> Also, I still have SlingScript having a getScriptEngine() method which I would like to remove.

+1

If there is no SlingScriptEngine anymore, there is no getScriptEngine. I
suggest, we add a method eval(Map<String, Object> props) which then
calls into  Java Scripting to evaluate the script and use the props as
bound variables. This way, sling/microsling just calls Script.eval to
call the script.

WDYT ?

>  One thing I do not like about BSF and JSR-223 is that the eval returns an object. I would much
>  rather eval to a writer and not load a string into memory just to flush out the wire.

Java Scripting is generic in that scripts may be used to calculate
results. As such there must be the possibility to return a value.
Generally we might want to ignore this value.

The writer to be used by scripts for sending back the response is
available as the "out" property in props.

Hope this helps.

Regards
Felix