skip to main content
Corticon Extensions Guide : Code conventions : Accessing HTTP Headers in Extended Operators and Service Callouts

Try Corticon Now

Accessing HTTP Headers in Extended Operators and Service Callouts

Access to Vocabulary Metadata through the ICcDataObjectManager

When deployed as a web service, the Corticon server can retrieve all HTTP header name/value pairs from the HTTP session. These will be placed in a class implementing the ICcServerHttpInfo interface. This class is available from the ICcDataObjectManager class passed to all extensions.
An example of a service callout accessing the HTTP headers is as follows:

public static void getHttpHeaders(ICcDataObjectManager dataObjMgr)
ICcServerHttpInfo ccServerHttpInfo = dataObjMgr.getCcServerHttpInfo();
Map<String, String> httpHeaders = ccServerHttpInfo.getHttpHeaders();
for (Map.Entry<String, String> entry : httpHeaders.entrySet())
String key = entry.getKey();
String value = entry.getValue();
One use of this mechanism is to pass a user security token from the client making the request to the decision service where an extension can use the token to access an external data source as the client. This is useful when Corticon is behind a SaaS or other multi-tenant service and a decision service needs to access external data as a specific tenant. Corticon simply makes the HTTP headers available, their interpretation is dependent on the extension that uses them.
See the Corticon extension JavaDoc for more details.