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.

Examples:

// 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) -> SHARED_PATH_PREFIX

the path prefix for shared services; F5 services generally reside under that URI path For example, the echo service, present by default, has the external address of https://(machine-name)/mgmt/shared/echo


(static) -> DEFAULT_RESTSERVER_PORT

the port that the local rest server listens on.


(static) -> LOCAL_HOST

constant for localhost, useful to make request to the current machine or device

Examples:

// 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

Examples:

// 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) -> PATH_SEPARATOR

The URI path seperator character


(static) -> DEFAULT_HTTPS_SCHEME

constant for https scheme


(static) -> DEFAULT_JAVA_SERVER_PORT

constant for the port on the restjavad daemon REST API server