com.ibm.zosconnect.spi

Interface InterceptorRequester

  • All Superinterfaces:
    Interceptor
    All Known Subinterfaces:
    EarlyFailureInterceptorRequester, EndpointInterceptor


    public interface InterceptorRequester
    extends Interceptor
    Applies to zosConnect-2.0 and zosConnect-3.0.

    Defines an OSGI service that is invoked before and after the z/OS Connect processing of an API requester request.

    When more than one interceptor is configured, the order in which they are called is determined when a sequence number is specified, see Interceptor.getSequence(). The postInvokeRequester methods of interceptors are processed in the opposite order to that in which the preInvokeRequester methods are called. All interceptors configured with a sequence number are called before those without. If an interceptor is configured with an invalid sequence number or a duplicate sequence number, the processing order is undefined.

    If an API requester is invoked while a configuration refresh is in progress, interceptor methods might not be called as expected. For example, if an interceptor definition is added to the configuration, for a particular request, the preInvokeRequester method might not get called but the postInvokeRequester method would be called.

    Interceptors can return an HTTP servlet response code by setting it in a InterceptorException. The response code is processed only when the InterceptorException is thrown during preInvokeRequester.

    An exception thrown by the preInvokeRequester method causes immediate failure of the request, and the exception is logged. In this instance, the postInvokeRequester method is called for all those interceptors for which the preInvokeRequester method had been successfully called, and for the one that reported the error.

    This interface is available from z/OS Connect 3.0.39.0.

    • Method Detail

      • preInvokeRequester

        void preInvokeRequester(java.util.Map<java.lang.Object,java.lang.Object> requestStateMap,
                                DataRequester data)
                         throws InterceptorException
        Runs implementor specific logic before z/OS Connect processing of an API requester request. If an exception is thrown during the execution of this method, the request is failed and the exception is reported.
        Parameters:
        requestStateMap - A map object that holds implementor data that can be retrieved and/or updated by artifacts that have a reference to it (e.g. Interceptor.preInvokeRequester(), Inteceptor.postInvokeRequester()). z/OS Connect creates a new map and makes it available to the consuming artifacts per request. Prefix key strings with your own unique identifier to avoid clashes with those created by other interceptor providers. Key string entries starting with "IBM_ZOS_CONNECT" are reserved for z/OS Connect EE use.
        data - Request specific data.
        Throws:
        InterceptorException - If an error was encountered during the interceptor's execution.
      • postInvokeRequester

        void postInvokeRequester(java.util.Map<java.lang.Object,java.lang.Object> requestStateMap,
                                 DataRequester data)
                          throws InterceptorException
        Runs implementor specific logic after z/OS Connect processing of an API requester request is complete.
        Parameters:
        requestStateMap - A map object that holds implementor data that can be retrieved and/or updated by artifacts that have a reference to it (e.g. Interceptor.preInvokeRequester(), Inteceptor.postInvokeRequester()). z/OS Connect creates a new map and makes it available to the consuming artifacts per request. Prefix key strings with your own unique identifier to avoid clashes with those created by other interceptor providers. Key string entries starting with "IBM_ZOS_CONNECT" are reserved for z/OS Connect EE use.
        data - Response specific data.
        Throws:
        InterceptorException - If an error was encountered during the interceptor's execution.