HTTP interceptor pipeline for Ring request/response processing.
This namespace provides an HTTP-specific interceptor chain that runs over Ring handlers, giving Pedestal-like enter/leave/error semantics while maintaining Ring compatibility.
Key Benefits:
HTTP Context Model: {:request Ring request map :response Ring response map (built up through pipeline) :route Route metadata from Reitit match :path-params Extracted path parameters :query-params Extracted query parameters :system Observability services {:logger :metrics-emitter :error-reporter} :attrs Additional attributes set by interceptors :correlation-id Unique request ID :started-at Request start timestamp}
Interceptor Shape: {:name :my-interceptor :enter (fn [context] ...) ; Process request, modify context :leave (fn [context] ...) ; Process response, modify context :error (fn [context] ...)} ; Handle exceptions, produce safe response
Usage: ;; As Ring middleware (global) (def handler (-> app-handler (wrap-http-interceptors [logging metrics error-reporting])))
;; Per-route via Reitit :middleware {:get {:handler my-handler :middleware [(interceptor-middleware [auth rate-limit])]}}
Route data may also carry an :interceptors vector; when the routes are compiled, it becomes :middleware running through this same runner.
HTTP interceptor pipeline for Ring request/response processing.
This namespace provides an HTTP-specific interceptor chain that runs over Ring handlers,
giving Pedestal-like enter/leave/error semantics while maintaining Ring compatibility.
Key Benefits:
- Consistent cross-layer observability (HTTP → service → persistence)
- Declarative per-route policies (auth, rate-limit, auditing)
- Clean separation of concerns (routing vs cross-cutting logic)
- Reusable interceptor components across routes
HTTP Context Model:
{:request Ring request map
:response Ring response map (built up through pipeline)
:route Route metadata from Reitit match
:path-params Extracted path parameters
:query-params Extracted query parameters
:system Observability services {:logger :metrics-emitter :error-reporter}
:attrs Additional attributes set by interceptors
:correlation-id Unique request ID
:started-at Request start timestamp}
Interceptor Shape:
{:name :my-interceptor
:enter (fn [context] ...) ; Process request, modify context
:leave (fn [context] ...) ; Process response, modify context
:error (fn [context] ...)} ; Handle exceptions, produce safe response
Usage:
;; As Ring middleware (global)
(def handler
(-> app-handler
(wrap-http-interceptors [logging metrics error-reporting])))
;; Per-route via Reitit :middleware
{:get {:handler my-handler
:middleware [(interceptor-middleware [auth rate-limit])]}}
Route data may also carry an :interceptors vector; when the routes are
compiled, it becomes :middleware running through this same runner.Compiles the application's route data into a Ring handler.
Modules emit Reitit route data and this namespace hands it to Reitit (ADR-037), so what is left here is behaviour rather than translation: exception handling, the coercion error shape, the Swagger routes, gzip, and the interceptor stack each route is decorated with.
Compiles the application's route data into a Ring handler. Modules emit Reitit route data and this namespace hands it to Reitit (ADR-037), so what is left here is behaviour rather than translation: exception handling, the coercion error shape, the Swagger routes, gzip, and the interceptor stack each route is decorated with.
Ring+Jetty server adapter - manages HTTP server lifecycle using Ring and Jetty.
This adapter implements the IHttpServer protocol to start and stop Jetty-based HTTP servers with Ring handlers.
Ring+Jetty server adapter - manages HTTP server lifecycle using Ring and Jetty. This adapter implements the IHttpServer protocol to start and stop Jetty-based HTTP servers with Ring handlers.
HTTP API versioning support - wraps routes with version prefixes and headers.
SIDE EFFECTS:
Provides URL-based versioning (/api/v1/users, /api/v2/users) with:
HTTP API versioning support - wraps routes with version prefixes and headers. SIDE EFFECTS: - Route transformation - Response header modification - Logging Provides URL-based versioning (/api/v1/users, /api/v2/users) with: - Automatic version prefix wrapping - Version header injection (X-API-Version, X-API-Latest, X-API-Deprecated) - Backward compatibility (/api/users → /api/v1/users redirect) - Multiple version support concurrently
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |