Network.HTTP.Lucu.Resource.Tree
Description
Repository of the resources in httpd.
- data ResourceDef = ResourceDef {}
- data ResTree
- type FallbackHandler = [String] -> IO (Maybe ResourceDef)
- mkResTree :: [([String], ResourceDef)] -> ResTree
- findResource :: ResTree -> [FallbackHandler] -> URI -> IO (Maybe ([String], ResourceDef))
- runResource :: ResourceDef -> Interaction -> IO ThreadId
Documentation
data ResourceDef Source
ResourceDef is basically a set of
Resource monads for each HTTP methods.
Constructors
| ResourceDef | |
Fields
| |
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.
mkResTree :: [([String], ResourceDef)] -> ResTreeSource
findResource :: ResTree -> [FallbackHandler] -> URI -> IO (Maybe ([String], ResourceDef))Source
runResource :: ResourceDef -> Interaction -> IO ThreadIdSource