WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Category:accessor prototype

JavascriptPrototype is an accessor that must be instantiated from a prototype. You must instantiate the prototype in your module to create an accessor that can receive requests.


The JavascriptPrototype prototype has the following initialisation parameters:

scriptMandatoryIdentifier or XML(none)
Javascript to execute
An identifier grammar definition.
comma separated list of supported verbs
If included this parameter will mark the endpoint as private and it will not be exposed outside module.
An identifier for created logical endpoint, if omitted a unique auto-generated value it will be used.
fromRepresentationAny quantityStringnull
used when creating transreptor
toRepresentationAny quantityStringnull
used when creating transreptor
metaOptionalXMLnull(no description available)

Here is an auto-generated example of how to instantiate an instance of JavascriptPrototype:

  <script>Javascript to execute</script>
  <grammar>an identifier grammar definition</grammar>
Import Requirements

To use JavascriptPrototype accessor prototype you must import the module urn:org:netkernel:lang:javascript:


The Javascript language prototype is an alternate way of using the javascript functionality to the runtime. The prototype allows the instantiation of a javascript implemented accessor within your application without the need to [map requests to it. This has benefits of compactness and the ability to implement transreptors.


The comma separate list of verbs defines which verbs will be supported by the instantiated javascript accessor. This defaults to just "SOURCE". See the mapper verbs document for examples of how to set this string.

The runtime contains documentation on how to differentiate handling of different verbs.


Implementing a transreptor in javascript is easy, you need to declare the instantiation of the prototype in your space:

    <regex type="anything" />
Then create a static resource containing your javascript:
// Javascript code to implement simple transreptor
primary = context.sourcePrimary(java.lang.Object);
rep = new org.ten60.netkernel.lang.javascript.test.MyRep(primary);