Liking cljdoc? Tell your friends :D

io.pedestal.http.ring-middlewares

This namespace creates interceptors for ring-core middlewares.

Ring provides a trove of useful and familiar functionality; this namespace exposes that functionality as interceptors that work with Pedestal.

In some cases, some or all of the Ring middleware has been reimplemented here.

This namespace creates interceptors for ring-core middlewares.

Ring provides a trove of useful and familiar functionality; this namespace exposes that functionality
as interceptors that work with Pedestal.

In some cases, some or all of the Ring middleware has been reimplemented here.
raw docstring

content-typeclj

(content-type & [opts])

Applies a Content-Type header to a response if missing by mapping the file name extension in the request's URI.

The MIME mapping occurs in the function ring.util.mime-type/ext-mime-type.

The opts arguments are key/value pairs; the :mime-types key is a map of overrides for extensions to MIME type mappings.

Applies a Content-Type header to a response if missing by mapping the
file name extension in the request's URI.

The MIME mapping occurs in the function ring.util.mime-type/ext-mime-type.

The opts arguments are key/value pairs; the :mime-types key is a map
of overrides for extensions to MIME type mappings.
sourceraw docstring

cookiesclj

Add support for HTTP cookies. On :enter, a :cookies key is added to the request map, containing the parsed cookie data (from the "cookie" HTTP header), as a map from cookie name to cookie data; each cookie is itself a map with key :value.

This is a wrapper around the ring.middleware.cookies namespace.

When the response map contains a :cookies key, a "Set-Cookie" header will be added to propagate cookie data back to the client.

Add support for HTTP cookies.  On :enter, a :cookies key is added to the request map, containing
the parsed cookie data (from the "cookie" HTTP header), as a map from cookie name to cookie data;
each cookie is itself a map  with key :value.

This is a wrapper around the ring.middleware.cookies namespace.

When the response map contains a :cookies key, a "Set-Cookie" header will be added to
propagate cookie data back to the client.
sourceraw docstring

fast-resourceclj

(fast-resource root-path)
(fast-resource root-path opts)

Fast access to static resources from the classpath; essentially works like the resource interceptor, but the response :body will be a java.nio.channels.FileChannel that can be streamed to the client asynchronously.

A file is large if it is larger than the HTTP buffer size, which is calculated from the servlet-response's bufferSize, or defaults to 1460 bytes (if the servlet response is not known).

If successful, marks the current tracing span as routed, with a route-name of :fast-resource.

If your container doesn't recognize FileChannel response bodies, this interceptor will cause errors.

Supports a map of options:

:index? - If path is a directory, will attempt to find an 'index.*' file to serve. Defaults to true :follow-symlinks? - Serve files through symbolic links. Defaults to false :loader - A class loader specific for these resource fetches. Default to nil (use the main class loader).

Fast access to static resources from the classpath; essentially works like the [[resource]] interceptor, but
the response :body will be a java.nio.channels.FileChannel that can be streamed to the client
asynchronously.

A file is large if it is larger than the HTTP buffer size, which is calculated from
the servlet-response's bufferSize, or defaults to 1460 bytes (if the servlet response is not known).

If successful, marks the current tracing span as routed, with a route-name of :fast-resource.

If your container doesn't recognize FileChannel response bodies, this interceptor will cause errors.

Supports a map of options:

:index? - If path is a directory, will attempt to find an 'index.*' file to serve. Defaults to true
:follow-symlinks? - Serve files through symbolic links. Defaults to false
:loader - A class loader specific for these resource fetches. Default to nil (use the main class loader).
sourceraw docstring

fileclj

(file root-path & [opts])

Allow file-system files to be accessed as static resources. On :enter, if a static file can be found that matches incoming request URI, a response is generated from its content. Since the file interceptor usually ordered before any routing interceptor, this means that such files can mask other application routes.

The interceptor supports both GET and HEAD requests.

The underlying support comes from ring.middleware.file/file-request.

The :body key of the response will be a java.io.File.

If succesful, marks the current tracing span as routed, with a route-name of :file.

Options are specified as key/value pairs after the root-path.

Common options are :index-files? (defaults to true) which maps directory requests to requests for an index file (if present), and :allow-symlinks? (defaults to false) which allows symbolic links to be followed rather than ignored.

Allow file-system files to be accessed as static resources.  On :enter, if a static file can be found
that matches incoming request URI, a response is generated from its content.  Since the file interceptor usually
ordered before any routing interceptor, this means that such files can mask other application routes.

The interceptor supports both GET and HEAD requests.

The underlying support comes from ring.middleware.file/file-request.

The :body key of the response will be a java.io.File.

If succesful, marks the current tracing span as routed, with a route-name of :file.

Options are specified as key/value pairs after the root-path.

Common options are :index-files? (defaults to true) which maps directory requests to requests for
an index file (if present),
and :allow-symlinks? (defaults to false) which allows symbolic links to be followed rather than ignored.
sourceraw docstring

file-infoclj

(file-info & [mime-types])

An interceptor that, on :leave, will check the request's "if-modified-since" headed and convert the response into a status 304 if the underlying file (the :body of the response, a java.io.File) has not been modified since the specified date. It will also set the "Content-Type" response header. The :mime-types option can be provided, it works the same here as in the content-type interceptor.

