Creating and Mapping Context Parameters
You can add context parameters to REST bindings in the Context Parameters section of the General tab.
Procedure
- Navigate to the General tab > Context Parameters section of a Promoted Service or Reference.
- Add a new Context Parameter; select the Operation(s) it applies to, the Direction (Input, Output or Fault), and the Type (Basic or Bag). For Basic Context Parameters, select a Definition, to describe the data type of the parameter.
- Navigate to the Bindings tab, in the REST Binding Context Parameter Mapping section and specify the HTTP header name in the Header Name column.
-
If the selected type is
Basic, specify the HTTP header name in the
Header Name column.
The specified Header Name appears as a HTTP Header on the wire and the context Parameter name is used by Java IT for the Get and Set methods. For instance, the Basic string context parameter bookNameCP is mapped to HTTP Header Name bookName. That is, when REST service binding intercepts a request, it retrieves the value of the HTTP Header bookName and makes it available to IT Implementation as a value of context parameter bookNameCP.
-
Generate Java IT Implementation and add the following declaration to the Implementation class:
//org.osoa.sca.annotations.Context @Context //com.tibco.amf.platform.runtime.extension.context.ComponentContext public ComponentContext componentContext;
Copyright © Cloud Software Group, Inc. All rights reserved.