Module: wellKnownPorts¶
- This is a repository for useful constants used in constructing URIs, as well as for
- well known status strings. It contains F5-specific values such as EXTERNAL_URI_PREFIX and DEFAULT_RESTSERVER_PORT as well as standards HTTP constants (all constants starting with STATUS) which have the same meaning as defined in the HTTP specifications.
// Using HTTP status : this code expects a STATUS_ACCEPTED HTTP response,
// using the wellKnownPorts constant list. Mark that the request meets all
// validity checks and tell the originator it was accepted.
var wellKnownPorts = require("./infrastructure/wellKnownPorts");
this.completeRequest(restOperation, wellKnownPorts.STATUS_ACCEPTED);
// using this.wellKnownPorts.DEFAULT_JAVA_SERVER_PORT and
// this.wellKnownPorts.DEFAULT_HTTP_SCHEME to construct a URI Generic URI
// components, minus the 'path'.
var wellKnownPorts = require("./infrastructure/wellKnownPorts");
var uri = this.restHelper.buildUri({
protocol: wellKnownPorts.DEFAULT_HTTP_SCHEM,
port: wellKnownPorts.DEFAULT_JAVA_SERVER_PORT,
hostname: "localhost"
});
wellKnownPorts Members¶
(static) -> EXTERNAL_URI_PREFIX¶
EXTERNAL_URI_PREFIX is the external prefix for URI requests, that is the path to be used when making calls from outside the machine. For example, the echo service, present by default, has the external address of https://(machine-name)/mgmt/shared/echo
(static) -> LOCAL_HOST¶
constant for localhost, useful to make request to the current machine or device
// check if an address is this machine via the 'loopback' interface
myWorker.prototype.isLocalHost = function (address) {
if (address === this.wellKnownPorts.LOCAL_HOST || address === this.wellKnownPorts.LOOPBACK_ADDRESS) {
return true;
}
return false;
}
(static) -> LOOPBACK_ADDRESS¶
constant for loopback address
// check if an address is this machine via the 'loopback' interface
myWorker.prototype.isLocalHost = function (address) {
if (address === this.wellKnownPorts.LOCAL_HOST || address === this.wellKnownPorts.LOOPBACK_ADDRESS) {
return true;
}
return false;
}