Network.HTTP.Lucu.Resource.Tree
Description
Repository of the resources in httpd.
- data ResourceDef = ResourceDef {}
- emptyResource :: ResourceDef
- data ResTree
- type FallbackHandler = [String] -> IO (Maybe ResourceDef)
- mkResTree :: [([String], ResourceDef)] -> ResTree
Documentation
data ResourceDef Source
ResourceDef
is basically a set of
Resource
monads for each HTTP methods.
Constructors
ResourceDef | |
Fields
|
emptyResource :: ResourceDefSource
emptyResource
is a resource definition with no actual
handlers. You can construct a ResourceDef
by selectively
overriding emptyResource
. It is defined as follows:
emptyResource = ResourceDef { resUsesNativeThread = False , resIsGreedy = False , resGet = Nothing , resHead = Nothing , resPost = Nothing , resPut = Nothing , resDelete = Nothing }
ResTree
is an opaque structure which is a map from resource path
to ResourceDef
.
type FallbackHandler = [String] -> IO (Maybe ResourceDef)Source
FallbackHandler
is an extra resource handler for resources which
can't be statically located somewhere in the resource tree. The
Lucu httpd first search for a resource in the tree, and then call
fallback handlers to ask them for a resource. If all of the
handlers returned Nothing
, the httpd responds with 404
Not Found.