Override load pseudo URL schemes

Attila Szegedi szegedia at gmail.com
Tue Dec 8 10:38:56 UTC 2015


We do actually track this as an issue, see
https://bugs.openjdk.java.net/browse/JDK-8142335. It turns out that there's
all kinds of security implications involved, so we're unlikely to provide
customized URL loading as a feature in Nashorn. Fortunately, it's very easy
to roll your own load(), and the issue actually has an attached example
that shows you how:
https://bugs.openjdk.java.net/secure/attachment/54881/LoaderTest.java

Hope that helps,
  Attila.


On Mon, Dec 7, 2015 at 1:08 PM, Sundararajan Athijegannathan <
sundararajan.athijegannathan at oracle.com> wrote:

> Hi Axel,
>
> "load" is just another normal global function. You can replace it with
> your own version of "load" that extends for other schemes (or forwards
> calls to original load as needed!)
>
> Thanks,
> -Sundar
>
>
> On 12/7/2015 3:35 PM, Axel Dörfler wrote:
>
>> Hi there,
>>
>> I've got a scriptable application that would benefit from having globally
>> available scripts that user scripts can import.
>>
>> Would it be possible to add other pseudo URL schemes (in addition to the
>> already available nashorn: or fx:), and let me handle those requests? Is
>> there a stable API to achieve this by any chance?
>>
>> Thanks in advance!
>>
>> Bye,
>>    Axel.
>>
>
>


More information about the nashorn-dev mailing list