See ring.middleware.file-info/file-info-response for more details.

An interceptor that, on :leave, will check the request's "if-modified-since" headed
and convert the response into a status 304 if the underlying file (the :body of the response,
a java.io.File) has not been modified since the specified date.  It will also set the "Content-Type" response
header.  The :mime-types option can be provided, it works the same here as in the [[content-type]] interceptor.

See ring.middleware.file-info/file-info-response for more details.
sourceraw docstring

flashclj

(flash)

Support temporary data (the "flash") in the session (see session).

On :leave, the :flash key of the response is stored into the session.

On :enter, the previously stored flash value, if any, is removed from the session and added as the request :flash key.

Support temporary data (the "flash") in the session (see [[session]]).

On :leave, the :flash key of the response is stored into the session.

On :enter, the previously stored flash value, if any, is removed from the session and added as the request :flash key.
sourceraw docstring

(head)

Interceptor to handle head requests

On :enter, when the request method is :head, the request method is converted to :get. On :leave, for a :head request, the response :body is set to nil.

Interceptor to handle head requests

On :enter, when the request method is :head, the request method is converted to :get.
On :leave, for a :head request, the response :body is set to nil.
sourceraw docstring

keyword-paramsclj

Retained for backward compatibility. io.pedestal.http.params/keyword-params is recommended

Retained for backward compatibility. io.pedestal.http.params/keyword-params is recommended
sourceraw docstring

multipart-paramsclj

(multipart-params & [opts])

Interceptor for multipart form parameters (i.e., forms with file uploads).

A wrapper around ring.middleware.multipart-params/multipart-params-request.

This will add a :multipart-params key to the request, and merge the multipart parameters into the request :params map.

Interceptor for multipart form parameters (i.e., forms with file uploads).

A wrapper around ring.middleware.multipart-params/multipart-params-request.

This will add a :multipart-params key to the request, and merge the multipart parameters
into the request :params map.
sourceraw docstring

nested-paramsclj

(nested-params & [opts])

Interceptor for ring.middleware.nested-params/nested-params-request Ring middleware.

Nested parameter names follow a particular naming pattern, the result is that the :params may of the request is converted to a nested map.

Interceptor for ring.middleware.nested-params/nested-params-request Ring middleware.

Nested parameter names follow a particular naming pattern, the result is that the :params
may of the request is converted to a nested map.
sourceraw docstring

not-modifiedclj

(not-modified)

Adds support for the "if-modified-since" and "if-none-match" request headers; generally this applies to responses generated via the file or resource interceptors.

This is a wrapper around ring.middleware.not-modified/not-modified-response.

Adds support for the  "if-modified-since" and "if-none-match" request headers; generally
this applies to responses generated via the [[file]] or [[resource]] interceptors.

This is a wrapper around ring.middleware.not-modified/not-modified-response.
sourceraw docstring

paramsclj

(params & [opts])

Extract query parameters from the request URI and request body and adds a :query-params and :form-params keys to the request, and merges those maps into the request :params map.

This is a wrapper around ring.middleware.params/params-request.

Extract query parameters from the request URI and request body and adds a :query-params and
:form-params keys to the request, and merges those maps into the request :params map.

This is a wrapper around ring.middleware.params/params-request.
sourceraw docstring

resourceclj

(resource root-path)

Allows access to static resources on the classpath.

This is a wrapper around ring.middleware.resource/resource-request.

If succesful, marks the current tracing span as routed, with a route-name of :resource

The response :body may be a java.io.InputStream or a java.io.File depending on the request and the classpath.

Allows access to static resources on the classpath.

This is a wrapper around ring.middleware.resource/resource-request.

If succesful, marks the current tracing span as routed, with a route-name of :resource

The response :body may be a java.io.InputStream or a java.io.File depending on the request and the classpath.
sourceraw docstring

sessionclj

(session)
(session options)

Interceptor for session ring middleware. A session is a simple store of data, associated with a single client, that persists between requests. A cookie (by default "ring-session") is used to connect requests and responses to a session. A store (the default is an in-memory Atom) stores the data between requests.

The request key :session is a map storing the session data, and :session/key store the key uniquely identifying the client session.

Options are documented in ring.middleware.session/wrap-session.

On :enter, uses ring.middleware.session/session-request, which adds a :session key to the request.

On :leave, uses the :session and :session/key response keys to update the store and, if necessary, create a new cookie with the new session key.

It is the application's responsibility to copy the :session and :session/key to the response. When this does not occur, the session will be removed from the store.

Interceptor for session ring middleware. A session is a simple store of data, associated with a single client,
that persists between requests.  A cookie (by default "ring-session") is used to connect requests and responses
to a session.  A store (the default is an in-memory Atom) stores the data between requests.

The request key :session is a map storing the session data, and :session/key store the key uniquely identifying the client session.

Options are documented in ring.middleware.session/wrap-session.

On :enter, uses ring.middleware.session/session-request, which adds a :session key to the request.

On :leave, uses the :session and :session/key response keys to update the store and, if necessary, create a new
cookie with the new session key.

It is the application's responsibility to copy the :session and :session/key to the response. When this does not occur,
the session will be removed from the store.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close