Context and Parameters
Each request exists within an operational context.
The context includes any argument values for named parameters passed to a service.
For example the xslt
service obtains the XSL stylesheet
from a resource associated with the operator
parameter
and it obtains the XML document to be styled from a resource
associated with the operand
parameter:
active:xslt+operator@ffcpl:/style.xsl+operand@ffcpl:/source.xml
Script language programs may obtain argument values through
an instance of INKFConvenienceHelper
provided as a local
variable named "context".
For example, when a JavaScript program is call with the
following URI address:
active:javascript+operator@ffcpl:/program.js+data@ffcpl:/data.xml
the program is identified as the operator
argument and the data
argument is the URI address
ffcpl:/data.xml
.
This is set up inside NetKernel as two nested contexts.
In the inner context the JavaScript execution engine requests
the program to be run by making a resource request for the
URI provided as the operator
argument.
In the outer context the parameter data
has an argument value URI identifying an XML document which
the JavaScript program processes.
The following JavaScript program fragment illustrates how to
obtain the resource identified by the data parameter value.
importPackage(Packages.org.ten60.netkernel.xml.representation);
importPackage(Packages.org.ten60.netkernel.layer1.representation);
importPackage(Packages.com.ten60.netkernel.urii.aspect);
importPackage(Packages.java.lang);
xoa=context.sourceAspect("this:param:data", IAspectXmlObject);