Improvements of "gf -server" mode and related setup

"gf -server" mode now contains everything needed to run the minibar and
the grammar editor (including example-based grammar writing).

The Setup.hs script installs the required files where gf -server can find them.
These files have been moved to a new directory: src/www.

The separate server program pgf-http is now obsolete.
This commit is contained in:
hallgren
2011-10-12 17:03:54 +00:00
parent 0aba45560d
commit 44d1a5a9f7
51 changed files with 118 additions and 20 deletions

View File

@@ -27,21 +27,19 @@ import qualified ExampleService as ES
import Paths_gf(getDataDir)
import RunHTTP(Options(..),cgiHandler)
-- * Configuraiton
options = Options { documentRoot = "." {-datadir</>"www"-}, port = gfport }
gfport = 41296
-- * HTTP server
server execute1 state0 =
do state <- newMVar M.empty
cache <- PS.newPGFCache
--datadir <- getDataDir
putStrLn $ "Starting server on port "++show gfport
initServer gfport (modifyMVar state . handle state0 cache execute1)
datadir <- getDataDir
let options = Options { documentRoot = datadir</>"www", port = 41296 }
putStrLn $ "Starting HTTP server, open http://localhost:"
++show (port options)++"/ in your web browser."
initServer (port options)
(modifyMVar state . handle options state0 cache execute1)
-- * HTTP request handler
handle state0 cache execute1
handle options state0 cache execute1
rq@(Request method URI{uriPath=upath,uriQuery=q} hdrs body) state =
do let qs = decodeQ $
case method of
@@ -67,6 +65,8 @@ handle state0 cache execute1
where
root = documentRoot options
translatePath rpath = root</>rpath -- hmm, check for ".."
wrapCGI cgi =
do resp <- cgiHandler root (handleErrors . handleCGIErrors $ cgi) rq
return (state,resp)
@@ -191,8 +191,6 @@ escape1 c = [c]
-- * Static content
translatePath path = documentRoot options</>path -- hmm, check for ".."
serveStaticFile path =
do b <- doesDirectoryExist path
let path' = if b then path </> "index.html" else path

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -32,7 +32,7 @@ This page does not work without JavaScript.
<hr>
<div class=modtime><small>
HTML
<!-- hhmts start --> Last modified: Mon Oct 10 17:54:37 CEST 2011 <!-- hhmts end -->
<!-- hhmts start --> Last modified: Mon Oct 10 19:24:05 CEST 2011 <!-- hhmts end -->
</small></div>
<a href="about.html">About</a>
<pre id=debug></pre>
@@ -42,7 +42,7 @@ HTML
<script type="text/javascript" src="gf_abs.js"></script>
<script type="text/javascript" src="example_based.js"></script>
<script type="text/javascript" src="editor.js"></script>
<script type="text/javascript" src="cloud.js"></script>
<script type="text/javascript" src="cloud2.js"></script>
<script type="text/javascript" src="sort.js"></script>
</body>
</html>

View File

@@ -13,12 +13,12 @@
<hr>
<address></address>
<!-- hhmts start --> Last modified: Mon Aug 1 16:24:44 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="localstorage.js"></script>
<script type="text/javascript" src="gf_abs.js"></script>
<script type="text/javascript" src="editor.js"></script>
<script type="text/javascript" src="cloud.js"></script>
<script type="text/javascript" src="cloud2.js"></script>
<script type="text/javascript" src="sort.js"></script>
<script type="text/javascript">
download_from_cloud();

18
src/www/index.html Normal file
View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<!-- This is the start page served by "gf -server" -->
<title>GF web service</title>
<h1>GF web service</h1>
<h2>Available web services</h2>
<ul>
<li><a href="minibar/minibar.html">Minibar</a>
<li><a href="gfse/">GF online editor for simple multilingual grammars</a>
</ul>
<hr>
<a href="http://www.grammaticalframework.org/">Grammatical Framework</a>

View File

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B