Implicite Pipeline Objects Reference

What are Implicite Pipeline Objects?

Inside any pipeline there are objects automatically provided to you at execution time which can be accessed without any further allocation steps. Such an object is called Implicite Pipeline Object. These objects can be accessed using the Pipeline Expression Language (PEL). Some of them are read-only and some are read-write:

  • vars

  • headers

  • body

  • request

  • response

  • exception

Also see: https://logabit.atlassian.net/wiki/spaces/PA/pages/2543026496/Pipeline+Expression+Language+PEL#Accessing-Implicite-Pipeline-Objects%E2%80%8B .

vars

Since version 1.0

This object gives you access to all variables of the current pipeline.

Let's assume, you have defined a variable counter and you would like to access this counter in your expression, then you could write an expression like this:

${vars.counter}

Here is an example of a pipeline which declares this variable and uses the Pipeline Expression to output the value of counter to the body:

vars: counter: 12 pipeline: - body.set: value: "The counter is: ${vars.counter}"

This will result in an output like this:

The counter is: 12

Also see https://logabit.atlassian.net/wiki/spaces/PA/pages/2543026496 .

headers

Since version 1.0

This object gives you access to all pipeline headers of the current pipeline.

Do not mix up Pipeline headers with HTTP headers. The latter can be accessed using the ${context.request.headers} object instead.

Here is an example of a pipeline which accesses the header attribute contentType and writes it to the body:

This will result in an output like this:

Also see https://logabit.atlassian.net/wiki/spaces/PA/pages/2543026496 .

body

Since version 1.0

This object gives you access to the current body of the current pipeline.

Here is an example which defines an initial body value and replaces this with another text in the pipeline:

This will result in an output like this:

Also see .

response

Since version 9.0

This object gives you access to the response of the current request. You can set the response status or headers for example.

The response object is only set in case this pipeline was triggered by an initial HTTP request. Otherwise, this object is null.

Here is an example which sets the HTTP 401 on the current request:

This will result in an output like this:

And it will return the HTTP Status code 401 to the client.

You can also use the command http.response.set in order to set the response values:

 

Note: The final body of the pipeline will become the body for the response, therefore you cannot set it on the response implicit object.

These are the attributes accessible via the response object:

response.statusCode

The HTTP status to send back to the client. One of:

response.headers

A key-value map which contains the headers to be send back to the client.

request

Since version 9.0

This object gives you access to the current request object, if there is any.

Here is an example which reads the contentType header from the current request:

This will result in an output like this:

These are the attributes accessible via the request object:

request.headers

A key-value map of all HTTP request headers of the current request.

request.params

A key-value map of all HTT request query parameters of the current request.

request.protocol

Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.

request.contentLength

The content length of the current request in bytes.

request.contentType

The Content-Type header of the current request. One of the standard content types or a custom one.

request.requestPath

The request path of current request without hostname.

request.method

The HTTP method used for this request.

request.locale

The locale used for this request or null if none was set.

request.cookies

The list of cookies linked to this request.

request.cookies[].name

Returns the name of the cookie. The name cannot be changed after creation.

request.cookies[].value

Returns the value of the cookie as string.

request.cookies[].path

Returns the path as string on the server to which the browser returns this cookie. The cookie is visible to all subpaths on the server.

request.cookies[].version

Returns the version integer of the protocol this cookie complies with. Version 1 complies with RFC 2109, and version 0 complies with the original cookie specification drafted by Netscape. Cookies provided by a browser use and identify the browser's cookie version.

request.cookies[].domain

Returns the domain name set for this cookie as string. The form of the domain name is set by RFC 2109.

request.cookies[].comment

Returns the comment string describing the purpose of this cookie, or null if the cookie has no comment.

request.cookies[].maxAge

Returns the maximum age of the cookie, specified in seconds. By default, -1 indicating the cookie will persist until browser shutdown.

request.cookies[].secure

Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.

request.cookies[].httpOnly

Gets the flag that controls if this cookie will be hidden from scripts on the client side. Returns true if the cookie is hidden from scripts, else false.

exception

Since version 9.0

In case an exception happened in this pipeline, this object will contain all required information about it. Otherwise this object is null.

Depending on the exception type the attributes can differ. Below you can find the common attributes always available:

exception.auth

The name of the principal active when this exception happened. This is typically the username of the currently logged-in user or the systemuser.

exception.domain

The PIPEFORCE domain name (host) where this exception happened.

exception.message

Returns the exception message as string.

exception.more

A link to the log files related to this exception.

exception.namespace

The PIPEFORCE namespace where this exception happened.

exception.spanId

The id of the trace span where this exception happened or null in case there was no span created.

exception.traceId

The id of the tracing where this exception happened. Never null.

exception.type

Returns the type (name) of the current exception.

Common types are:

Type

Description

Type

Description

PelUtilException

In case the execution of a pipeline util has been failed.

CommandException

In case the execution of a command has been failed.

CommandNotFoundException

In case a command was not found.

IllegalArgumentException

In case an argument to any backend function was invalid.

PipelineException

In case a pipeline execution has been failed.

Exception

This type catches any exception.

exception.statusCode

The status code of the exception if there is any. Usually an HTTP status code is assigned with any exception. By default it is set to 500.

exception.time

The unix timestamp in millis when this exception happened at the backend.

exception.uuid

Returns the unique id of this exception. This is handy for searching in logs for this exact match.