Show content

See also: Show document (Event action)

Event action – Abstract

Purpose: A new browser tab is opened to display or download the 'Content' (Content) provided via a value configuration for the Content to show parameter.

images/download/attachments/189441070/image-2024-12-6_8-53-28-version-1-modificationdate-1733471608551-api-v2.png

The Show content event action opens an additional browser tab to display the 'Content' (Content) made available via a value configuration for the Content to show parameter.


images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/warning.svg CAUTIONimages/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/warning.svg The Content to show is completely loaded into the server's working memory before it can be offered for download/opening. It is not recommended to use the Show content event action for particularly large files (e.g. videos).


IMPORTANT◄ The Show content event action – in contrast to Show document (Event action) – is not available in the client context (Client workflow, Client workflows).


  • If there is no value configuration for the Content to show parameter or it returns 'No value' ($null) at runtime, no browser tab is opened.

  • A reference object present in the execution context also applies as a reference object for a value configuration in the Content to show parameter, but is not used as the default value if no value configuration is present.

The Content to show is often provided or generated via a value resolver from the Content builder category.

  • The value resolvers in the Content builder category provide return values of the 'Content' (Content) or text (String) type.

  • In principle, text (String) is output directly in the browser tab.

  • The browser ultimately decides whether 'Content' (Content) is displayed directly in the browser tab or treated as a download, depending on its 'media type' (mediaType), which also takes into account the extension in the file name (name).
    NOTE◄ A browser tab also appears temporarily during a download, but is automatically closed again.

  • For some 'related' data types for 'Content' (Content), an automatic type conversion takes effect:

    • Documents can be provided either completely – as a 'Document' (Document) object (incl. file name) – or as a byte array ((byte[])) from the Document field 'document content' (documentContent).

    • A 'File information” (FileInfo) object (e.g. from a File element in a form) can be displayed directly as content. The 'MIME type' (type) property can be decisive for how the browser prepares the data (e.g. text/plain vs. text/html).

  • For all other data types, the string image defined on the server side is displayed as a test in the browser tab.

Examples

Simple use case: Display image file from the server file system

Within an event handling, a stored image file (overview.png) should be opened in a new browser tab under certain conditions.

Configuration:

The file reference value resolver is used in the Content to show parameter to provide the file as 'Content' (Content):

  • The static text in the File path parameter refers to the root directory for the File manager in which the file is stored.

images/download/attachments/189441070/image-2024-12-9_11-9-48-version-1-modificationdate-1733738987771-api-v2.png

NOTE◄ Since the file in question should not be 'publicly' accessible (without logging into Lobster Data Platform / Orchestration), it was not placed in the web folder of the server file system, but directly in the parent upload directory, which serves as the root directory ($home) for the File manager.
If the file were stored 'publicly' within the web folder (e.g. in the path $home/web/pics/overview.png), the Open external URL event action (with the relative URL pics/overview.png) could also be used to display the image in a new browser tab instead of the Show content event action.

More complex use case: Display data of an entity in the browser

The Session information value resolver provides a wide range of information about the current session in a structured form – as an entity of the 'Session information' (SessionInformation) type.

In the following configuration, different approaches are demonstrated with which the information contained can be visualized via the Show content in a separate browser tab.

Configuration options

Ergebnis (Anzeige im geöffneten Browser-Tab)

The return value of the Session information value resolver is defined here directly as Content to show.

The string image of the entity is then output (see right).

NOTE◄ The results obtained are not particularly useful when it comes to gaining insights into the session.

images/download/attachments/189441070/image-2024-12-6_8-54-5-version-1-modificationdate-1733471645409-api-v2.png

4:de.lobster.scm.authentication.SessionInformation@a8a42e83

In order that the information contained in the 'Session information' object can be examined in the browser tab, the Session information value resolver is linked here with an Object to JSON resolver.

As Content to show, we receive quite an extensive text that describes the 'Session information' object in JSON format in detail and thus makes it readable (see extract on the right).

NOTE◄ The Object to JSON resolver provides the JSON image directly as text, which is output as Content to show directly in the browser tab.


With the more complex configuration variant below, the browser can also be 'notified' that the text (String) describes a JSON structure. If the browser supports this, a more useful formatting of the view is then obtained (see bottom right).

images/download/attachments/189441070/image-2024-12-6_8-54-36-version-1-modificationdate-1733471675907-api-v2.png

{
"class": "de.lobster.scm.authentication.SessionInformation",
"additionalData": {
"\u0022$integrationClientId$\u0022": "-1",
"\u0022welcomeTooltip\u0022": "Karola(1901)\nSuper user limited\nXflow AG (1902)",
"\u0022welcomeText\u0022": "Ms. Karola",
"\u0022apiUser\u0022": false,
"\u0022parentCompanies\u0022": {
"class": "list",
"data": [
{
"class": "java.lang.Long",
"value": "702"
},
...

images/download/attachments/189441070/image-2024-12-6_8-57-54-version-1-modificationdate-1733471874473-api-v2.png

  • The concatenation of the Session information and JSON to object event actions shown in the previous variation is used here as a value configuration (right) in an assignment to the Property body of a 'Content' (Content) object, which we can create on-the-fly as a Content to show value using the Create instance with values resolver.

  • This procedure allows us to define the Property mediaType for the 'Content' (Content) in addition to the body. Assigning the type application/json as static text means that the body is no longer displayed as plain text, but is specifically 'interpreted' by the browser – e.g. as shown on the right:

    • The organization of the JSON structure is made clearer by using colours and indentation.

    • Elements can be collapsed and expanded in a nested structure.

    • A search/filter function simplifies searches in the structure.

NOTE◄ In the same way as this example, an XML string (e.g. from the XML export resolver) can be linked with the type text/xml so that it is displayed in a structured way, provided this is supported by the browser.


images/download/attachments/189441070/image-2024-12-9_11-8-32-version-1-modificationdate-1733738912350-api-v2.png