The modules and classes in this package provide functionality to support the REST server to formulate the HTTP response (header, body, response code) as per the requirement of the "ApplicationPattern specification".
The rest module description contains the following content:
- Server
- ResponseBuilder.js
- ResponseCode.js
- ResponseHeader.js
- responseBody
- ConsequentAction.js
- ResponseValue.js
ResponseBuilder.js
This module provides functionality to build the HTTP response object.
Function:
| Method and description | Input parameters | Return type |
|---|---|---|
| buildResponse This function builds the HTTP response object. |
{JSONObject} response HTTP response object. {String} responseCode HTTP response code. {JSONObject} responseBody HTTP response body. {JSONObject} responseHeader HTTP response header. |
ResponseCode.js
This class provides an enumeration of HTTP status codes.
ResponseHeader.js
This class provides functionality to create a HTTP response header.
Field summary:
| Type | Field |
|---|---|
| String | xCorrelator |
| String | execTime |
| String | lifeCycleState |
| String | contentType |
Constructor summary:
| Constuctor and description | parameters |
|---|---|
| This instantiates a new response header instance. | {String} xCorrelator UUID for the service execution flow that allows to correlate requests and responses. {String} startTime Time when this request was initiated. {String} lifeCycleState Sequence of request numbers along the flow, if it is empty, set it to 1. {String}backendTime Time spent in 3rd party requests, defaults to 0. |
Method Summary:
| Method and description | Input parameters | Return type |
|---|---|---|
| xCorrelatorGenerator This function generates a xCorrelator based on the regular expression provided in the specification. |
{String} return the xCorrelator. | |
| executionTimeInMilliseconds This function calculates the execution time for processing the request. |
{JSONObject} startTime start time of the request. | {integer} return the execution time in milli seconds. |
| createResponseHeader This function creates response header based on the provided input values. |
{String} xCorrelator of the request. {String} startTime start time of the request. {String} operationName of the request. {String} backendTime of the request. |
{promise} return the response header. |
responseBody
This package contains classes that are used to represent generic response bodies.
ConsequentAction.js
This class provides a stub for the consequent action list.
Field summary:
| Type | Field |
|---|---|
| String | label |
| String | request |
| String | displayInNewBrowserWindow |
| String | inputValueList |
Constructor summary:
| Constuctor and description | parameters |
|---|---|
| This instantiates a new consequent action list. | {String} label of the consequent action. {String} request url that needs to be addressed to perform the consequent action. {String} displayInNewBrowserWindow should be true if the consequent action needs to be displayed in a new tab. {String} inputValueList |
ResponseValue.js
This class provides a stub for the consequent action list.
Field summary:
| Type | Field |
|---|---|
| String | fieldName |
| String | value |
| String | datatype |
Constructor summary:
| Constuctor and description | parameters |
|---|---|
| This instantiates a new ResponseValue object. | {String} fieldName field name of the response value. {String} value of the field name. {String} datatype data type of the value. |

