Wexus2 0.20
|
00001 00002 /* 00003 * Copyright (c) 2011 Aleksander B. Demko 00004 * This source code is distributed under the MIT license. 00005 * See the accompanying file LICENSE.MIT.txt for details. 00006 */ 00007 00008 // this file is solely for doxygen 00009 // it contains no code 00010 00011 /** 00012 \page wexususerpage Wexus User Reference 00013 00014 This page contains help on various modules and 00015 parameters available in the stock wexusserver 00016 system. 00017 00018 \section wexusserversec wexusserver program 00019 00020 You run wexusserver like so: 00021 \code 00022 wexusserver sitedir 00023 \endcode 00024 00025 If the sitedir doesn't contain any site.ini or app.ini files, 00026 it will be hosted using the basic file server module. 00027 00028 \section siteinisec site.ini 00029 00030 The root sitedir may contain a \b site.ini file. This file contains site-wide 00031 options. 00032 00033 - \b httpport (default 8080) The http port to use. 00034 - \b httpthreads (default 4) The default number of worker threads to use. 00035 00036 00037 \section appinisec app.ini 00038 00039 Any subdirectory of the sitedir may have an \b app.ini file. 00040 This will launch one or more apps in the give directory. 00041 00042 The ini file has sections, one per app. You start a new section with [brackets]. 00043 You can put a descriptive name within the [brackets]. The apps 00044 will be loaded in a sorted order. 00045 00046 Common user settings: 00047 - \b app Required. The app type to launch. See \ref wexusappspage 00048 - \b headerdir (default headers/) Sets common files below. 00049 00050 Common files: 00051 - \b database.sqlite The default sqlite3 database to use for core functions. 00052 - \b headers/ directory. Can contain \b header.html and \b footer.html 00053 which will be used as a common header and footer for all output. 00054 00055 For programmers, there are some computed fields to: \b mountpoint (e.g. blog), 00056 \b appdir (the current dir), and \b sitedir (the sitedir) 00057 00058 00059 Example app.ini: 00060 00061 \code 00062 00063 [1redirector] 00064 00065 app = ca.demko.redirect 00066 00067 link1 = "/src dest" 00068 00069 [2fileer] 00070 00071 app = ca.demko.file 00072 00073 [3mainblooger] 00074 00075 app = ca.demko.blog 00076 00077 \endcode 00078 00079 */ 00080 00081 /** 00082 \page wexusappspage Wexus Apps 00083 00084 Stock apps that can be started by app.ini. 00085 00086 \section cademkofileapp Static File Server 00087 00088 Type \b ca.demko.file 00089 00090 Serves static files directory the user. Useful for .html, .jpg 00091 (and other images), etc. 00092 00093 Options: 00094 - \b dir1 \b dir2 \b dir3 etc. (default dir1=.) One or more directories to server. 00095 They are all relative to the app.ini directory. 00096 - \b options1 etc. (default empty). Provides a space-separated list 00097 of options for each corresponding directory. This string can contain 00098 any of the following: 00099 - \b IndexHtml Show index.html files if present. 00100 - \b AutoDirIndex Automatically generate directory listings when needed. 00101 - \b AllowAllMimeTypes Server all files, not just a safe subset. 00102 00103 \section cademkoredirectapp Redirector 00104 00105 Type \b ca.demko.redirect 00106 00107 Redirects some URLs to some other URLs. Useful for transitions 00108 and building permanent links. 00109 00110 Options: 00111 - \b link1 \b link2 etc. (no default, e.g. "/src dest"). 00112 Specifies one or more redirect mappings. The mappins are of 00113 the form "/src dest". This will remap the given \b src 00114 url to the \b dest url. The dest url can be relative or 00115 absolute. 00116 00117 \section cademkoblogapp Blog Page 00118 00119 Type \b ca.demko.blog 00120 00121 A simply web log (blog) server. 00122 00123 This will server all the markdown-formatted \b txt files in 00124 the \b appdir as blog entries. The filenames should be of the 00125 form \b YYYYMM_title.txt or \b YYYYMMDD_title.txt 00126 00127 See the \link wexusmarkdown \endlink 00128 reference for syntax. 00129 00130 \section cademkowikiapp Wiki Site 00131 00132 Type \b ca.demko.wiki 00133 00134 A simple wiki server. 00135 00136 This will serve all the markdown formatted \b txt files 00137 in the \b appdir as wiki pages. 00138 The pages are then editable and old copies are stored 00139 in a directory. 00140 00141 See the \link wexusmarkdown \endlink 00142 reference for syntax. 00143 00144 \section cademkouptimeapp Uptime Status 00145 00146 A very simply app that reports the uptime and load of the machine. 00147 00148 */ 00149 00150 /** 00151 \page wexustutorialpage Wexus Programmer's Tutorial 00152 00153 This tutorial will quickly outline how to make a Wexus app. 00154 This tutorial was made while building the wexus::UptimeApp application, 00155 so you can open the source files for that and follow along. 00156 00157 \section newappsec Creating your Application object 00158 00159 An application object represents the persistent state 00160 your application needs between controller calls. Many applications 00161 don't need to put any additional logic in their application 00162 objects, but they provide a handy service when they are needed. 00163 00164 Create your application class by deriving from wexus::Application 00165 You don't need to to implement any of the methods, but you 00166 should probably provide a constructor: 00167 00168 \code 00169 class wexus::UptimeApp : public wexus::Application 00170 { 00171 public: 00172 /// default constructor 00173 UptimeApp(void); 00174 }; 00175 \endcode 00176 00177 You must also register your application. You do this in your .cpp 00178 file by instantiating a small static class, providing your 00179 class type and a unique string describing the string. 00180 You can embed your organizations domain name (in reverse order) 00181 to help make your name unique. 00182 00183 For example: 00184 00185 \code 00186 static wexus::RegisterApp<wexus::UptimeApp> r1("ca.demko.uptime"); 00187 \endcode 00188 00189 Note that the instance name of this object ("r1" in this case) 00190 is not used anywhere, so we typically give them short, arbitrary names. 00191 00192 \section newcontrollersec Creating a Controller object 00193 00194 Now you will need one or more controller objects. 00195 Typically, you register one or more methods of your 00196 controller objects as "actions" for URLs. When a web user 00197 accesses one of those URLs, the appropriate controller 00198 object is instantiated and the desired method is then called. 00199 00200 Controller objects are not persistent - they are instantiated 00201 and destroyed per call. 00202 00203 Here is an example of a declaration of a Controller and one method: 00204 00205 \code 00206 class wexus::UptimeController : public wexus::Controller 00207 { 00208 public: 00209 void index(void); 00210 }; 00211 \endcode 00212 00213 And the implementation of the method: 00214 00215 \code 00216 void UptimeController::index(void) 00217 { 00218 htmlOutput() << "Hello, world"; 00219 } 00220 \endcode 00221 00222 Finally, we need to register the controller, and bind it to the application type. 00223 We also need to register each action method. Again, the instance names of these 00224 objects are arbitrary: 00225 00226 \code 00227 static wexus::RegisterController<wexus::UptimeApp, wexus::UptimeController> r2("home"); 00228 static wexus::RegisterAction<wexus::UptimeController, &wexus::UptimeController::index> r100("index"); 00229 \endcode 00230 00231 We can now compile and run the application. Simply: 00232 - Make an app.ini that will tell the wexusserver application what to load 00233 (the contents of this app.ini are below). 00234 - Run "wexusserver dir", where dir is the directory containing the app.ini. It could be 00235 "." (the current directory). 00236 - Load http://localhost:8080/home/index in your web browser. 00237 - Alternatively, load http://localhost:8080/home This works because "index" 00238 is the default action of any controller. 00239 - Alternatively, load http://localhost:8080/ This works because "home" 00240 is the default controller of an application 00241 00242 Here is the app.ini 00243 00244 \code 00245 [myappinstance] 00246 app = ca.demko.uptime 00247 \endcode 00248 00249 \section newrendersec Rendering HTML 00250 00251 (yet to be written) 00252 00253 */ 00254 00255 /** 00256 \page wexusbuildingpage Wexus Compiling Instructions 00257 00258 Wexus requires QT4 and CMake. You'll need git to get the sources. 00259 00260 First, check out wexus2 from git, then create a build directory 00261 under that: 00262 00263 \code 00264 git clone <GITURL> 00265 cd wexus2 00266 mkdir build 00267 cd build 00268 \endcode 00269 00270 Now, run cmake and configure wexus. Alternatively, you 00271 can run ccmake (for a console interface) or cmake-gui 00272 (for a graphical one). 00273 00274 \code 00275 cmake ../wexus2.src 00276 \endcode 00277 00278 Finally, compile wexus. Note first you can only build 00279 the wexusmake utility. With this utility you generate 00280 some files and then run cmake again, to build wexusserver: 00281 00282 \code 00283 make 00284 ./wexusmake ../wexus2.src 00285 cmake ../wexus2.src 00286 make 00287 \endcode 00288 00289 You should now have two executables: wexusmake (the programmers 00290 utility) and wexusserver (a command line web server) 00291 00292 */ 00293 00294 /** 00295 \page wexusmarkdown Wexus Markdown Reference 00296 00297 \section titles Titles 00298 00299 Titles can be implemented using hash marks: 00300 00301 \verbatim 00302 # title 1 # 00303 00304 ## title 2 ## 00305 00306 ### title 3 ### 00307 \endverbatim 00308 00309 You can also use underlines: 00310 00311 \verbatim 00312 A title 00313 =================== 00314 00315 2nd title 00316 ------------------- 00317 \endverbatim 00318 00319 \section code Fixed Width Text 00320 00321 Code/fixed width text needs 4 spaces of margin: 00322 00323 \verbatim 00324 This fixed width code 00325 has 4 spaces before it 00326 \endverbatim 00327 00328 \section style Text Styles 00329 00330 You can use aterixes and underscores to adjust the text style: 00331 00332 \verbatim 00333 Text modes: *bold* _italic_ 00334 \endverbatim 00335 00336 \section links Links 00337 00338 Links should be in brackets or double brackets. 00339 Use [ space to actually get a [ 00340 00341 \verbatim 00342 [http://host/file] or [relative_file.txt] or [[http://another/link]] 00343 \endverbatim 00344 00345 \section lists Lists 00346 00347 Lists are bulleted with asterix. 00348 00349 \verbatim 00350 * list item (can also lead with + or -) 00351 * list item 00352 (line 2 of this item) 00353 * list item 00354 + sub item (note different list item char) and 4-space leader 00355 \endverbatim 00356 00357 00358 \section rules Horizontal Rules 00359 00360 You can use any of these patterns to insert a horizontal rules: 00361 00362 \verbatim 00363 ================= 00364 00365 = = = = = = = = 00366 \endverbatim 00367 00368 00369 \section quoting Quoting 00370 00371 You can quote text (a style of indentation) by using the greater-than sign: 00372 00373 \verbatim 00374 00375 > This is quoted 00376 > Text. 00377 00378 \endverbatim 00379 00380 */