(* * Copyright (C) 2003: * Stefano Zacchiroli * for the HELM Team http://helm.cs.unibo.it/ * * This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * * HELM is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HELM; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, * http://helm.cs.unibo.it/ *) open Printf;; exception Uwobo_failure of string;; let supported_properties = [ "cdata-section-elements"; "doctype-public"; "doctype-system"; "encoding"; "indent"; "media-type"; "method"; "omit-xml-declaration"; "standalone"; "version" ] let is_supported_property name = List.mem name supported_properties let version = "0.2.0" ;; let usage_string = sprintf " UWOBO's help message

UWOBO (version: %s)

Information

Version: %s

Usage

Usage: http://hostname:uwoboport/command

Available commands:

help
display this help message

add?bind=key,uri[&bind=key,uri[&...]]
load a new stylesheet, specified by uri, and bind it to key key

remove[?keys=key1,key2,...]
unload stylesheets specified by key1, key2, ... or all stylesheets if no key was given

reload[?keys=key1,key2,...]
reload stylesheets specified by key1, key2, ... or all stylesheets if no key was given

list
return a list of loaded stylesheets

apply?xmluri=uri&keys=key1,key2,...[¶m.name=value[¶m.name=value[&...]]][¶m.key.name=value[¶m.key.name=value[&...]]][&prop.name[=value][&prop.name[=value][&...]]]
apply a chain of stylesheets, specified by key1, key2, ..., to an input document, specified by uri.
Additional parameters can be set for each stylesheet application: global parameters (i.e. parameters passed to all stylesheets) are set using param.name=value syntax, per stylesheet parameters are set using param.key.name=value where key is the key of a loaded stylesheet.
Properties of the final chain output can be set too: valueless properties can be set using prop.name syntax, others can be set using prop.name=value syntax.
Current supported properties are: %s.

" version version (String.concat ", " supported_properties) (* supported properties *) ;; let pp_error = sprintf "

Error: %s

";; let return_error msg outchan = Http_daemon.respond ~body:(pp_error msg) outchan;; let bad_request body outchan = Http_daemon.respond_error ~code:400 ~body outchan ;;