Skip to content

Commit bd13268

Browse files
committed
Wordsmithing and markup changes for nng_http_handler_set_tree.
1 parent 1dd217d commit bd13268

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

docs/man/nng_http_handler_set_tree.3http.adoc

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
= nng_http_handler_set_tree(3http)
2-
//
3-
// Copyright 2018 Staysail Systems, Inc. <[email protected]>
2+
3+
// Copyright 2020 Staysail Systems, Inc. <[email protected]>
44
// Copyright 2018 Capitar IT Group BV <[email protected]>
55
// Copyright 2020 Dirac Research <[email protected]>
66
//
77
// This document is supplied under the terms of the MIT License, a
88
// copy of which should be located in the distribution where this
99
// file was obtained (LICENSE.txt). A copy of the license may also be
1010
// found online at https://opensource.org/licenses/MIT.
11-
//
1211

1312
== NAME
1413

1514
nng_http_handler_set_tree - set HTTP handler to match trees
1615

1716
== SYNOPSIS
1817

19-
[source, c]
18+
[source,c]
2019
----
2120
#include <nng/nng.h>
2221
#include <nng/supplemental/http/http.h>
@@ -28,18 +27,27 @@ int nng_http_handler_set_tree_exclusive(nng_http_handler *handler);
2827

2928
== DESCRIPTION
3029

31-
The `nng_http_handler_set_tree()` function causes the _handler_ to be
32-
matched if the Request URI sent by the client is a logical child of
33-
the path for _handler_.
30+
The `nng_http_handler_set_tree()` function causes the _handler_ to be matched if the request URI sent
31+
by the client is a logical child of the path for _handler_, and no more specific
32+
_handler_ has been registered.
3433

3534
The `nng_http_handler_set_tree_exclusive()` function is similar to `nng_http_server_set_tree()`
36-
with the distinction that the _handler_ will be considered to *exclusively* handling its
37-
Request URI. Other handlers will be tested against _handler_ when being added to a server,
38-
possibly resulting in a URI conflict error.
35+
with the distinction that the _handler_ will be considered to *exclusively* handle its request URI.
36+
Unlike `nng_http_server_set_tree()`, it will not be possible to register additional
37+
handlers in logical subdirectories of _handler_.
38+
39+
This is useful in cases when the handler would like to examine the entire path
40+
and possibly behave differently; for example a REST API that uses the rest of
41+
the path to pass additional parameters.
3942

4043
TIP: These methods are useful when constructing API handlers where a single
4144
service address (path) supports dynamically generated children.
4245

46+
TIP: The non-exclusive form is also useful for providing a default handler to be
47+
generated when a more specific child does not exist.
48+
This can provide a better experience for users than the standard 404 error
49+
handling.
50+
4351
== RETURN VALUES
4452

4553
This function returns 0 on success, and non-zero otherwise.

0 commit comments

Comments
 (0)