haskoon-0.3.1.1: Web Application Abstraction

Factis.Haskoon.Web

Synopsis

Documentation

class Monad m => Web m whereSource

You may either define webRec or all of webDocumentRoot, webContainerUri, webPathInfo, webMethod, webGetBody, webGetParams, webGetHeaders, webGetCookies, webSetStatus, webSendBSL, webSetHeader, webSetCookie, webUnsetCookie, webLog and webGetRepls, webWithRepls and webFail.

Associated Types

type WebRes m Source

Instances

Web m => Web (SitemapT m) 
(MonadIO m, MonadCGI m) => Web (WebCGI m) 
Web m => Web (WebReaderT r m) 

class (MonadIO m, Web m) => WebIO m Source

Instances

(MonadIO m, Web m) => WebIO (SitemapT m) 
(MonadCGI m, MonadIO m) => WebIO (WebCGI m) 

class FromRq a whereSource

Methods

fromRq :: RqAccess m => m aSource

class ToWebRes a whereSource

Instances

type WebWebRes m = m (WebRes m)Source

data WebRec m Source

Constructors

WebRec 

Fields

web_documentRoot :: m FilePath
 
web_containerUri :: m URI
 
web_requestUri :: m URI
 
web_pathInfo :: m String
 
web_method :: m String
 
web_getBody :: m ByteString
 
web_getParams :: m WebParams
 
web_getHeaders :: m WebHeaders
 
web_getCookies :: m WebCookies
 
web_setStatus :: Int -> Maybe String -> m ()
 
web_sendBSL :: ByteString -> m (WebRes m)
 
web_setHeader :: String -> String -> m ()
 
web_setCookie :: Cookie -> m ()
 
web_unsetCookie :: Cookie -> m ()
 
web_log :: String -> Priority -> String -> m ()
 
web_getRepls :: m [String]
 
web_fail :: forall a. String -> m a
 
web_withRepls :: forall a. [String] -> m a -> m a
 

webOk :: (Web m, ToWebRes a) => a -> m (WebRes m)Source

webNotFound :: Web m => [Char] -> m (WebRes m)Source

webBadRequest :: Web m => [Char] -> m (WebRes m)Source

webRedirect :: Web m => Bool -> String -> m (WebRes m)Source

webWithData :: (Web m, FromRq a) => (a -> m (WebRes m)) -> m (WebRes m)Source

webCheckData :: (Web m, FromRq a) => (a -> m (WebRes m)) -> (String -> m (WebRes m)) -> m (WebRes m)Source

optional :: MonadPlus m => m a -> m (Maybe a)Source

data Cookie

Contains all information about a cookie set by the server.

Constructors

Cookie 

Fields

cookieName :: String

Name of the cookie.

cookieValue :: String

Value of the cookie.

cookieExpires :: Maybe CalendarTime

Expiry date of the cookie. If Nothing, the cookie expires when the browser sessions ends. If the date is in the past, the client should delete the cookie immediately.

cookieDomain :: Maybe String

The domain suffix to which this cookie will be sent.

cookiePath :: Maybe String

The path to which this cookie will be sent.

cookieSecure :: Bool

True if this cookie should only be sent using secure means.

newCookie

Arguments

:: String

Name

-> String

Value

-> Cookie

Cookie

Construct a cookie with only name and value set. This client will expire when the browser sessions ends, will only be sent to the server and path which set it and may be sent using any means.

findCookie

Arguments

:: String

Cookie name

-> String

Semicolon separated list of name-value pairs

-> Maybe String

Cookie value, if found

Get the value of a cookie from a string on the form "cookieName1=cookieValue1;...;cookieName2=cookieValue2". This is the format of the Cookie HTTP header.

deleteCookie

Arguments

:: Cookie

Cookie to delete. The only fields that matter are cookieName, cookieDomain and cookiePath

-> Cookie 

Delete a cookie from the client by setting the cookie expiry date to a date in the past.

showCookie :: Cookie -> String

Show a cookie on the format used as the value of the Set-Cookie header.

readCookies

Arguments

:: String

String to parse

-> [(String, String)]

Cookie name - cookie value pairs

Gets all the cookies from a Cookie: header value