Liking cljdoc? Tell your friends :D

Deprecations

Removed in Pedestal 1.0

Pedestal 1.0 removed the functionality below, which was deprecated in Pedestal 0.8; each section says what to use instead. In 0.8.3, each deprecation warning announced the removal, named the replacement, and linked to its section here.

The removed namespaces and functions are deleted, so code that still uses them fails to compile. Three options would otherwise be ignored silently, changing the behavior of the application, so using them throws an exception that names the replacement and links to its section here: the :websockets key (see Non-routed WebSockets), the :insecure-ssl? Jetty option (see The :insecure-ssl? Jetty option), and the :array-coerce-fn JSON parser option (see The :array-coerce-fn JSON parser option).

io.pedestal.http

The service map API was replaced by connectors: api:*[ns=io.pedestal.connector] builds a connector map, and a connector, such as api:create-connector[ns=io.pedestal.http.jetty] or api:create-connector[ns=io.pedestal.http.http-kit], runs it; see reference:connector.adoc. The io.pedestal.http.specs namespace, and the server function of io.pedestal.http.jetty, which only served the service map API, were removed too.

RemovedUse instead

create-server, server, create-provider, interceptor-chain-provider, create-servlet, service-fn, servlet

A connector; to test it without starting it, api:response-for[ns=io.pedestal.connector.test]

start, stop

api:start![ns=io.pedestal.connector], api:stop![ns=io.pedestal.connector]

default-interceptors

api:with-default-interceptors[ns=io.pedestal.connector], or your own list with api:with-interceptors[ns=io.pedestal.connector]

dev-interceptors

api:optionally-with-dev-mode-interceptors[ns=io.pedestal.connector]

enable-debug-interceptor-observer, default-debug-observer-omit

api:with-interceptor-observer[ns=io.pedestal.connector.dev], api:default-debug-observer-omit[ns=io.pedestal.connector.dev]

servlet-init, servlet-service, servlet-destroy (with the ClojureVarServlet)

For a WAR file, the ConnectorServlet with api:create-bridge[ns=io.pedestal.connector.servlet]; see guides:war-deployment.adoc

response?, respond-with, json-response

api:response?[ns=io.pedestal.http.response], api:respond-with[ns=io.pedestal.http.response], api:json-response[ns=io.pedestal.http.response]

edn-response (also in io.pedestal.http.response)

The data as the response :body: a collection is written as EDN (application/edn)

log-request, not-found, html-body, json-body, transit-body-interceptor, transit-json-body, transit-msgpack-body, transit-body

The same names in api:*[ns=io.pedestal.service.interceptors] (transit-body is transit-json-body)

A seq of route maps as :io.pedestal.http/routes

The route specifications, or the result of api:expand-routes[ns=io.pedestal.http.route]

io.pedestal.test

Replaced by api:*[ns=io.pedestal.connector.test], which tests a connector without starting it; see reference:unit-testing.adoc.

RemovedUse instead

response-for, raw-response-for, servlet-response-for, create-responder

api:response-for[ns=io.pedestal.connector.test], passed the connector (which doesn’t need to be started). It doesn’t go through the Servlet API. Request header names are passed as given, not lower-cased: use lower-case names, such as "content-type".

disable-routing-table-output-fixture

api:disable-routing-table-output-fixture[ns=io.pedestal.connector.test]

parse-url

No replacement; only io.pedestal.test needed it

Non-routed WebSockets

The :io.pedestal.http/websockets service map key, and add-endpoint and add-endpoints in io.pedestal.websocket, were replaced by routed WebSockets: put api:websocket-interceptor[ns=io.pedestal.service.websocket] in a route, so that the route’s other interceptors (such as authentication) run before the upgrade; see reference:websockets.adoc. A :websockets key in the connector map throws an exception rather than being ignored.

Server-sent events

start-event-stream and sse-setup in io.pedestal.http.sse were replaced by api:start-stream[ns=io.pedestal.http.sse], called from your own interceptor; see reference:server-sent-events.adoc.

Quoted route specifications and expressions

