+ output resultStr
+
+
+outputXmlPage' :: XmlTree -> IOSArrow XmlTree XmlTree -> Resource ()
+outputXmlPage' tree toXHTML
+ = outputXmlPage tree [(MIMEType "application" "xhtml+xml" [], toXHTML)]
+
+
+outputXml :: XmlTree -> Resource ()
+outputXml tree
+ = do setContentType (MIMEType "text" "xml" [])
+ [xmlStr] <- liftIO $ runX ( setErrorMsgHandler False fail
+ >>>
+ constA tree
+ >>>
+ writeDocumentToString [ (a_indent , v_1 )
+ , (a_output_encoding, utf8)
+ , (a_no_xml_pi , v_0 ) ]
+ )
+ output xmlStr
+
+
+getUserID :: Environment -> Resource (Maybe String)
+getUserID env
+ = do auth <- getAuthorization
+ case auth of
+ Just (BasicAuthCredential userID password)
+ -> do valid <- isValidPair (envAuthDB env) userID password
+ if valid then
+ return (Just userID)
+ else
+ return Nothing
+ _ -> return Nothing