Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Resource m = Resource {
- allowMissingPost :: Webmachine m Bool
- allowedMethods :: Webmachine m [Method]
- contentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
- contentTypesProvided :: Webmachine m [(MediaType, Webmachine m ResponseBody)]
- deleteCompleted :: Webmachine m Bool
- deleteResource :: Webmachine m Bool
- entityTooLarge :: Webmachine m Bool
- forbidden :: Webmachine m Bool
- generateETag :: Webmachine m (Maybe ETag)
- implemented :: Webmachine m Bool
- isAuthorized :: Webmachine m Bool
- isConflict :: Webmachine m Bool
- knownContentType :: Webmachine m Bool
- lastModified :: Webmachine m (Maybe UTCTime)
- languageAvailable :: Webmachine m Bool
- malformedRequest :: Webmachine m Bool
- movedPermanently :: Webmachine m (Maybe ByteString)
- movedTemporarily :: Webmachine m (Maybe ByteString)
- multipleChoices :: Webmachine m Bool
- patchContentTypesAccepted :: Webmachine m [(MediaType, Webmachine m ())]
- previouslyExisted :: Webmachine m Bool
- processPost :: Webmachine m (PostResponse m)
- resourceExists :: Webmachine m Bool
- serviceAvailable :: Webmachine m Bool
- uriTooLong :: Webmachine m Bool
- validContentHeaders :: Webmachine m Bool
- errorResponses :: ErrorResponses m
- data PostResponse m
- = PostCreate [Text]
- | PostCreateRedirect [Text]
- | PostProcess [(MediaType, Webmachine m ())]
- | PostProcessRedirect [(MediaType, Webmachine m ByteString)]
- serverError :: Monad m => Webmachine m a
- defaultResource :: Monad m => Resource m
Documentation
Resource | |
|
data PostResponse m Source #
Used when processing POST requests so as to handle the outcome of the binary decisions between handling a POST as a create request and whether to redirect after the POST is done. Credit for this idea goes to Richard Wallace (purefn) on Webcrank.
For processing the POST, an association list of MediaType
s and Webmachine
actions are required
that correspond to the accepted Content-Type
values that this resource can accept in a request body.
If a Content-Type
header is present but not accounted for, processing will halt with
415 Unsupported Media Type
.
PostCreate [Text] | Treat this request as a PUT. |
PostCreateRedirect [Text] | Treat this request as a PUT, then redirect. |
PostProcess [(MediaType, Webmachine m ())] | Process as a POST, but don't redirect. |
PostProcessRedirect [(MediaType, Webmachine m ByteString)] | Process and redirect. |
serverError :: Monad m => Webmachine m a Source #
A helper function that terminates execution with 500 Internal Server Error
.
defaultResource :: Monad m => Resource m Source #
The default Airship resource, with "sensible" values filled in for each entry. You construct new resources by extending the default resource with your own handlers.