Liking cljdoc? Tell your friends :D

Request Map

The request map is attached to the context-map.adoc before the first interceptor is invoked. The request map describes the incoming HTTP request, including information about the remote endpoint.

Pedestal does not attach metadata to the request map.

When processing, take care to modify the map (e.g., use assoc), rather than constructing a new map entirely. Interceptors may add arbitrary keys to the request map, and the interceptors' functionality may depend on getting stored values back out of the request map.

Pedestal uses an extended version of the {ring-spec}:

KeyAlways Present?TypeRing Spec?Description

:async-supported?

Yes

boolean

No

True if this request supports asynchronous operation

:body

Yes

ServletInputStream

Yes

The body of the request. May be a zero-length stream.

:content-type

No

String

Yes

Content type of the request body [1].

:content-length

No

Long

Yes

Present if sent by client. Content length of the request body.

:character-encoding

No

String

Yes

Present if sent by client. Character encoding applicable to request body.

:headers

Yes

Map of String → String

Yes

Request headers sent by the client. Header names are all converted to lower case.

:path-info

Yes

String

No

Request path, below the context path. Always at least "/", never an empty string. The URI, excluding the query string.

:path-params

No

Map

No

Present after succesful routing, a map from keyword id to string value of path parameters defined by the route.

:protocol

Yes

String

Yes

Name and version of the protocol with which the request was sent.

:query-string

Yes

String

Yes

The part of the request’s URL after the '?' character.

:remote-addr

Yes

String

Yes

IP Address of the client (or the last proxy to forward the request)

:request-method

Yes

Keyword

Yes

The HTTP verb used to make this request, lowercased and in keyword form. Due to verb smuggling, this may change during processing of the request.

:server-name

Yes

String

Yes

Host name of the server to which the request was sent

:server-port

Yes

int

Yes

Port number to which the request was sent

:servlet

Yes

Servlet

No

Servlet instance that the request was provided to.

:servlet-request

Yes

HttpServletRequest

No

Request instance provided to the servlet; the request map consists primarily of data extracted from this object.

:servlet-response

Yes

HttpServletResponse

No

Response instance provided to the servlet.

:scheme

Yes

String

Yes

The name of the scheme used to make this request, for example, http, https, or ftp.

:ssl-client-cert

No

java.security.cert.X509Certificate[]

Yes

Present if sent by client. Array of certificates that identify the client.

:uri

Yes

String

Yes

The part of this request’s URL from the protocol name up to the query string in the first line of the HTTP request

The :servlet, :servlet-request, and :servlet-response will not be present when the created around a connector.adoc. They are provided by the servlet-interceptor.adoc, and so, only available inside a guides:war-deployment.adoc.

Many more keys are added to the request map by the default interceptors, many of the new keys are related to parsing query parameters and the request body; this is described more fully in the parameters reference.


1. This was a required property of earlier versions of the Ring request specification, and is kept for compatibility reasons.

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

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

× close