001package com.esri.arcgis.enterprise.interceptor.server;
002
003import com.esri.arcgis.enterprise.interceptor.IInterceptorConfig;
004import com.esri.arcgis.enterprise.interceptor.IInterceptorRequest;
005import com.esri.arcgis.enterprise.interceptor.IInterceptorResponse;
006import jakarta.servlet.ServletException;
007
008import java.io.IOException;
009
010/**
011 * Enterprise Interceptor is an Enterprise level interceptor (Server and Portal) that can be used to
012 * intercept requests/responses to/from different components of the system.
013 */
014public interface IServerServicesInterceptor {
015
016    /**
017     * Initialize the interceptor
018     *
019     * @param interceptorConfig interceptor configuration.
020     * @param interceptorHelper interceptor helper.
021     * @param logger            interceptor logger.
022     */
023    void init(IInterceptorConfig interceptorConfig,
024              IServerServicesInterceptorHelper interceptorHelper,
025              IServerInterceptorLogger logger);
026
027    /**
028     * Intercept the request
029     *
030     * @param request          the request to pass along the chain.
031     * @param response         the response to pass along the chain.
032     * @param interceptorChain the chain object to pass the request along the chain.
033     * @throws IOException      if an I/O error occurs during the processing of the
034     *                          request
035     * @throws ServletException if the processing fails for any other reason
036     */
037    void intercept(IInterceptorRequest request, IInterceptorResponse response, IServerServicesInterceptorChain interceptorChain)
038            throws IOException, ServletException;
039
040}