Map the Protocol Headers in Request Context

You can transform the protocol headers within the request and response messages, which includes the transport related information.

Use the responseType as Full to access the request context field. The request context field contains the transport level information and is available for any transformations. The request context field is used for the following purposes:

  • Map the transport header properties and pass it to the next stage in request processing pipeline.
  • Set the transport header properties. For example, when the JMS transport is used as the channel for incoming request, the JMS priority property can be set based on the XPATH value received in a request.
The following example shows how to convert the JMS message element to HTTP header:
<xsl:template match="/">
    <map:mapping-result>
      <map:context>
        <c:context>
          <c:entry key="asg:httpResponse">
            <h:response>
              <h:status-code>200</h:status-code>
              <h:header name="X-Powered-By">Servlet/2.5 JSP/2.1</h:header>
                <h:header name="Content-Type">
                  <xsl:value-of select="concat($sbContentType,'; start-info=text/xml')"/>
                </h:header>
                <h:body>
                  <xsl:value-of select="$jmsResponse/k:body"/>
                </h:body>
              </h:response>
            </c:entry>
          </c:context>
        </map:context>
      </map:mapping-result>
    </xsl:template>