Working of HTTP Interceptors
Integration Server makes the raw HTTP requests and responses, including the HTTP headers, status codes, and status messages, accessible to HTTP interceptors.
The working of inbound interceptors is as follows:
Requests:
Integration Server first authenticates the client and then invokes the inbound HTTP interceptor. The
preProcess method of the inbound interceptor has access to the raw HTTP request data, including the headers, and a clone of the request body. The
preProcess method is called before
Integration Server does any processing, such as engaging a content handler on the request. If required, the
preProcess method can stop the normal processing of a request by throwing the
HttpInterceptorException. In the case of inbound interceptors, this exception contains the HTTP status code and the message that
Integration Server sends as a response to the requesting client.
Responses: The inbound HTTP interceptor intercepts the HTTP response just before
Integration Server sends it to the client. The
postProcess method of the inbound interceptor can access a clone of the response body, along with the response status code, status message, and headers, before
Integration Server writes the response to the connection.
The working of outbound interceptors is as follows:
Requests:
Integration Server invokes the
preProcess method of the outbound HTTP interceptor just before sending the request to the provider. The
preProcess method has access to the raw HTTP request data, including the headers, and a clone of the request body. If required, the
preProcess method can prevent
Integration Server from sending the request by throwing an
HttpInterceptorException.
Responses:
Integration Serverclones the response it receives and invokes the
postProcess method of the outbound interceptor. The
postProcess method processes the cloned response in parallel to
Integration Server response processing.