The json-responses Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The json-responses Reference Manual

This is the json-responses Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:06:06 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

This library provides a standard set of JSON responses for Hunchentoot applications. It's been tested on SBCL, CCL, CLISP, and LispWorks but should work anywhere that Hunchentoot and CL-JSON do. If it doesn't work on your Lisp of choice open an issue and I'll investigate.

Best enjoyed with Quicklisp:

(ql:quickload 'json-responses)

Or, to run the included test suite:

(ql:quickload 'json-responses)
(ql:quickload 'json-responses-test)

One generic function (json-response) can accept :status, :headers, :data, and :error keyword arguments:

(json-response :status +http-ok+
               :headers '(("X-HELLO" . "world"))
               :data "Hello, world!"
               :error "Not applicable here, but for demonstration...")

Which would respond with a 200 status code, an X-HELLO header with the value world, a content-type of application/json, and a JSON body like:

{
    "data": "Hello, world!",
    "error": "Not applicable here, but for demonstration..."
}

All keyword arguments are optional and have sane defaults. If both data and error are omitted then the body is simply null.

The remaining functions can accept :headers, :data, and :error keyword arguments and have status preset to an appropriate value. :data and :headers default to nil, :error defaults to nil for 100, 200, and 300-level responses and a simple error message for 400 and 500-level responses.

The following functions are included:


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 json-responses

Author

Brad Melanson <bradmelanson@icloud.com>

License

MIT

Description

Canned JSON responses for Hunchentoot

Dependencies
Source

json-responses.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 json-responses.asd

Location

/home/quickbuilder/quicklisp/dists/quicklisp/software/json-responses-20151031-hg/json-responses.asd

Systems

json-responses (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 json-responses/package.lisp

Parent

json-responses (system)

Location

package.lisp

Packages

ca.pinecode.json-responses


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 json-responses/json-responses.lisp

Dependency

package.lisp (file)

Parent

json-responses (system)

Location

json-responses.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 ca.pinecode.json-responses

Source

package.lisp (file)

Nickname

json-responses

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: accepted-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: authorization-required-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: bad-gateway-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: bad-request-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: conflict-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: continue-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: created-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: expectation-failed-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: forbidden-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: gateway-timeout-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: gone-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: http-version-not-supported-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: internal-server-error-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: json-response &key STATUS HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: length-required-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: method-not-allowed-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: moved-permanently-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: moved-temporarily-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: multiple-choices-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: no-content-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: non-authoritative-information-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: not-acceptable-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: not-found-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: not-implemented-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: not-modified-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: ok-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: partial-content-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: precondition-failed-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: proxy-authentication-required-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: request-entity-too-large-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: request-timeout-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: request-uri-too-long-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: requested-range-not-satisfiable-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: reset-content-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: see-other-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: service-unavailable-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: switching-protocols-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: temporary-redirect-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: unsupported-media-type-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)

Function: use-proxy-response &key HEADERS ERROR DATA
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: define-json-response NAME STATUS &optional ERROR
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: set-headers-from-alist HEADERS
Package

ca.pinecode.json-responses

Source

json-responses.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   J   L  
Index Entry  Section

F
File, Lisp, json-responses.asd: The json-responses<dot>asd file
File, Lisp, json-responses/json-responses.lisp: The json-responses/json-responses<dot>lisp file
File, Lisp, json-responses/package.lisp: The json-responses/package<dot>lisp file

J
json-responses.asd: The json-responses<dot>asd file
json-responses/json-responses.lisp: The json-responses/json-responses<dot>lisp file
json-responses/package.lisp: The json-responses/package<dot>lisp file

L
Lisp File, json-responses.asd: The json-responses<dot>asd file
Lisp File, json-responses/json-responses.lisp: The json-responses/json-responses<dot>lisp file
Lisp File, json-responses/package.lisp: The json-responses/package<dot>lisp file

Jump to:   F   J   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   A   B   C   D   E   F   G   H   I   J   L   M   N   O   P   R   S   T   U  
Index Entry  Section

A
accepted-response: Exported functions
authorization-required-response: Exported functions

B
bad-gateway-response: Exported functions
bad-request-response: Exported functions

C
conflict-response: Exported functions
continue-response: Exported functions
created-response: Exported functions

D
define-json-response: Internal macros

E
expectation-failed-response: Exported functions

F
forbidden-response: Exported functions
Function, accepted-response: Exported functions
Function, authorization-required-response: Exported functions
Function, bad-gateway-response: Exported functions
Function, bad-request-response: Exported functions
Function, conflict-response: Exported functions
Function, continue-response: Exported functions
Function, created-response: Exported functions
Function, expectation-failed-response: Exported functions
Function, forbidden-response: Exported functions
Function, gateway-timeout-response: Exported functions
Function, gone-response: Exported functions
Function, http-version-not-supported-response: Exported functions
Function, internal-server-error-response: Exported functions
Function, json-response: Exported functions
Function, length-required-response: Exported functions
Function, method-not-allowed-response: Exported functions
Function, moved-permanently-response: Exported functions
Function, moved-temporarily-response: Exported functions
Function, multiple-choices-response: Exported functions
Function, no-content-response: Exported functions
Function, non-authoritative-information-response: Exported functions
Function, not-acceptable-response: Exported functions
Function, not-found-response: Exported functions
Function, not-implemented-response: Exported functions
Function, not-modified-response: Exported functions
Function, ok-response: Exported functions
Function, partial-content-response: Exported functions
Function, precondition-failed-response: Exported functions
Function, proxy-authentication-required-response: Exported functions
Function, request-entity-too-large-response: Exported functions
Function, request-timeout-response: Exported functions
Function, request-uri-too-long-response: Exported functions
Function, requested-range-not-satisfiable-response: Exported functions
Function, reset-content-response: Exported functions
Function, see-other-response: Exported functions
Function, service-unavailable-response: Exported functions
Function, set-headers-from-alist: Internal functions
Function, switching-protocols-response: Exported functions
Function, temporary-redirect-response: Exported functions
Function, unsupported-media-type-response: Exported functions
Function, use-proxy-response: Exported functions

G
gateway-timeout-response: Exported functions
gone-response: Exported functions

H
http-version-not-supported-response: Exported functions

I
internal-server-error-response: Exported functions

J
json-response: Exported functions

L
length-required-response: Exported functions

M
Macro, define-json-response: Internal macros
method-not-allowed-response: Exported functions
moved-permanently-response: Exported functions
moved-temporarily-response: Exported functions
multiple-choices-response: Exported functions

N
no-content-response: Exported functions
non-authoritative-information-response: Exported functions
not-acceptable-response: Exported functions
not-found-response: Exported functions
not-implemented-response: Exported functions
not-modified-response: Exported functions

O
ok-response: Exported functions

P
partial-content-response: Exported functions
precondition-failed-response: Exported functions
proxy-authentication-required-response: Exported functions

R
request-entity-too-large-response: Exported functions
request-timeout-response: Exported functions
request-uri-too-long-response: Exported functions
requested-range-not-satisfiable-response: Exported functions
reset-content-response: Exported functions

S
see-other-response: Exported functions
service-unavailable-response: Exported functions
set-headers-from-alist: Internal functions
switching-protocols-response: Exported functions

T
temporary-redirect-response: Exported functions

U
unsupported-media-type-response: Exported functions
use-proxy-response: Exported functions

Jump to:   A   B   C   D   E   F   G   H   I   J   L   M   N   O   P   R   S   T   U  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   J   P   S  
Index Entry  Section

C
ca.pinecode.json-responses: The ca<dot>pinecode<dot>json-responses package

J
json-responses: The json-responses system

P
Package, ca.pinecode.json-responses: The ca<dot>pinecode<dot>json-responses package

S
System, json-responses: The json-responses system

Jump to:   C   J   P   S