public class HTTPWrap extends Object implements InternalNodeModule
| Modifier and Type | Class and Description |
|---|---|
static class |
HTTPWrap.HttpImpl
This is the top-level module object, aka "exports" for this module.
|
static class |
HTTPWrap.RequestAdapter
This object is used by the "ServerRequest" object in the "adaptorhttp" module to interface with the
Java runtime and with the HTTP adapter.
|
static class |
HTTPWrap.ResponseAdapter
This is a JavaScript object passed to the "adaptorhttp" module for each request.
|
static class |
HTTPWrap.ServerContainer
This implements the stub that the HTTP implementation will call into to notify us of new messages and data.
|
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
HTTPWrap() |
| Modifier and Type | Method and Description |
|---|---|
String |
getModuleName()
Return the top-level name of the module as it'd be looked up in a "require" call.
|
org.mozilla.javascript.Scriptable |
registerExports(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
NodeRuntime runner)
This is the Java equivalent of a Node module.
|
public String getModuleName()
NodeModulegetModuleName in interface NodeModulepublic org.mozilla.javascript.Scriptable registerExports(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
NodeRuntime runner)
throws InvocationTargetException,
IllegalAccessException,
InstantiationException
NodeModuleThis is the Java equivalent of a Node module. In here, you can set properties on "exports" just as you would set properties on "exports" in a regular Node module. You may also declare any classes using ScriptableObject.defineClass -- by defining them on the "exports" object you may make them private to your module. You may also access and define global properties using "scope." Declare any classes that this module needs, and set any other variables on the exports.
The module must create a Scriptable object using the supplied context, then set any "exports" properties on this object and return it.
For example, a module that in JavaScript would assign several functions to "exports" would create a Scriptable object using "scope" as the parent scope, and then set the various functions as properties.
registerExports in interface NodeModulecx - The Rhino context for the current script and threadscope - The global scope for the scriptrunner - an object that may be used to interact with the script runtimeInvocationTargetExceptionIllegalAccessExceptionInstantiationExceptionCopyright © 2016 Apigee Corporation. All Rights Reserved.