aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_handler.ezdoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-01-14 13:35:25 +0100
committerLoïc Hoguin <[email protected]>2016-01-14 13:37:20 +0100
commit4023e7f4e429179fd9c2cce4487c33646c6bd327 (patch)
tree3c4e26d1b5592958e35297c82ad3069bdb642594 /doc/src/manual/cowboy_handler.ezdoc
parentb7d666cfc746f55b0a72ef8d37f703885099daf7 (diff)
downloadcowboy-4023e7f4e429179fd9c2cce4487c33646c6bd327.tar.gz
cowboy-4023e7f4e429179fd9c2cce4487c33646c6bd327.tar.bz2
cowboy-4023e7f4e429179fd9c2cce4487c33646c6bd327.zip
Convert the documentation to Asciidoc
A few small revisions were made, and Erlang.mk has been updated.
Diffstat (limited to 'doc/src/manual/cowboy_handler.ezdoc')
-rw-r--r--doc/src/manual/cowboy_handler.ezdoc106
1 files changed, 0 insertions, 106 deletions
diff --git a/doc/src/manual/cowboy_handler.ezdoc b/doc/src/manual/cowboy_handler.ezdoc
deleted file mode 100644
index 81615c2..0000000
--- a/doc/src/manual/cowboy_handler.ezdoc
+++ /dev/null
@@ -1,106 +0,0 @@
-::: cowboy_handler
-
-The `cowboy_handler` middleware executes the handler passed
-through the environment values `handler` and `handler_opts`,
-and adds the result of this execution to the environment as
-the value `result`, indicating that the request has been
-handled and received a response.
-
-Environment input:
-
-* handler = module()
-* handler_opts = any()
-
-Environment output:
-
-* result = ok
-
-This module also defines the `cowboy_handler` behaviour that
-defines the basic interface for handlers. All Cowboy handlers
-implement at least the `init/2` callback, and may implement
-the `terminate/3` callback optionally.
-
-:: Terminate reasons
-
-The following values may be received as the terminate reason
-in the optional `terminate/3` callback. Different handler types
-may define additional terminate reasons.
-
-: normal
-
-The connection was closed normally.
-
-: {crash, Class, Reason}
-
-A crash occurred in the handler. `Class` and `Reason` can be
-used to obtain more information about the crash. The function
-`erlang:get_stacktrace/0` can also be called to obtain the
-stacktrace of the process when the crash occurred.
-
-:: Callbacks
-
-: init(Req, Opts)
- -> {ok, Req, State}
- | {Module, Req, State}
- | {Module, Req, State, hibernate}
- | {Module, Req, State, Timeout}
- | {Module, Req, State, Timeout, hibernate}
-
-Types:
-
-* Req = cowboy_req:req()
-* Opts = any()
-* State = any()
-* Module = module()
-* Timeout = timeout()
-
-Process the request.
-
-This function can be used to switch to an alternate handler
-type by returning the name of the module to be used, along
-with a few options.
-
-For basic handlers this is the function where the response
-should be sent. If no response is sent, Cowboy will ensure
-that a `204 No Content` response is sent.
-
-A crash in this callback will result in `terminate/3` being
-called if it is defined, with the `State` argument set to
-the value of `Opts` originally given to the `init/2` callback.
-
-: terminate(Reason, Req, State) -> ok
-
-Types:
-
-* Reason = any()
-* 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.
-
-A crash in this callback or an invalid return value will
-result in the closing of the connection and the termination
-of the process.
-
-:: Exports
-
-: terminate(Reason, Req, State, Handler) -> ok
-
-Types:
-
-* Reason = any()
-* Req = cowboy_req:req()
-* State = any()
-* Handler = module()
-
-Call the optional `terminate/3` callback if it exists.
-
-This function should always be called at the end of the execution
-of a handler, to give it a chance to clean up or perform
-miscellaneous operations.