Commit 9e0d009f authored by Bas Lijnse's avatar Bas Lijnse

Updated engine to use appname in HTTP server instructions and use of...

Updated engine to use appname in HTTP server instructions and use of serverPath config value for serving the services.
IMPORTANT: You may need to update your config files.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1138 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 97e970ce
......@@ -11,7 +11,7 @@ import StdMaybe
, rootPassword :: !String // Password for the 'root' superuser (default 'root').
, sessionTime :: !Int // Time (in seconds) before inactive sessions are garbage collected. Default is 3600 (one hour).
, serverPort :: !Int // The TCP port the server runs on. Default is 80.
, serverPath :: !String // The path at which the services are served (default /handlers)
, serverPath :: !String // The path at which the services are served (default /services)
, debug :: !Bool // Run the server in debug mode.
}
......
......@@ -14,7 +14,7 @@ defaultConfig =
, rootPassword = "root"
, sessionTime = 3600
, serverPort = 80
, serverPath = "/handlers"
, serverPath = "/services"
, debug = False
}
......
......@@ -39,7 +39,7 @@ where
// Handler to stop the server nicely
((==) "/stop", handleStopRequest)
// Webservices
,(startsWith "/services", serviceDispatch config flows)
,(startsWith config.serverPath, serviceDispatch config flows)
,(\_ -> True, handleStaticResourceRequest config)
]
//Always add the workflows for administering the itask system
......@@ -47,8 +47,10 @@ where
serviceDispatch config flows req world
# tst = initTSt req config flows world
# (response,tst) = case (split "/" (http_urldecode req.req_path)) of
["","services",format:path]
# reqpath = (http_urldecode req.req_path)
# reqpath = reqpath % (size config.serverPath, size reqpath)
# (response,tst) = case (split "/" reqpath) of
["",format:path]
# html = format == "html"
# json = format == "json"
| html || json
......@@ -66,7 +68,7 @@ where
= (notFoundResponse req, tst)
# tst = flushStore tst
= (response, HTTPServerContinue, finalizeTSt tst)
workflow :: !String !(Task a) -> Workflow | iTask a
workflow path task =
{ Workflow
......
......@@ -8,16 +8,18 @@ import Config
startEngine :: ![Workflow] !*World -> *World
startEngine flows world
# (mbConfig,world) = config world
# world = instructions mbConfig world
# (app,world) = determineAppName world
# world = instructions app mbConfig world
# options = case mbConfig of
Just config = [HTTPServerOptPort config.serverPort, HTTPServerOptDebug config.debug]
Nothing = []
= http_startServer options (engine mbConfig flows) world
where
instructions :: !(Maybe Config) *World -> *World
instructions (Just config=:{serverPort,serverPath,staticPath,clientPath}) world
instructions :: !String !(Maybe Config) *World -> *World
//Normal operation
instructions app (Just config=:{serverPort,serverPath,staticPath,clientPath}) world
# (console,world) = stdio world
# console = fwrites "*** iTasks HTTP server started ***\n\n" console
# console = fwrites ("*** " +++ app +++ " HTTP server started ***\n\n") console
# console = fwrites ("Serving client from directory: " +++ clientPath +++ "\n") console
# console = fwrites ("Serving static content from directory: " +++ staticPath +++ "\n\n") console
# console = fwrites ("You can access the client at: " +++ host +++ "/\n") console
......@@ -26,9 +28,10 @@ where
= world
where
host = if (serverPort == 80) "http://localhost" ("http://localhost:" +++ toString serverPort)
instructions Nothing world
//Setup mode
instructions app Nothing world
# (console,world) = stdio world
# console = fwrites "*** iTasks HTTP server started in setup mode***\n\n" console
# console = fwrites ("*** " +++ app +++ " HTTP server started in setup mode***\n\n") console
# console = fwrites ("Please open http://localhost/ and follow instructions\n") console
# (_,world) = fclose console world
= world
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment