Detailed Description
Set response headers element class.
This is used to get response headers based on what the browser supports. For example, newer Chrome browsers support the Accept-CH header.
Inheritance diagram for SetHeadersElement:
Collaboration diagram for SetHeadersElement:
Public Member Functions | |
| constructor () | |
| getHeaderName (propertyName) | |
| Get the name of the header which the property relates to. | |
| constructHeaders (pipeline) | |
| Construct the headers and their properties which can be set by the service. | |
| processInternal (flowData) | |
| Add the response header dictionary to the FlowData. | |
| getResponseHeaders (flowData) | |
| Get response headers (e.g. | |
| tryGetValue (flowData, elementKey, propertyKey) | |
| Try to get the value for the given element and property. | |
Public Member Functions inherited from FlowElement | |
| constructor ({ processInternal, dataKey, properties={}, evidenceKeyFilter }={}) | |
| Constructor for flowElement class. | |
| onRegistration (pipeline, flowElement) | |
| Internal function to be called when a FlowElement is added to pipeline, runs through any registrationCallbacks on the FlowElement. | |
| ready () | |
| Function called to check if a FlowElement is ready Used when there are asynchronous initialisation steps. | |
| processInternal (flowData) | |
| Internal process function for a particular flowElement called (via the flowElement.process() method) when flowData generated by a pipleline is processsed. | |
| process (flowData) | |
| To allow actions to take place before and after a FlowElement's processInternal function runs, a process wrapper is run first. | |
| updateProperties () | |
| Call this function to update the properties meta database in all the pipelines this flowElement has been added to. | |
| getProperties () | |
| Get a flowElement's properties. | |
| _log (type, message) | |
| Internal log. | |
Member Function Documentation
◆ constructHeaders()
|
inline |
Construct the headers and their properties which can be set by the service.
An example of the structure of the headers is: { 'Accept-CH': { name: 'Accept-CH', properties: [ 'device.SetHeaderBrowserAccept-CH', 'device.SetHeaderPlatformAccept-CH', 'device.SetHeaderHardwareAccept-CH' ] } }
- Parameters
-
{Pipeline} pipeline The pipeline instance to get the properties from.
- Returns
- {object} Collection of headers which can be set in the response.
◆ getHeaderName()
|
inline |
Get the name of the header which the property relates to.
- Parameters
-
{string} propertyName To get the header name from.
- Returns
- {string} Header name.
◆ getResponseHeaders()
|
inline |
Get response headers (e.g.
Accept-CH)
- Parameters
-
{FlowData} flowData A processed FlowData instance to get the response header values from.
- Returns
- {object} A dictionary of response header names with their values if they are not null
◆ processInternal()
|
inline |
◆ tryGetValue()
|
inline |
Try to get the value for the given element and property.
If the value cannot be found or is null/unknown, then undefined is returned.
- Parameters
-
{FlowData} flowData A processed FlowData instance to get the value from. {string} elementKey Key for the element data to get the value from. {string} propertyKey Name of the property to get the value for.
- Returns
- {string | undefined} value string or undefined.
