6.5.3. HTTP Messaging Response Conversion Handler

This handler converts the response message object created by the subsequent handler to a HTTP response object. The value of the protocol header in the response message object is set in the corresponding HTTP header, and serialized to a format such as XML or JSON.

This handler performs the following processes:

  • Converts the contents of response message object to HTTP response object.

The process flow is as follows.

../../../../_images/flow12.png

6.5.3.2. Module list

<dependency>
  <groupId>com.nablarch.framework</groupId>
  <artifactId>nablarch-fw-messaging-http</artifactId>
</dependency>

6.5.3.3. Constraints

Configure this handler after the HTTP Response Handler
As the HTTP response object generated by this handler is returned by the HTTP Response Handler to the client.

6.5.3.4. Value set in the response header

Configure the following response header based on the response message object created by the subsequent handler.

Status-Code:

Configures the status code of the response message object.

Content-Type:

Acquires and configures the following values from the formatter (InterSystemMessage.getFormatter()) of the response message object.

When MIME is application/json and charset is utf-8 , Content-Type will have the following value.

application/json;charset=utf-8

Correlation message ID:
 

Configures the value of CorrelationId configured in the response message object to the response header X-Correlation-Id .

Important

This handler cannot configure response headers not described above.

To use a response header other than the above, create a handler in the project.

6.5.3.5. Change the layout of the framework control header

When changing the definition of the framework control header in the response message, the definition of the framework control header extended in the project has to be configured. If it is not configured, the default StructuredFwHeaderDefinition will be used.

For details of the framework control header, see framework control header .

A configuration example is shown below.

<component class="nablarch.fw.messaging.handler.HttpMessagingResponseBuildingHandler">
  <!-- Configuring the framework control header -->
  <property name="fwHeaderDefinition">
    <component class="sample.SampleFwHeaderDefinition" />
  </property>
</component>