Interceptors for adapting the Java HTTP Servlet interfaces.


added in 0.7.0

(default-exception-analyzer _context exception)

The default for the :exception-analyzer option, this function is passed the context and a thrown exception that bubbled up to the stylobate interceptor.

Primarily, this function determines if an exception should be logged or not; it can also log or otherwise report an exception itself, and then prevent the stylobate interceptor from reporting the exception, by returning nil.

If a non-nil value is returned, it must be an exception, which will be logged.

This implementation returns the exception, unless it represents a broken pipe (a common exception that occurs when, during a long response, the client terminates the socket connection).


An interceptor which catches errors, renders them to readable text and sends them to the user. This interceptor is intended for development time assistance in debugging problems in pedestal services. Including it in interceptor paths on production systems may present a security risk by exposing call stacks of the application when exceptions are encountered.


(http-interceptor-service-fn interceptors)(http-interceptor-service-fn interceptors default-context)(http-interceptor-service-fn interceptors default-context options)

Returns a function which can be used as an implementation of the Servlet.service method. It executes the interceptors (which must be already converted into Interceptor records) on an initial context map containing :servlet, :servlet-config, :servlet-request, and :servlet-response. The stylobate and ring-response interceptors are prepended to the sequence of interceptors.

Options: :exception-analyzer - function that analyzes exceptions that propagate up to the stylobate interceptor, defaults to default-exception-analyzer.

This is normally called automatically from io.pedestal.http/service-fn.


An interceptor which transmits a Ring specified response map to an HTTP response.

If a later interceptor in this context throws an exception which is not caught, this interceptor will set the HTTP response status code to 500 with a generic error message. Also, if later interceptors fail to furnish the context with a :response map, this interceptor will set the HTTP response to a 500 error.


(set-response servlet-resp resp-map)


deprecated in 0.7.0

An interceptor which primarily handles uncaught exceptions thrown during execution of the interceptor chain.

This var is deprecated in 0.7.0 as it should only be added to the interceptor chain by http-interceptor-service-fn.


deprecated in 0.7.0

An interceptor which causes execution to terminate when one of the interceptors produces a response, as defined by ring.util.response/response?

Prior to 0.7.0, this interceptor was automatically queued. In 0.7.0, the context is initialized with a terminator function and this interceptor is no longer used.





(default-content-type body)

Get default HTTP content-type for body.


(write-body-to-stream body output-stream)

Write body to the stream output-stream.





(write-body-async body servlet-response resume-chan context)