Ring response implementation.
Ring response implementation.
(handle-response response exchange)Handles ring response map.
:headers to response headers.:status if presented.:session.String The body is sent directly to the client in response
charset.ISeq Each element of the seq is sent to the client as a
string in response charset.File The contents of the referenced file is sent to the
client.InputStream The contents of the stream is sent to the client. When
the stream is exhausted, the stream is closed.ByteBuffer Similar to String but response charset is not used.HttpHandler The Undertow handler in the :body is handled, this
allows to initiate processing like websocket handshake.ResponseBody protocol.Handles [ring response map][1].
- Puts `:headers` to response headers.
- Sets `:status` if presented.
- Updates ring session data by `:session`.
- Sends response body.
+ Standard ring response body types:
- `String` The body is sent directly to the client in response
charset.
- `ISeq` Each element of the seq is sent to the client as a
string in response charset.
- `File` The contents of the referenced file is sent to the
client.
- `InputStream` The contents of the stream is sent to the client. When
the stream is exhausted, the stream is closed.
+ Additional body types:
- `ByteBuffer` Similar to `String` but response charset is not used.
- `HttpHandler` The Undertow handler in the `:body` is handled, this
allows to initiate processing like websocket handshake.
+ Custom body types can be added by extending [[ResponseBody]] protocol.
[1]: https://github.com/ring-clojure/ring/wiki/Concepts#responses
(response-charset-fn e)Returns functions without arguments which returns response Charset.
Returns functions without arguments which returns response `Charset`.
(send-response-fn body)Returns function (fn [exchange]) which puts body in server response.
Returns function `(fn [exchange])` which puts `body` in server response.
(with-output-stream send-response)Returns function (fn [exchange]) which invokes
(send-response output-stream charset-fn) dispatching to worker thread if
necessary.
Returns function `(fn [exchange])` which invokes `(send-response output-stream charset-fn)` dispatching to worker thread if necessary.
(with-response-sender send-response)Returns function (fn [exchange]) which invokes
(send-response response-sender charset-fn).
Returns function `(fn [exchange])` which invokes `(send-response response-sender charset-fn)`.
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 |