Pedestal 1.0 no longer resolves symbols or evaluates lists in route specifications and interceptor lists; these usually came from syntax-quoting the whole route specification.

  • For a handler, use a Var ({:get #'list-orders}): it gives the same route, including the route name (:myapp.service/list-orders), in terse, verbose, and table routes. A function also works; see reference:terse-syntax.adoc.

  • For an expression that returns an interceptor, such as (body-params/body-params), call it when the routes are defined: remove the quote.

Anonymous interceptors

Pedestal 1.0 gives an interceptor without a :name a name automatically, derived from its function, so that it can be identified in logs, traces, and errors; there is no longer a warning. Route names don’t change: the automatic name is not used to derive a route name. To choose the name, add a :name key (a namespaced keyword), or use api:definterceptor[ns=io.pedestal.interceptor]; see reference:interceptors.adoc.

io.pedestal.http.jetty.util

dispatcher-set, filter-holder, and add-servlet-filter have no replacement: use Jetty’s API directly, for example in a function passed as the :context-configurator container option; see reference:jetty.adoc. The io.pedestal.http.jetty.container namespace is now internal.

The :insecure-ssl? Jetty option

Use the :sni-host-check? container option instead, with the opposite value: :insecure-ssl? true becomes :sni-host-check? false. The :insecure-ssl? option throws an exception rather than being ignored.

The :array-coerce-fn JSON parser option

Use the :value-fn option of api:custom-json-parser[ns=io.pedestal.http.body-params] instead. The :array-coerce-fn option throws an exception rather than being ignored.

Other

  • add-satisfies-constraints? in io.pedestal.http.route.prefix-tree: no replacement; only Pedestal’s routers needed it.

  • exception-debug in io.pedestal.http.impl.servlet-interceptor: use api:uncaught-exception[ns=io.pedestal.connector.dev].

  • The default-content-type function of the WriteableBody protocol: Pedestal stopped calling it in 0.8.3 and 1.0 removed it from the protocol; remove it from your implementations (a deftype or defrecord that still defines it fails to compile).

0.8.0

The focus of release 0.8 is to improve and unify routing, and to support reference:jetty.adoc and reference:http-kit.adoc, but a secondary focus is to remove dead code.

Many functions, macros, and even namespaces deprecated in 0.7.0 have been fully removed in 0.8.0.

There have been significant changes to routing, including some non-backwards compatible changes to functions, namespaces, and protocols; these changes should only be concerning if you have previously implemented your own routing specifications or routers.

Newly deprecated namespaces:

  • api:*[ns=io.pedestal.jetty.container]

  • api:*[ns=io.pedestal.jetty.util]

These represent functionality that is not well supported by Pedestal, or internal namespaces that should not be used by application code.

WebSocket upgrade requests are now routed, like any other request; the prior approach (the ::http/websockets service map key) has been deprecated.

In io.pedestal.websocket, the following functions are deprecated:

  • add-endpoint

  • add-endpoints

In io.pedestal.interceptor:

  • Support for the deferred interceptors (via :interceptor or :interceptorfn metadata) was removed

  • Anonymous interceptors are deprecated

All of api:*[ns=io.pedestal.http] has been deprecated in favor of api:*[ns=io.pedestal.connector].

Suppressing Warnings

The number of warnings concerning deprecated functions has grown considerably in 0.8.0; although in the future many of these functions may actually be removed, it still causes considerable noise (which may drive users to move to the new APIs). However, this also results in a flurry of output when an application is first started, which can be annoying during development.

It is now possible to suppress deprecation warnings.

JSON Parsing

The library used for JSON streaming and parsing switched from cheshire to charred.

The :array-coerce-fn option that was passed to cheshire (via api:custom-json-parser[ns=io.pedestal.http.body-params]) is deprecated.

0.7.0

In most cases, Pedestal can now emit a warning the first time a deprecated function, macro, or other bit of functionality is used.

Example:

WARNING: io.pedestal.interceptor.chain/execute-only is deprecated and may be removed in a future release
Call stack: ... clojure.test/test-var -> clojure.test/test-var/fn -> io.pedestal.interceptor-test/fn -> io.pedestal.interceptor.chain/execute-only

The warning is followed by the last few stack frames leading up to the deprecated function, to assist you in finding the code that needs to be changed.

This output is printed to the console (standard error), and is not logged.

The following sections are a non-exhaustive list of code and functionality deprecated in 0.7.0 that may be removed in 0.8.0 or a later release:

Interceptors

Release 0.7.0 saw the introduction of the api:routes-from[ns=io.pedestal.http.route] macro, a new and preferred way of supporting live code changes at the REPL.

Previously, it was possible to convert a function call into an interceptor; the point of this was to defer invoking the function until when the route specification was converted to a router (which can happen on every request when in development mode); however, this relied on the use of clj:eval[], and is of no real utility given the addition of development mode and live REPL reloading improvements, and so has been deprecated.

Normally, a function in an interceptor list is treated as a handler (rather than an interceptor). Alternately, a function with the :interceptor or :interceptorfn metadata would be invoked and expected to return an interceptor (or some other object that could be converted to an interceptor). This is termed a deferred interceptor and has also been deprecated.

Handler functions are not deprecated, and are quite useful.

Service

The api:*[ns=io.pedestal.http.request.lazy] and api:*[ns=io.pedestal.http.request.zerocopy] namespaces have been deprecated; neither is used by Pedestal.

Service Tools

The entire pedestal/pedestal.service-tools library has been deprecated.

Interceptor Chain

The api:execute-only[ns=io.pedestal.interceptor.chain] function has been deprecated; it is not believed this function is used outside of Pedestal’s test suite. Removing it opens up some options for optimizing chain execution in a later release.

Likewise, the newly added api:queue[ns=io.pedestal.interceptor.chain] function replaces accessing the interceptor execution queue using the :io.pedestal.interceptor.chain/queue key; this will also allow future optimizations to chain execution.

Tracing and Metrics

The namespace api:*[ns=io.pedestal.interceptor.trace] was deprecated along with many related functions and protocols in the api:*[ns=io.pedestal.log] namespace related to metrics and tracing; these have been replaced with a new library, pedestal.telemetry.

0.6.0

The entire api:*[ns=io.pedestal.interceptor.helpers] namespace was deprecated; this had been retained since 2016 for backwards compatibility.

Can you improve this documentation? These fine people already did:
Howard M. Lewis Ship, Eric Dallo & Howard Lewis Ship
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close