001package com.esri.arcgis.enterprise.interceptor.server;
002
003import com.esri.arcgis.enterprise.interceptor.IInterceptorRequest;
004import com.esri.arcgis.enterprise.interceptor.IInterceptorResponse;
005import jakarta.servlet.ServletException;
006
007import java.io.IOException;
008
009/**
010 * InterceptorChain is used to manage the execution of chain of interceptors
011 * for a particular request.  When all the matching interceptors are executed,
012 * the request is passed to the next object in the chain (next filter's doFilter
013 * or the handler).
014 */
015public interface IServerServicesInterceptorChain {
016
017    /**
018     * Invokes the next interceptor in the chain. If the calling
019     * interceptor is the last in the chain, then the resource at the end of
020     * the chain will be invoked.
021     *
022     * @param request  the request to pass along the chain.
023     * @param response the response to pass along the chain.
024     * @throws IOException      if an I/O error occurs during the processing of the
025     *                          request
026     * @throws ServletException if the processing fails for any other reason
027     */
028    void intercept(IInterceptorRequest request, IInterceptorResponse response)
029            throws IOException, ServletException;
030
031    boolean isRestRequestChain();
032}