mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 17:42:51 -06:00
Bug fixes for gf -server mode and setup
This commit is contained in:
8
Setup.hs
8
Setup.hs
@@ -28,12 +28,12 @@ main = defaultMainWithHooks simpleUserHooks{ preBuild =checkRGLArgs
|
|||||||
}
|
}
|
||||||
where
|
where
|
||||||
gfPostInst args flags pkg lbi =
|
gfPostInst args flags pkg lbi =
|
||||||
do installWeb args flags pkg lbi
|
do installRGL args flags pkg lbi
|
||||||
installRGL args flags pkg lbi
|
installWeb args flags pkg lbi
|
||||||
|
|
||||||
gfPostCopy args flags pkg lbi =
|
gfPostCopy args flags pkg lbi =
|
||||||
do copyWeb args flags pkg lbi
|
do copyRGL args flags pkg lbi
|
||||||
copyRGL args flags pkg lbi
|
copyWeb args flags pkg lbi
|
||||||
|
|
||||||
--------------------------------------------------------
|
--------------------------------------------------------
|
||||||
-- Commands for building the Resource Grammar Library
|
-- Commands for building the Resource Grammar Library
|
||||||
|
|||||||
@@ -25,21 +25,22 @@ import GF.Infra.UseIO(readBinaryFile,writeBinaryFile)
|
|||||||
import qualified PGFService as PS
|
import qualified PGFService as PS
|
||||||
import qualified ExampleService as ES
|
import qualified ExampleService as ES
|
||||||
import Paths_gf(getDataDir)
|
import Paths_gf(getDataDir)
|
||||||
import RunHTTP(Options(..),cgiHandler)
|
import RunHTTP(cgiHandler)
|
||||||
|
|
||||||
-- * HTTP server
|
-- * HTTP server
|
||||||
server execute1 state0 =
|
server execute1 state0 =
|
||||||
do state <- newMVar M.empty
|
do state <- newMVar M.empty
|
||||||
cache <- PS.newPGFCache
|
cache <- PS.newPGFCache
|
||||||
datadir <- getDataDir
|
datadir <- getDataDir
|
||||||
let options = Options { documentRoot = datadir</>"www", port = 41296 }
|
let root = datadir</>"www"
|
||||||
|
port = 41296
|
||||||
putStrLn $ "Starting HTTP server, open http://localhost:"
|
putStrLn $ "Starting HTTP server, open http://localhost:"
|
||||||
++show (port options)++"/ in your web browser."
|
++show port++"/ in your web browser."
|
||||||
initServer (port options)
|
setCurrentDirectory root
|
||||||
(modifyMVar state . handle options state0 cache execute1)
|
initServer port (modifyMVar state . handle state0 cache execute1)
|
||||||
|
|
||||||
-- * HTTP request handler
|
-- * HTTP request handler
|
||||||
handle options state0 cache execute1
|
handle state0 cache execute1
|
||||||
rq@(Request method URI{uriPath=upath,uriQuery=q} hdrs body) state =
|
rq@(Request method URI{uriPath=upath,uriQuery=q} hdrs body) state =
|
||||||
do let qs = decodeQ $
|
do let qs = decodeQ $
|
||||||
case method of
|
case method of
|
||||||
@@ -63,7 +64,7 @@ handle options state0 cache execute1
|
|||||||
where path = translatePath rpath
|
where path = translatePath rpath
|
||||||
_ -> return (state,resp400 upath)
|
_ -> return (state,resp400 upath)
|
||||||
where
|
where
|
||||||
root = documentRoot options
|
root = "."
|
||||||
|
|
||||||
translatePath rpath = root</>rpath -- hmm, check for ".."
|
translatePath rpath = root</>rpath -- hmm, check for ".."
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ save: save.hs
|
|||||||
|
|
||||||
install::
|
install::
|
||||||
@make save
|
@make save
|
||||||
rsync -avz --exclude .DS_Store P *.html *.css *.js ../../runtime/javascript/minibar/support.js *.cgi *.manifest save www.grammaticalframework.org:/usr/local/www/GF/demos/gfse
|
rsync -avz --exclude .DS_Store P *.html *.css *.js *.cgi *.manifest save www.grammaticalframework.org:/usr/local/www/GF/demos/gfse
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ HTML
|
|||||||
<a href="about.html">About</a>
|
<a href="about.html">About</a>
|
||||||
<pre id=debug></pre>
|
<pre id=debug></pre>
|
||||||
<script type="text/javascript" src="config.js"></script> <!-- optional -->
|
<script type="text/javascript" src="config.js"></script> <!-- optional -->
|
||||||
<script type="text/javascript" src="support.js"></script>
|
<script type="text/javascript" src="../minibar/support.js"></script>
|
||||||
<script type="text/javascript" src="localstorage.js"></script>
|
<script type="text/javascript" src="localstorage.js"></script>
|
||||||
<script type="text/javascript" src="gf_abs.js"></script>
|
<script type="text/javascript" src="gf_abs.js"></script>
|
||||||
<script type="text/javascript" src="example_based.js"></script>
|
<script type="text/javascript" src="example_based.js"></script>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<address></address>
|
<address></address>
|
||||||
<!-- hhmts start --> Last modified: Mon Oct 10 20:29:01 CEST 2011 <!-- hhmts end -->
|
<!-- hhmts start --> Last modified: Mon Oct 10 20:29:01 CEST 2011 <!-- hhmts end -->
|
||||||
<script type="text/javascript" src="support.js"></script>
|
<script type="text/javascript" src="../minibar/support.js"></script>
|
||||||
<script type="text/javascript" src="localstorage.js"></script>
|
<script type="text/javascript" src="localstorage.js"></script>
|
||||||
<script type="text/javascript" src="gf_abs.js"></script>
|
<script type="text/javascript" src="gf_abs.js"></script>
|
||||||
<script type="text/javascript" src="editor.js"></script>
|
<script type="text/javascript" src="editor.js"></script>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<title>GF web service</title>
|
<title>GF web service</title>
|
||||||
<h1>GF web service</h1>
|
<h1>GF web service</h1>
|
||||||
|
|
||||||
<h2>Available web services</h2>
|
<h2>Available web applications</h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="minibar/minibar.html">Minibar</a>
|
<li><a href="minibar/minibar.html">Minibar</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user