Commit 3bada9349f578d1a39a4e634d0d564f175aeef84
1 parent
bb25ec02
add minimal web site as example with calexium_lib
Showing
6 changed files
with
425 additions
and
73 deletions
Show diff stats
| 1 | + | ||
| 2 | +Microsoft Visual Studio Solution File, Format Version 9.00 | ||
| 3 | +# Visual Studio 2005 | ||
| 4 | +# SharpDevelop 1.0.12.108 | ||
| 5 | +Project("{B6712916-30DE-4a3e-A54C-2A79AC984AEE}") = "minimal_web_site", "minimal_web_site.aproj", "{F2C65267-0D20-4964-A5D8-602BD42C01A4}" | ||
| 6 | +EndProject | ||
| 7 | +Global | ||
| 8 | + GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| 9 | + Debug|Any CPU = Debug|Any CPU | ||
| 10 | + Release|Any CPU = Release|Any CPU | ||
| 11 | + EndGlobalSection | ||
| 12 | + GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| 13 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 14 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 15 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 16 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 17 | + EndGlobalSection | ||
| 18 | +EndGlobal |
| 1 | + | ||
| 2 | + | ||
| 3 | + *Project* The Anubis Project | ||
| 4 | + | ||
| 5 | + *Title* A minimal web site. | ||
| 6 | + | ||
| 7 | + *Copyright* Copyright © Calexium www.calexium.com. | ||
| 8 | + | ||
| 9 | + *Released* | ||
| 10 | + | ||
| 11 | + *Author* David RENÉ | ||
| 12 | + | ||
| 13 | + *Overview* | ||
| 14 | + | ||
| 15 | + This file is just an example which may help to start making a web site with | ||
| 16 | + Anubis Calexium Library | ||
| 17 | + It was based on the example for making a minimal web site made by Alain Prouté and located | ||
| 18 | + in examples/network folder in standard library example | ||
| 19 | + | ||
| 20 | + This example is absolutely minimalist and manage only page. | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +read tools/basis.anubis // required for 'make_directory' and . | ||
| 24 | +read system/convert.anubis | ||
| 25 | +read web/CXM_common.anubis // required for type 'Web_arg' | ||
| 26 | +read web/CXM_multihost_http_server.anubis // required for type 'HTTP_Info' | ||
| 27 | +read web/CXM_making_a_web_site.anubis | ||
| 28 | +read web/mime.anubis // required for list of known MIME types | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + *** Server directory. | ||
| 34 | + | ||
| 35 | + A directory for putting files for all web sites. There will be one subdirectory per web | ||
| 36 | + site. | ||
| 37 | + | ||
| 38 | +define String web_sites_directory = my_anubis_directory+"/web_sites". | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + *** Example site 1. | ||
| 42 | + | ||
| 43 | + Computing the pages of site 1. There is just one page. The type '$State' (see | ||
| 44 | + 'web/CXM_making_a_web_site.anubis') has been chosen as 'One'. If this type were more | ||
| 45 | + elaborate, the function 'compute_page_1' could compute several different pages (for | ||
| 46 | + example, one per alternative of this type). Anyway, there is only one such function for | ||
| 47 | + each web site. | ||
| 48 | + | ||
| 49 | +define HTTP_Answer | ||
| 50 | + compute_page_1 | ||
| 51 | + ( | ||
| 52 | + One state | ||
| 53 | + )= | ||
| 54 | + html_page | ||
| 55 | + ( | ||
| 56 | + "Example Site 1", // title of web site | ||
| 57 | + [], // list of 'META' tags (empty for this site) | ||
| 58 | + body // body of page | ||
| 59 | + ( | ||
| 60 | + // list of body options | ||
| 61 | + [ | ||
| 62 | + background_color(rgb(255,200,200)) | ||
| 63 | + // add more body options here | ||
| 64 | + ], | ||
| 65 | + | ||
| 66 | + // content of page | ||
| 67 | + center(text([size(14)],"This is the 'Example 1' web site.")) | ||
| 68 | + ) | ||
| 69 | + ) | ||
| 70 | +. | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + | ||
| 74 | + Making the description of web site 1. In this description, several elements are the | ||
| 75 | + bare minimum. There is no action at all, no data base, almost nothing. See | ||
| 76 | + 'web/making_a_web_site.anubis' for the declaration of the function | ||
| 77 | + 'make_web_site_description'. | ||
| 78 | + | ||
| 79 | +define Web_Site | ||
| 80 | + example_site_1 | ||
| 81 | + = | ||
| 82 | + // make the directory for web site 1 | ||
| 83 | + // (subdirectories of it will be created automatically by the HTTP server) | ||
| 84 | + forget((String)make_directory(web_sites_directory+"/example_site_1")); | ||
| 85 | + | ||
| 86 | + // make a list of all possible 'host names' for web site 1: | ||
| 87 | + with addresses = (List(String)) | ||
| 88 | + [ | ||
| 89 | + "example-site-1", | ||
| 90 | + "127.0.0.1", | ||
| 91 | + "192.168.0.1" | ||
| 92 | + // add more adresses here | ||
| 93 | + ], | ||
| 94 | + | ||
| 95 | + // now make the description of the web site | ||
| 96 | + make_web_site_description( | ||
| 97 | + | ||
| 98 | + //this is the unique ID of the web site. This ID will be use for prepend the cookies | ||
| 99 | + //names belonging to that web site | ||
| 100 | + "example", | ||
| 101 | + | ||
| 102 | + // the list of addresses defined above | ||
| 103 | + addresses, | ||
| 104 | + | ||
| 105 | + // directory for the files of web site 1 | ||
| 106 | + web_sites_directory+"/example_site_1", | ||
| 107 | + | ||
| 108 | + // directory for the states of that web_site | ||
| 109 | + web_sites_directory+"/example_site_1/states", | ||
| 110 | + | ||
| 111 | + // initializing function | ||
| 112 | + (One u) |-> u, // nothing to initialize for web site 1 | ||
| 113 | + | ||
| 114 | + // the function producing the initial state | ||
| 115 | + (HTTP_Info info, | ||
| 116 | + List(Web_arg) lwa, | ||
| 117 | + Bool is_https) |-> unique, // there is ony one possible state for web site 1 | ||
| 118 | + | ||
| 119 | + // the function for handling expired tickets | ||
| 120 | + // (tickets are kept on the server's disk and represent states. They are used for | ||
| 121 | + // passing session informations from pages to pages. See | ||
| 122 | + // 'web/CXM_making_a_web_site.anubis' for detailed explanations.) | ||
| 123 | + (One expired, | ||
| 124 | + Maybe(String) mb_action_name, | ||
| 125 | + HTTP_Info info, | ||
| 126 | + List(Web_arg) lwa, | ||
| 127 | + Bool is_https) |-> unique, // keep the same state | ||
| 128 | + | ||
| 129 | + // the function for handling lost tickets | ||
| 130 | + (Maybe(String) mb_action_name, | ||
| 131 | + HTTP_Info info, | ||
| 132 | + List(Web_arg) lwa, | ||
| 133 | + Bool is_https) |-> unique, // restart with default state | ||
| 134 | + | ||
| 135 | + // list of all actions | ||
| 136 | + [ ], // no action for web site 1 | ||
| 137 | + | ||
| 138 | + // the function for computing the pages of web site 1 (it is defined above) | ||
| 139 | + compute_page_1, | ||
| 140 | + | ||
| 141 | + // the function for producing additional HTTP headers | ||
| 142 | + (One u) |-> [], | ||
| 143 | + | ||
| 144 | + // timeout for tickets (in seconds) | ||
| 145 | + 3600, // does'nt matter since only one state | ||
| 146 | + | ||
| 147 | + // list of redirections (one for each address) | ||
| 148 | + // (see 'web/CXM_common.anubis' for the type 'Redirection') | ||
| 149 | + redirection_list(map((String address) |-> redirect("/",address,"/site1.awp"), addresses)), | ||
| 150 | + | ||
| 151 | + // character encoding for web site 1 | ||
| 152 | + "UTF-8", | ||
| 153 | + | ||
| 154 | + // list of URI extensions producing a console/journal message | ||
| 155 | + [ | ||
| 156 | + ".awp", // pages computed by this program | ||
| 157 | + ".jpg", // images, etc... | ||
| 158 | + ".gif", | ||
| 159 | + ".png" | ||
| 160 | + // add more extensions here (they must be known; see 'web/mime.anubis') | ||
| 161 | + ], | ||
| 162 | + | ||
| 163 | + // list of HTTP headers which are traced in the console/journal messages | ||
| 164 | + [ | ||
| 165 | + "host", | ||
| 166 | + "user-agent" | ||
| 167 | + // add more HTTP headers here | ||
| 168 | + ], | ||
| 169 | + | ||
| 170 | + // secret string (used by 'private download') | ||
| 171 | + "HUD76GRD56FD7GFDS4RT", // for a real site, please choose another one | ||
| 172 | + // it must remain secret | ||
| 173 | + | ||
| 174 | + // list of known MIME types (taken from 'web/mime.anubis') | ||
| 175 | + known_mime_types, | ||
| 176 | + | ||
| 177 | + // action to be performed before a file is sent | ||
| 178 | + // (for example, this may be used for counting downloads) | ||
| 179 | + (String action_name, | ||
| 180 | + List(Web_arg) lwa) |-> unique // no action at all | ||
| 181 | + ) | ||
| 182 | +. | ||
| 183 | + | ||
| 184 | + | ||
| 185 | + | ||
| 186 | + | ||
| 187 | + *** Example site 2. | ||
| 188 | + | ||
| 189 | + Imagine another web site here... | ||
| 190 | + | ||
| 191 | + | ||
| 192 | + | ||
| 193 | + | ||
| 194 | + | ||
| 195 | + *** Starting all our web sites together. | ||
| 196 | + | ||
| 197 | +global define One | ||
| 198 | + minimal_web_site | ||
| 199 | + ( | ||
| 200 | + List(String) args | ||
| 201 | + ) = | ||
| 202 | + // make the directory for all web sites (if needed) | ||
| 203 | + forget((String) make_directory(web_sites_directory)); | ||
| 204 | + | ||
| 205 | + with http_port = (Word32)8000, | ||
| 206 | + https_port = (Word32)4430, | ||
| 207 | + // create a variable for handling the shutdown of our web sites | ||
| 208 | + with shutdown_required = var(false), | ||
| 209 | + with is_shutdown = (One u) |-> *shutdown_required, | ||
| 210 | + | ||
| 211 | + // start all web sites | ||
| 212 | + if start_web_sites( | ||
| 213 | + 0, // listen on all IP addresses | ||
| 214 | + http_port, // port for HTTP | ||
| 215 | + https_port, // port for HTTPS | ||
| 216 | + "www.georges.example.com", // common name of SSL certificate | ||
| 217 | + [ | ||
| 218 | + example_site_1 | ||
| 219 | + // add other web sites here | ||
| 220 | + ], | ||
| 221 | + is_shutdown) is | ||
| 222 | + { | ||
| 223 | + cannot_bind_to_port(n) then println("Cannot bind to port: "+n), | ||
| 224 | + cannot_bind_to_port(n,m) then println("Cannot bind to ports: "+n+", "+m), | ||
| 225 | + ok(s1,s2) then println("Servers started on ports "+http_port+" (HTTP) and "+https_port+" (HTTPS).") | ||
| 226 | + } | ||
| 227 | +. | ||
| 228 | + | ||
| 229 | + | ||
| 230 | + |
| 1 | +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 2 | + <PropertyGroup> | ||
| 3 | + <ProjectGuid>{F2C65267-0D20-4964-A5D8-602BD42C01A4}</ProjectGuid> | ||
| 4 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 5 | + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| 6 | + <OutputType>Exe</OutputType> | ||
| 7 | + <RootNamespace>minimal_web_site</RootNamespace> | ||
| 8 | + <AssemblyName>minimal_web_site</AssemblyName> | ||
| 9 | + <StartupObject>examples\minimal_web_site.anubis</StartupObject> | ||
| 10 | + <IncludePaths>./</IncludePaths> | ||
| 11 | + </PropertyGroup> | ||
| 12 | + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
| 13 | + <OutputPath>bin\Debug\</OutputPath> | ||
| 14 | + <DebugSymbols>True</DebugSymbols> | ||
| 15 | + <DebugType>Full</DebugType> | ||
| 16 | + <Optimize>False</Optimize> | ||
| 17 | + </PropertyGroup> | ||
| 18 | + <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
| 19 | + <OutputPath>bin\Release\</OutputPath> | ||
| 20 | + <DebugSymbols>False</DebugSymbols> | ||
| 21 | + <DebugType>None</DebugType> | ||
| 22 | + <Optimize>True</Optimize> | ||
| 23 | + </PropertyGroup> | ||
| 24 | + <Import Project="$(AnubisBinPath)\Anubis.Build.targets" /> | ||
| 25 | + <ItemGroup> | ||
| 26 | + <Compile Include="examples\minimal_web_site.anubis" /> | ||
| 27 | + <Compile Include="web\counter.anubis" /> | ||
| 28 | + <Compile Include="web\CXM_common.anubis" /> | ||
| 29 | + <Compile Include="web\CXM_cookies.anubis" /> | ||
| 30 | + <Compile Include="web\CXM_dojo.anubis" /> | ||
| 31 | + <Compile Include="web\CXM_dropzone.anubis" /> | ||
| 32 | + <Compile Include="web\CXM_form.anubis" /> | ||
| 33 | + <Compile Include="web\CXM_generic_form.anubis" /> | ||
| 34 | + <Compile Include="web\CXM_generic_login.anubis" /> | ||
| 35 | + <Compile Include="web\CXM_generic_table.anubis" /> | ||
| 36 | + <Compile Include="web\CXM_html_tooltip.anubis" /> | ||
| 37 | + <Compile Include="web\CXM_https_get.anubis" /> | ||
| 38 | + <Compile Include="web\CXM_http_get.anubis" /> | ||
| 39 | + <Compile Include="web\CXM_http_get_common.anubis" /> | ||
| 40 | + <Compile Include="web\CXM_jquery.anubis" /> | ||
| 41 | + <Compile Include="web\CXM_json.anubis" /> | ||
| 42 | + <Compile Include="web\CXM_making_a_web_site.anubis" /> | ||
| 43 | + <Compile Include="web\CXM_mime.anubis" /> | ||
| 44 | + <Compile Include="web\CXM_multihost_http_server.anubis" /> | ||
| 45 | + <Compile Include="web\CXM_style_tools.anubis" /> | ||
| 46 | + <Compile Include="web\CXM_urllib.anubis" /> | ||
| 47 | + <Compile Include="web\CXM_web_arg_encode.anubis" /> | ||
| 48 | + <Compile Include="web\CXM_web_arg_utils.anubis" /> | ||
| 49 | + <Compile Include="web\CXM_web_dump.anubis" /> | ||
| 50 | + <Compile Include="web\CXM_widgets.anubis" /> | ||
| 51 | + <Compile Include="web\CXM_xml_rpc.anubis" /> | ||
| 52 | + <Compile Include="web\CXM_xml_rpc_parser.anubis" /> | ||
| 53 | + <Compile Include="web\CXM_xml_rpc_types.anubis" /> | ||
| 54 | + <Compile Include="web\jQuery\CXM_jquery_animate.anubis" /> | ||
| 55 | + <Compile Include="web\jQuery\CXM_jquery_button.anubis" /> | ||
| 56 | + <Compile Include="web\jQuery\CXM_jquery_datatable.anubis" /> | ||
| 57 | + <Compile Include="web\jQuery\CXM_jquery_datatable_plugins.anubis" /> | ||
| 58 | + <Compile Include="web\jQuery\CXM_jquery_datatable_server_side.anubis" /> | ||
| 59 | + <Compile Include="web\jQuery\CXM_jquery_datatable_translation.anubis" /> | ||
| 60 | + <Compile Include="web\jQuery\CXM_jquery_datatable_types.anubis" /> | ||
| 61 | + <Compile Include="web\jQuery\CXM_jquery_dialog.anubis" /> | ||
| 62 | + <Compile Include="web\jQuery\CXM_jquery_easing.anubis" /> | ||
| 63 | + <Compile Include="web\jQuery\CXM_jquery_eudock.anubis" /> | ||
| 64 | + <Compile Include="web\jQuery\CXM_jquery_eudock_types.anubis" /> | ||
| 65 | + <Compile Include="web\jQuery\CXM_jquery_icons.anubis" /> | ||
| 66 | + <Compile Include="web\jQuery\CXM_jquery_jqplot.anubis" /> | ||
| 67 | + <Compile Include="web\jQuery\CXM_jquery_tabs.anubis" /> | ||
| 68 | + <Compile Include="web\jQuery\CXM_jquery_tiptip.anubis" /> | ||
| 69 | + <Compile Include="web\jQuery\CXM_jquery_toolbar.anubis" /> | ||
| 70 | + <Compile Include="web\jQuery\CXM_jq_checkbox.anubis" /> | ||
| 71 | + <Compile Include="web\jQuery\CXM_jq_form.anubis" /> | ||
| 72 | + <Compile Include="web\jQuery\CXM_jq_radio.anubis" /> | ||
| 73 | + <Compile Include="web\jQuery\jq_flot.anubis" /> | ||
| 74 | + <Compile Include="web\jQuery\ui-addon\datetimepicker.anubis" /> | ||
| 75 | + <Compile Include="web\js_tools.anubis" /> | ||
| 76 | + <Compile Include="web\piwik\CXM_piwik.anubis" /> | ||
| 77 | + <Compile Include="web\widgets\button.anubis" /> | ||
| 78 | + <Compile Include="web\widgets\css_helper.anubis" /> | ||
| 79 | + <Compile Include="web\widgets\dashboard.anubis" /> | ||
| 80 | + <Compile Include="web\widgets\fisheye_menu.anubis" /> | ||
| 81 | + <Compile Include="web\widgets\icons_set.anubis" /> | ||
| 82 | + <Compile Include="web\widgets\left_menu.anubis" /> | ||
| 83 | + <None Include="web\CXM_making_a_web_site.anubis.bak" /> | ||
| 84 | + <None Include="web\js\cxm_jquery_animate.js" /> | ||
| 85 | + </ItemGroup> | ||
| 86 | + <ItemGroup> | ||
| 87 | + <Folder Include="examples" /> | ||
| 88 | + <Folder Include="web" /> | ||
| 89 | + <Folder Include="web\jQuery" /> | ||
| 90 | + <Folder Include="web\jQuery\ui-addon" /> | ||
| 91 | + <Folder Include="web\js" /> | ||
| 92 | + <Folder Include="web\piwik" /> | ||
| 93 | + <Folder Include="web\widgets" /> | ||
| 94 | + </ItemGroup> | ||
| 95 | +</Project> | ||
| 0 | \ No newline at end of file | 96 | \ No newline at end of file |
web/CXM_common.anubis
| @@ -4,12 +4,12 @@ | @@ -4,12 +4,12 @@ | ||
| 4 | 4 | ||
| 5 | *Copyright* | 5 | *Copyright* |
| 6 | Copyright (c) Alain Prouté 2003~2007. | 6 | Copyright (c) Alain Prouté 2003~2007. |
| 7 | - © Calexium 2007~2016 | 7 | + © Calexium 2007~2017 |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | *Authors:* | 10 | *Authors:* |
| 11 | Alain Prouté | 11 | Alain Prouté |
| 12 | - David René | 12 | + David RENÉ |
| 13 | 13 | ||
| 14 | *Public* | 14 | *Public* |
| 15 | *Name* HTTP_header | 15 | *Name* HTTP_header |
| @@ -21,27 +21,31 @@ transmit system/string.anubis | @@ -21,27 +21,31 @@ transmit system/string.anubis | ||
| 21 | /** | 21 | /** |
| 22 | * The type 'HTTP_header' describes HTTP headers, which are just pairs '(name,value)'. | 22 | * The type 'HTTP_header' describes HTTP headers, which are just pairs '(name,value)'. |
| 23 | */ | 23 | */ |
| 24 | + | ||
| 24 | public type HTTP_header: | 25 | public type HTTP_header: |
| 25 | - http_header(String name, | ||
| 26 | - String value). | ||
| 27 | - | 26 | + http_header( |
| 27 | + String name, | ||
| 28 | + String value | ||
| 29 | + ) | ||
| 30 | +. | ||
| 28 | 31 | ||
| 29 | public define Maybe(String) | 32 | public define Maybe(String) |
| 30 | http_header_value | 33 | http_header_value |
| 31 | - ( | ||
| 32 | - List(HTTP_header) l, | ||
| 33 | - String name | ||
| 34 | - ) = | 34 | + ( |
| 35 | + List(HTTP_header) l, | ||
| 36 | + String name | ||
| 37 | + )= | ||
| 35 | if l is | 38 | if l is |
| 36 | - { | ||
| 37 | - [ ] then failure, | ||
| 38 | - [h . t] then if h is | ||
| 39 | - { | ||
| 40 | - http_header(n, v) then //print("DEBUG: http_header_value --> HEADER = " + n + ":" + v + "\n"); | ||
| 41 | - if insensitive_equal(name, n) then success(v) | ||
| 42 | - else http_header_value(t, name), | ||
| 43 | - } | ||
| 44 | - }. | 39 | + { |
| 40 | + [ ] then failure, | ||
| 41 | + [h . t] then if h is | ||
| 42 | + { | ||
| 43 | + http_header(n, v) then //print("DEBUG: http_header_value --> HEADER = " + n + ":" + v + "\n"); | ||
| 44 | + if insensitive_equal(name, n) then success(v) | ||
| 45 | + else http_header_value(t, name), | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | +. | ||
| 45 | 49 | ||
| 46 | public define List(String) | 50 | public define List(String) |
| 47 | to_List_String | 51 | to_List_String |
| @@ -49,7 +53,7 @@ public define List(String) | @@ -49,7 +53,7 @@ public define List(String) | ||
| 49 | List(HTTP_header) l | 53 | List(HTTP_header) l |
| 50 | )= | 54 | )= |
| 51 | map((HTTP_header h) |-> h.name +": "+h.value, l ). | 55 | map((HTTP_header h) |-> h.name +": "+h.value, l ). |
| 52 | - | 56 | + |
| 53 | public define String | 57 | public define String |
| 54 | to_String | 58 | to_String |
| 55 | ( | 59 | ( |
| @@ -71,13 +75,16 @@ public define String | @@ -71,13 +75,16 @@ public define String | ||
| 71 | 'web/html.anubis'). | 75 | 'web/html.anubis'). |
| 72 | 76 | ||
| 73 | public type Web_arg: | 77 | public type Web_arg: |
| 74 | - web_arg(String name, | ||
| 75 | - String value), | ||
| 76 | - upload (String name, // name of corresponding 'upload' Web_item | ||
| 77 | - String value, // name of uploaded file | ||
| 78 | - String temp_file_path). // temporary file path (relative to server directory) | 78 | + web_arg( |
| 79 | + String name, | ||
| 80 | + String value | ||
| 81 | + ), | ||
| 82 | + upload ( | ||
| 83 | + String name, // name of corresponding 'upload' Web_item | ||
| 84 | + String value, // name of uploaded file | ||
| 85 | + String temp_file_path) // temporary file path (relative to server directory) | ||
| 86 | +. | ||
| 79 | 87 | ||
| 80 | - | ||
| 81 | *Name* Web_arg_value | 88 | *Name* Web_arg_value |
| 82 | *Description* | 89 | *Description* |
| 83 | Of course, within the body of a 'web page' operation, you may want to recover the value | 90 | Of course, within the body of a 'web page' operation, you may want to recover the value |
| @@ -103,26 +110,27 @@ public type Web_arg_value: | @@ -103,26 +110,27 @@ public type Web_arg_value: | ||
| 103 | 110 | ||
| 104 | public define Web_arg_value | 111 | public define Web_arg_value |
| 105 | web_arg_value | 112 | web_arg_value |
| 106 | - ( | ||
| 107 | - List(Web_arg) l, | ||
| 108 | - String name | ||
| 109 | - ) = | 113 | + ( |
| 114 | + List(Web_arg) l, | ||
| 115 | + String name | ||
| 116 | + )= | ||
| 110 | if l is | 117 | if l is |
| 111 | - { | ||
| 112 | - [ ] then not_found, | ||
| 113 | - [h . t] then if h is | ||
| 114 | - { | ||
| 115 | - web_arg(n,v) then | ||
| 116 | - if name=n | ||
| 117 | - then found(v) | ||
| 118 | - else web_arg_value(t,name), | ||
| 119 | - | ||
| 120 | - upload(n,v,tfn) then | ||
| 121 | - if name=n | ||
| 122 | - then found(v) | ||
| 123 | - else web_arg_value(t,name) | ||
| 124 | - } | ||
| 125 | - }. | 118 | + { |
| 119 | + [ ] then not_found, | ||
| 120 | + [h . t] then if h is | ||
| 121 | + { | ||
| 122 | + web_arg(n,v) then | ||
| 123 | + if name=n | ||
| 124 | + then found(v) | ||
| 125 | + else web_arg_value(t,name), | ||
| 126 | + | ||
| 127 | + upload(n,v,tfn) then | ||
| 128 | + if name=n | ||
| 129 | + then found(v) | ||
| 130 | + else web_arg_value(t,name) | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | +. | ||
| 126 | 134 | ||
| 127 | public define Web_arg_value | 135 | public define Web_arg_value |
| 128 | web_arg_value_not_null | 136 | web_arg_value_not_null |
| @@ -143,23 +151,24 @@ public define Web_arg_value | @@ -143,23 +151,24 @@ public define Web_arg_value | ||
| 143 | *Ignore* | 151 | *Ignore* |
| 144 | 152 | ||
| 145 | public define Maybe((String,String)) | 153 | public define Maybe((String,String)) |
| 146 | - file_upload_value | ||
| 147 | - ( | ||
| 148 | - List(Web_arg) l, | ||
| 149 | - String name | ||
| 150 | - ) = | ||
| 151 | - if l is | ||
| 152 | - { | ||
| 153 | - [ ] then failure, | ||
| 154 | - [h . t] then if h is | ||
| 155 | - { | ||
| 156 | - web_arg(_,_) then file_upload_value(t,name), | ||
| 157 | - upload(n,v,tfn) then | ||
| 158 | - if n = name | ||
| 159 | - then success((v,tfn)) | ||
| 160 | - else file_upload_value(t,name) | ||
| 161 | - } | ||
| 162 | - }. | 154 | + file_upload_value |
| 155 | + ( | ||
| 156 | + List(Web_arg) l, | ||
| 157 | + String name | ||
| 158 | + )= | ||
| 159 | + if l is | ||
| 160 | + { | ||
| 161 | + [ ] then failure, | ||
| 162 | + [h . t] then | ||
| 163 | + if h is | ||
| 164 | + { | ||
| 165 | + web_arg(_,_) then file_upload_value(t,name), | ||
| 166 | + upload(n,v,tfn) then | ||
| 167 | + if n = name | ||
| 168 | + then success((v,tfn)) | ||
| 169 | + else file_upload_value(t,name) | ||
| 170 | + } | ||
| 171 | + }. | ||
| 163 | 172 | ||
| 164 | public define List((String,String)) | 173 | public define List((String,String)) |
| 165 | file_upload_value | 174 | file_upload_value |
web/CXM_json.anubis
| @@ -11,7 +11,7 @@ read tools/basis.anubis | @@ -11,7 +11,7 @@ read tools/basis.anubis | ||
| 11 | read tools/printable_tree.anubis | 11 | read tools/printable_tree.anubis |
| 12 | transmit web/mime.anubis | 12 | transmit web/mime.anubis |
| 13 | 13 | ||
| 14 | -transmit calexium_lib/extensions/json.anubis | 14 | +transmit extensions/json.anubis |
| 15 | 15 | ||
| 16 | public type JsonMember:... | 16 | public type JsonMember:... |
| 17 | 17 |
web/CXM_making_a_web_site.anubis
| @@ -2831,17 +2831,17 @@ public define Start_Web_Sites_Result | @@ -2831,17 +2831,17 @@ public define Start_Web_Sites_Result | ||
| 2831 | 2831 | ||
| 2832 | 2832 | ||
| 2833 | public define One | 2833 | public define One |
| 2834 | - start_web_sites | ||
| 2835 | - ( | ||
| 2836 | - Word32 ip_address, // the IP address shared by the web sites | ||
| 2837 | - Word32 http_port, // usually: 80 | ||
| 2838 | - Word32 https_port, // usually: 443 | ||
| 2839 | - String ssl_certificate_common_name, | ||
| 2840 | - List(Web_Site) web_sites, // web sites to be started | ||
| 2841 | - (One) -> Bool shutdown_required, | ||
| 2842 | - Logger log | ||
| 2843 | - ) = | ||
| 2844 | - if (Start_Web_Sites_Result)start_web_sites(ip_address, | 2834 | + start_web_sites |
| 2835 | + ( | ||
| 2836 | + Word32 ip_address, // the IP address shared by the web sites | ||
| 2837 | + Word32 http_port, // usually: 80 | ||
| 2838 | + Word32 https_port, // usually: 443 | ||
| 2839 | + String ssl_certificate_common_name, | ||
| 2840 | + List(Web_Site) web_sites, // web sites to be started | ||
| 2841 | + (One) -> Bool shutdown_required, | ||
| 2842 | + Logger log //logger where to report the error | ||
| 2843 | + )= | ||
| 2844 | + if (Start_Web_Sites_Result)start_web_sites(ip_address, | ||
| 2845 | http_port, | 2845 | http_port, |
| 2846 | https_port, | 2846 | https_port, |
| 2847 | ssl_certificate_common_name, | 2847 | ssl_certificate_common_name, |