API Docs for: 2.6
Show:

util Class

Module: util

Provides the utility functionalities.

Item Index

Methods

Properties

Methods

getRemoteClientIp

(
  • resp
)
String private static

Returns the remote IP address of the client from the http response object.

Parameters:

  • resp Object

    The http response object

Returns:

String:

The remote ip address of the client

sendHttp200

(
  • parentIdLog
  • resp
)
static

Sends an HTTP 200 OK response.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

sendHttp201

(
  • parentIdLog
  • resp
)
static

Sends an HTTP 201 created response.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

sendHttp400

(
  • parentIdLog
  • resp
)
static

Sends an HTTP 400 bad request response.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

sendHttp401

(
  • parentIdLog
  • resp
  • [err]
)
static

Sends an HTTP 401 unauthorized response.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

  • [err] String optional

    An error message

sendHttp401Nonce

(
  • parentIdLog
  • resp
  • nonce
)
static

Sends an HTTP 401 unauthorized response with nonce into the WWW-Authenticate http header.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

  • nonce String

    The nonce to send

sendHttp403

(
  • parentIdLog
  • resp
)
static

Sends an HTTP 403 forbidden response.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

sendHttp500

(
  • parentIdLog
  • resp
  • [err]
)
static

Sends an HTTP 500 internal server error response.

Parameters:

  • parentIdLog String

    The identifier of the component that uses the utility

  • resp Object

    The client response object

  • [err] String optional

    The error message

setLogger

(
  • log
)
static

Sets the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

Properties

IDLOG

String private final

The module identifier used by the logger.

Default: [util]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

net

Object

Network utility functions.

Default: { sendHttp200: sendHttp200, sendHttp201: sendHttp201, sendHttp400: sendHttp400, sendHttp401: sendHttp401, sendHttp403: sendHttp403, sendHttp500: sendHttp500, sendHttp401Nonce: sendHttp401Nonce }