urlRenderOverride

This commit is contained in:
Michael Snoyman 2010-05-04 22:11:25 +03:00
parent ed56c87317
commit 8d58cc8051
2 changed files with 10 additions and 1 deletions

View File

@ -122,7 +122,10 @@ toWaiApp' y resource session' env = do
types = httpAccept env
pathSegments = filter (not . null) $ cleanupSegments resource
eurl = quasiParse site pathSegments
render = fullRender (approot y) site
render u =
case urlRenderOverride y u of
Nothing -> fullRender (approot y) site u
Just s -> s
rr <- parseWaiRequest env session'
onRequest y rr
let ya = case eurl of

View File

@ -78,6 +78,12 @@ class YesodSite a => Yesod a where
onRequest :: a -> Request -> IO ()
onRequest _ _ = return ()
-- | Override the rendering function for a particular URL. One use case for
-- this is to offload static hosting to a different domain name to avoid
-- sending cookies.
urlRenderOverride :: a -> Routes a -> Maybe String
urlRenderOverride _ _ = Nothing
-- | Apply the default layout ('defaultLayout') to the given title and body.
applyLayout :: Yesod master
=> String -- ^ title