diff options
author | Loïc Hoguin <[email protected]> | 2014-07-06 13:10:35 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-07-06 13:10:35 +0200 |
commit | 078d686a0ac0aed212db97d73bd1e4a9387a4956 (patch) | |
tree | 6bbc6111fdbdfedd3bb351bf3b01c63fac0d7143 /doc/src/manual/cowboy_http_handler.ezdoc | |
parent | 1a71a733c37df70c15ebfd28157b10915cd738d1 (diff) | |
download | cowboy-078d686a0ac0aed212db97d73bd1e4a9387a4956.tar.gz cowboy-078d686a0ac0aed212db97d73bd1e4a9387a4956.tar.bz2 cowboy-078d686a0ac0aed212db97d73bd1e4a9387a4956.zip |
Provide installable man pages
make docs: generate Markdown and man pages in doc/
make install-docs: install man pages to be usable directly
Docs are generated from the ezdoc files in doc/src/.
Diffstat (limited to 'doc/src/manual/cowboy_http_handler.ezdoc')
-rw-r--r-- | doc/src/manual/cowboy_http_handler.ezdoc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_http_handler.ezdoc b/doc/src/manual/cowboy_http_handler.ezdoc new file mode 100644 index 0000000..6776598 --- /dev/null +++ b/doc/src/manual/cowboy_http_handler.ezdoc @@ -0,0 +1,57 @@ +::: cowboy_http_handler + +The `cowboy_http_handler` behaviour defines the interface used +by plain HTTP handlers. + +Unless noted otherwise, the callbacks will be executed sequentially. + +:: Types + +None. + +:: Callbacks + +: init({TransportName, ProtocolName}, Req, Opts) + -> {ok, Req, State} | {shutdown, Req, State} + +Types: + +* TransportName = tcp | ssl | atom() +* ProtocolName = http | atom() +* Req = cowboy_req:req() +* Opts = any() +* State = any() + +Initialize the state for this request. + +The `shutdown` return value can be used to skip the `handle/2` +call entirely. + +: handle(Req, State) -> {ok, Req, State} + +Types: + +* Req = cowboy_req:req() +* State = any() + +Handle the request. + +This callback is where the request is handled and a response +should be sent. If a response is not sent, Cowboy will send +a `204 No Content` response automatically. + +: terminate(Reason, Req, State) -> ok + +Types: + +* Reason = {normal, shutdown} | {error, atom()} +* Req = cowboy_req:req() +* State = any() + +Perform any necessary cleanup of the state. + +This callback should release any resource currently in use, +clear any active timer and reset the process to its original +state, as it might be reused for future requests sent on the +same connection. Typical plain HTTP handlers rarely need to +use it. |