webMethods and Intelligent Business Operations 10.2 | Running Business Processes and Composite Applications | webMethods Integration Server Administrator’s Guide | Using an HTTP Interceptor | Overview of HTTP Interceptors
 
Overview of HTTP Interceptors
Integration Server provides a framework for creating and registering an HTTP interceptor. An HTTP interceptor intercepts all received HTTP requests and outbound HTTP responses. Integration Server makes the raw HTTP request and response, including the HTTP header information, accessible to the HTTP interceptor. In the case of HTTP requests, the HTTP interceptor intercepts a received HTTP request before Integration Server performs any processing. For an outbound HTTP response, the HTTP interceptor intercepts an HTTP response after Integration Server creates the HTTP response but before Integration Server sends the response to the requesting client.
An HTTP interceptor is comprised of:
*A preProcess method that gets called for every HTTP request received by Integration Server. The com.softwareag.is.interceptor.HTTPInterceptorIFC.preProcess method 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 has done any processing, such as engaging a content handler. However, Integration Server authenticates the client before calling the preProcess method. The preProcess method can stop normal processing for the HTTP request by * throwing an exception, specifically a HTTPInterceptorException. The exception contains the HTTP status code and message that Integration Server will use in its response to the requesting client.
*A postProcess method that gets called for every HTTP response that Integration Server sends. Before Integration Server writes the HTTP response to the connection, the com.softwareag.is.interceptor.HTTPInterceptorIFC.postProcess method receives a clone of the response body along with response status code, status message, and headers.
An HTTP interceptor can be useful if there is some logic, such as an auditing requirement, that you want executed for every request and response. By placing the logic in the interceptor, you ensure that Integration Server executes the logic for every HTTP request and response. For example, you can use an HTTP interceptor to write all HTTP requests and responses to a data lake or perform some kind of logging.

Copyright © 2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release