Web Server Response Adapter

Introduction

The TIBCO StreamBase® Web Server Response Adapter allows the system to handle HTTP and web socket responses. Each request from a Web Server Request adapter must end up in a Web Server Request Adapter. The adapter uses the requestId field of the incoming tuple to determine which web server and request/response object to send the HTTP response to.

Adapter Properties

This section describes the properties you can set for this adapter, using the various tabs of the Properties view in StreamBase Studio.

General Tab

Name: Use this field to specify or change the component's name, which must be unique in the application. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Adapter: A read-only field that shows the formal name of the adapter.

Class: A field that shows the fully qualified class name that implements the functionality of this adapter. Use this class name when loading the adapter in StreamSQL programs with the APPLY JAVA statement. You can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start with application: If this field is set to Yes or to a module parameter that evaluates to true, an instance of this adapter starts as part of the containing StreamBase Server. If this field is set to No or to a module parameter that evaluates to false, the adapter is loaded with the server, but does not start until you send an sbadmin resume command, or until you start the component with StreamBase Manager. With this option set to No or false, the adapter does not start even if the application as a whole is suspended and later resumed. The recommended setting is selected by default.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports and Error Streams to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Adapter Properties Tab

Property Type Description
Request Id Field Name string The field in the incoming tuple which represents the requestId value to be used to looked up the original HTTP request and corresponding web server. This field must be of type string.
Data Field Name string The field in the incoming tuple which represents the data to send as the HTTP response. This field must be of type string or blob.
Http Headers Field Name string The field in the incoming tuple which represents the HTTP headers to send with the HTTP response. This field must be of type list<tuple<string Key,string Value>>.

Example:

list(
    tuple('Access-Control-Allow-Origin' as Key, '*' as Value),
    tuple('Access-Control-Allow-Headers' as Key, 'Origin, X-Requested-With, Content-Type, Accept' as Value),
    tuple('Test-Header-page' as Key, '1234' as Value)
)
Status Code Field Name string *Optional, The field in the incoming tuple which represents the status code to send with the HTTP response. The field must be of type int. If the value is not specified, the default 200 will be used.
Content Type Field Name string *Optional, The field in the incoming tuple which represents the content type to send with the HTTP response. The field must be of type string. If the value is not specified, the system will try to determine the best content type based on the data field.
Cookies Field Name string *Optional, The field in the incoming tuple which represents the cookies to send with the HTTP response. The field can have the following schemas:
  • list<tuple<sting name,string value>>

  • list<tuple<sting name,string value, int maxAge>>

  • list<tuple<sting name,string value,int maxAge,string comment,string domain,boolean httpOnly,string path,boolean secure,int version>>

Log Level Drop-down list Controls the level of verbosity the adapter uses to issue informational traces to the console. This setting is independent of the containing application's overall log level. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL.

HTTP Headers Properties Tab

Property Type Description
Default HTTP Headers string, string

The default HTTP headers that will be added to each output response. These values will be overridden by any HTTP fields given by the input tuple.

An example of an HTTP header might be 'Access-Control-Allow-Origin' with a value of '*' to allow all cross server requests.

Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.