Skip to content

This section describes the key interfaces involved in implementing a service interceptor for ArcGIS Enterprise. These interfaces define the core lifecycle, request/response handling, metadata access, utility methods, and logging capabilities essential for building robust interceptor logic.

IServerServicesInterceptor

This is the core interface that every service interceptor must implement. It defines the interceptor’s lifecycle and the primary entry points for initialization and runtime processing:

  • init(IInterceptorConfig, IServerServicesInterceptorHelper, IServerInterceptorLogger)

    Invoked once when the interceptor is registered with ArcGIS Server. Typically used to load configuration properties, initialize helper resources, establish database connection, set up logging, or prepare reusable state.

  • intercept(IInterceptorRequest, IInterceptorResponse, IServerServicesInterceptorChain)

    Invoked for every incoming REST request that matches the defined urlPatterns. Enables inspection, modification, or logging of both the request and response objects.

  • cleanup()

    Invoked when the interceptor is unregistered or the ArcGIS Server is shutting down. Typically used for releasing resources, schema locks, close connections and performing any necessary cleanup tasks.

Refer to IServerServicesInterceptor for more details.

Annotation Interface Interceptor

The Interceptor annotation is used to mark implementations of the IServerServicesInterceptor interface. It provides metadata about the interceptor, such as its name, display name, description, URL patterns it applies to, and configurable properties. This annotation should be applied at the type level to register an interceptor with the framework.

Elements:

  • name - The unique name of the interceptor.
  • displayName - A human-readable display name for the interceptor.
  • description - A brief description of the interceptor's purpose.
  • urlPatterns - The URL patterns to which the interceptor applies.
  • properties - The configurable properties for the interceptor.
  • chainingOrder – The configurable chaining order for the interceptor

IInterceptorConfig

This interface provides configuration metadata for the interceptor instance. It includes methods to retrieve interceptor name, display name, description, class name, execution chain order, URL patterns the interceptor applies to and runtime properties (Map<string, string>) for configurable behavior.

Refer to IInterceptorConfig for more details.

IServerServicesInterceptorChain

This interface controls the continuation of request/response processing in a chain of interceptors.

  • intercept(request, response) Forwards the request to the next interceptor in the chain or the target service.
  • isRestRequestChain() Returns true if the request is a REST-based call. Useful for excluding SOAP or other non-REST traffic from processing.

Refer to IServerServicesInterceptorChain for more details.

IServerServicesInterceptorHelper

This interface contains utility methods that provide contextual and diagnostic information about intercepted service. It also included methods to extract service metadata like service name, service type, operation name. It also had methods to retrieve user identity information like username and user role. It also had data utility methods like getting compressed and decompressed response data. It also includes type checks to check if it is REST request and output stream is compressed or not.

This interface is particularly helpful for writing logic that varies by service type, user role, or operation. Refer to IServerServicesInterceptorHelper for more details.

IServerInterceptorLogger

This interface is used to log messages from within an interceptor to ArcGIS Server’s log system. It contains methods to log messages for various log level like info, debug, warning and severe. It also contains overload log(logLevel, message) and log(logLevel, exception) methods.

These logs are written to the ArcGIS Server logs and help with debugging, troubleshooting, monitoring, tracking runtime events etc. Refer to IServerInterceptorLogger for more details.

IInterceptorRequest

This interface encapsulates the original HTTP servlet request and exposes only the relevant methods and properties. It supports accessing request parameters, reading headers, retrieving request metadata, handling multipart content and reading body stream. This interface allows fine-grained inspection, validation of the incoming request and retrieve request attributes and body.

Refer to IInterceptorRequest for more details.

IInterceptorResponse

This interface encapsulates the original HTTP servlet response and exposes only the relevant methods and properties. It supports reading/modifying response headers, writing output stream, controlling response behavior, and managing encodings. This interface allows fine-grained inspection of response, transform, sanitize or enrich response data, apply post-processing logic before content is sent to the client.

Refer to IInterceptorResponse for more details.

ServerServicesInterceptorRequestWrapper and ServerServicesInterceptorResponseWrapper

These are wrapper classes used for extending or decorating IInterceptorRequest and IInterceptorResponse respectively. It provides pass-through access with getAppInterceptorRequest() or getAppInterceptorResponse() which returns the original object. It also replicates all getter methods from core interfaces, allowing wrappers to act as stand-ins. It enables reuse of input/output stream, which are otherwise read-once by default. The ServerServicesInterceptorRequestWrapper and ServerServicesInterceptorResponseWrapper have these features:

  • Hold the original request or response (getAppInterceptorRequest() / getAppInterceptorResponse())
  • Provide all the get methods from the core interfaces of HTTP request/response, so the wrapper behaves like the real object
  • Allow you to buffer streams so they can be read or written multiple times
  • Let you override default behavior if needed

Refer to ServerServicesInterceptorRequestWrapper and ServerServicesInterceptorResponseWrapper for more details.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.