Compare commits
433 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25218996e0 | |||
| 68dbbdea9f | |||
| 5abc79b7c3 | |||
| c5fe539acb | |||
| ac3e969b3c | |||
| 98f2efbd68 | |||
| 7314e92fe6 | |||
| 468b2851be | |||
| f1fe5464c6 | |||
| d621987020 | |||
| e541fdcb0c | |||
| 5950d768c9 | |||
| 413fdaf6cd | |||
| 9138ffedfb | |||
| 72cc05532c | |||
| 145b129b28 | |||
| fbec89f354 | |||
| f59d5cac32 | |||
| 4bb8a71c1b | |||
| dd6b74326e | |||
| e52cd6b352 | |||
| 537bd8241f | |||
| 040c1d1c10 | |||
| f3c779cf6e | |||
| 6cf35e90c6 | |||
| 497fe03d38 | |||
| ca3a520bb9 | |||
| 3c755019aa | |||
| 3a9b67c8ad | |||
| e21da4a591 | |||
| 69bc4d568c | |||
| cf8d25c4e5 | |||
| 2b9ca86501 | |||
| 2f43660628 | |||
| d8476edf36 | |||
| 67e6b460b3 | |||
| 962154fc81 | |||
| 645b35590b | |||
| a1354136fa | |||
| 945ef79857 | |||
| 2c4df29877 | |||
| e6687c7791 | |||
| 754d3f670c | |||
| 8e420de8ec | |||
| 6dc1c0d2b0 | |||
| 80d68699b1 | |||
| fcdf4e456e | |||
| c92c2a91b4 | |||
| da9fa4ecc2 | |||
| abdd68863d | |||
| 83a8ad3879 | |||
| 1b55b09b64 | |||
| 4cf3393a13 | |||
| 4486df14cc | |||
| 60574ee85f | |||
| 7a6c51e47e | |||
| d8c420c4b7 | |||
| 790aa40591 | |||
| e506397406 | |||
| 434f031680 | |||
| e36533bc99 | |||
| d90ecbd5fe | |||
| 20281bc922 | |||
| 6b3a2d3b43 | |||
| 83346c92a7 | |||
| 6b50ab8c55 | |||
| c8efa04147 | |||
| 37860f43b5 | |||
| 65a998cec3 | |||
| 7207a021be | |||
| 32373addfa | |||
| e16f03b1c2 | |||
| 1698a06ea0 | |||
| da3594db50 | |||
| bfa620eee3 | |||
| 1423412f31 | |||
| 0f51925ec1 | |||
| b6784ee35c | |||
| ab5b43d8ef | |||
| c7366615cf | |||
| b60c41ee1b | |||
| f9dfeb0034 | |||
| 5e35bc59a9 | |||
| 2ed6d92e53 | |||
| 33d3071cad | |||
| 35dde23976 | |||
| 390c05b056 | |||
| 011f8746d6 | |||
| 0335226e8b | |||
| 68e4ac9a8f | |||
| f6b293d4ae | |||
| 89572b4f33 | |||
| 52e6944f37 | |||
| bf056154d8 | |||
| a3c50956f1 | |||
| 0d67533c83 | |||
| c0c206e9ae | |||
| 36601fd3a4 | |||
| 9a85c24c0d | |||
| 5ef19021eb | |||
| 7495d0e6a7 | |||
| f27c1f97a3 | |||
| b96029a750 | |||
| 9ef10c749a | |||
| 0aa3d81b22 | |||
| 5d17b0dd29 | |||
| 5e2c2af18a | |||
| de157be6f1 | |||
| f601ae1c8b | |||
| f6f94add80 | |||
| a70e75f729 | |||
| 2dd43ad829 | |||
| 108396bd91 | |||
| e9b7fc4c93 | |||
| 0dd2812574 | |||
| d961544b8b | |||
| 3313e9cf81 | |||
| 39b5a70979 | |||
| 379e806166 | |||
| c1e08a1bdc | |||
| af21520e5d | |||
| effc6ba81d | |||
| 019fb539ae | |||
| 03938b43c3 | |||
| e70d67aed5 | |||
| de38f46d1d | |||
| 8c79a64f0c | |||
| fff7a5c96d | |||
| 1b92403045 | |||
| 8ae4a30ee8 | |||
| 8ffe2a8f73 | |||
| 769f2bb5a8 | |||
| 483f065ef1 | |||
| 8ff055803d | |||
| 3b30f4b994 | |||
| f71bbc07e8 | |||
| 9b9bc1f190 | |||
| 6feaf5757f | |||
| 6f4ec89404 | |||
| cdfc6851e7 | |||
| e0ec84611e | |||
| 2234d3712b | |||
| c89ccfa768 | |||
| 1a88388ffe | |||
| 5eab38778a | |||
| 9d457bb978 | |||
| 42be0b2a4e | |||
| 48d4d26cda | |||
| 182749d010 | |||
| fd0912904c | |||
| 3032b91ff7 | |||
| 772b88f257 | |||
| a1cc2d1d1a | |||
| 9f90bf56a5 | |||
| dbea0e509b | |||
| a3f28e3945 | |||
| 379a6193e9 | |||
| 03d9c3785c | |||
| 612915c918 | |||
| ff967d6332 | |||
| 8d75a04068 | |||
| 202ad2861b | |||
| 44857d28ec | |||
| e3597c0f3b | |||
| 0cce4d8244 | |||
| aab910ab64 | |||
| 257ede7586 | |||
| b58e4e19e1 | |||
| 6ec37c90a2 | |||
| 49c3e8e789 | |||
| cc11debf08 | |||
| b71a22d040 | |||
| 7022206a73 | |||
| b715d674ca | |||
| 02f5bdd801 | |||
| 203d51a97e | |||
| 733296e71e | |||
| 0a497b9a4d | |||
| 4ed91a91a2 | |||
| a76eb75267 | |||
| 2c94a98730 | |||
| cc960310e9 | |||
| d9daac67d9 | |||
| 955f73dee9 | |||
| 137ed3888c | |||
| 8382e8f134 | |||
| 0b7ea3c427 | |||
| 1e7b370859 | |||
| 8c02b0d546 | |||
| 13b09adc8c | |||
| bc2e8b8ee2 | |||
| 36493b4324 | |||
| a09908c048 | |||
| d96ee66a32 | |||
| 7669ccfc1d | |||
| 3a6e3592ae | |||
| 07f9a8cec7 | |||
| 16cab53fb4 | |||
| a2bf68e18a | |||
| 214255c4b9 | |||
| 082b8902ea | |||
| ee9722fa18 | |||
| 4a81d02d12 | |||
| 0f5ae7e153 | |||
| 179dbceaba | |||
| 45292e0248 | |||
| a38fca267b | |||
| d4266a83ec | |||
| 83a181ebf1 | |||
| 54ecd2b1e8 | |||
| da8a216448 | |||
| 085b520879 | |||
| c115a40922 | |||
| 6f600362e3 | |||
| bd36aa8b04 | |||
| 812f521c88 | |||
| beb1bd1599 | |||
| 9bbcdc9927 | |||
| 0d637d478a | |||
| 8e4e7a5084 | |||
| 95d44890d9 | |||
| 161a5c720b | |||
| 35a4cd7df9 | |||
| 70ee7ff47a | |||
| c9343688f3 | |||
| f804a705d5 | |||
| 926c0a79b7 | |||
| fb7854fbcc | |||
| 663a39d2ec | |||
| 6fb36da9ac | |||
| 3fbd81aeb1 | |||
| 6344f964fa | |||
| 14a2c01f41 | |||
| 79e12b8d04 | |||
| aec0136739 | |||
| 9f53287226 | |||
| eaa99c9c61 | |||
| 5f492d6fb6 | |||
| c3f5376ef5 | |||
| 21e973f8a4 | |||
| dec1958909 | |||
| 1453873b6c | |||
| 8255dfd996 | |||
| fcdc164214 | |||
| 4c36d75ef3 | |||
| 09030a27d9 | |||
| b9ca22006b | |||
| 593b48fe90 | |||
| 735730b5a0 | |||
| 035a133b5b | |||
| 0144e97d69 | |||
| 26bfd72f5f | |||
| 88542c2762 | |||
| 12fc54a403 | |||
| eb44eef885 | |||
| c2b66d6ca6 | |||
| 6758c4aef4 | |||
| 6408bec628 | |||
| f77ba9ccd8 | |||
| c105c267e7 | |||
| 19da4d6fd0 | |||
| a9e2dc1135 | |||
| 142dbc39b4 | |||
| b17887d634 | |||
| f443087e71 | |||
| e5eb11b4e7 | |||
| 720d8be08a | |||
| ed04b7fba0 | |||
| 4c9e7a4331 | |||
| cc6992a6fc | |||
| 71c851ca39 | |||
| 900ed8baea | |||
| dba55fcfd9 | |||
| 456299ccdf | |||
| 810208f176 | |||
| 27c637b066 | |||
| a0df04a7f2 | |||
| bc5d20b221 | |||
| 7ba3eb9ecd | |||
| 2b14a40898 | |||
| aa20a1423f | |||
| 34c8cfa427 | |||
| f7dcadccd5 | |||
| f24df1d745 | |||
| 5adf40a9ed | |||
| f20bc42b76 | |||
| a4df57a7ac | |||
| df59ae579b | |||
| 738eb7555f | |||
| d397d4e35d | |||
| eeaa47d4f1 | |||
| 0db4317a49 | |||
| 668847f8e8 | |||
| e7fd7af2c5 | |||
| 24a5c7613d | |||
| d9f6cbe80e | |||
| 95ec2e77df | |||
| 19b5edd9b4 | |||
| d25146dd27 | |||
| ab1c696837 | |||
| dae8e1d67d | |||
| 888bc61522 | |||
| 8291905da1 | |||
| d9ba97d33b | |||
| 33eddd9197 | |||
| 458cb56f75 | |||
| 88c015470e | |||
| f68a713c48 | |||
| 0414cd4501 | |||
| 284d7826c8 | |||
| dff267cd58 | |||
| c2f7c198e0 | |||
| b3ef7c846b | |||
| 111812c4e9 | |||
| 92d8357d09 | |||
| 64060cfa41 | |||
| d3239ec41b | |||
| 7b1557a52a | |||
| c9a4ebcb23 | |||
| 3f899f6aae | |||
| 18684d167b | |||
| 32bb75b9dc | |||
| d06bc76944 | |||
| 86825854ca | |||
| 774cd004db | |||
| c300cf5b6e | |||
| 68247a1849 | |||
| 22fd7490fe | |||
| 8b6e9273fa | |||
| 76fa3e9ff5 | |||
| 1e3770d724 | |||
| 840ae1e6e4 | |||
| 5626e03aa8 | |||
| 4bcea900a6 | |||
| b1f5065e63 | |||
| c37fe9ad79 | |||
| 2e53f7e0c4 | |||
| 512f2d2ce5 | |||
| 92105ca7b3 | |||
| f0c6eec23d | |||
| 32197d0513 | |||
| 11286eeeef | |||
| fb8412fcae | |||
| 9ec87a4329 | |||
| 0c7e6c08e7 | |||
| c1120a4226 | |||
| 5c0cae35ef | |||
| 7bd5cdc232 | |||
| ef85c07603 | |||
| 10db3c28a5 | |||
| 54dc7de189 | |||
| 2244d101ea | |||
| 244fdf1b02 | |||
| 3c9fce293f | |||
| eee085dd5a | |||
| 2d9e2d12a0 | |||
| 6a581f6d62 | |||
| ed8f5d694f | |||
| c20600f281 | |||
| 53ccaa3fde | |||
| 22afbd7ed0 | |||
| f6b362217c | |||
| e9ccf855b3 | |||
| 4d0148d562 | |||
| ec6cc5f2b8 | |||
| 40018d36eb | |||
| 8e18329063 | |||
| c372494713 | |||
| 10f4a99ee1 | |||
| e9085c614c | |||
| f7d3f519a7 | |||
| 4eb22d0272 | |||
| bbcc9ef44b | |||
| 801caa4e69 | |||
| 1b49445077 | |||
| f005d8bb06 | |||
| a278537f7b | |||
| 78b5b6f5fe | |||
| a215c1e4d2 | |||
| fe3726677b | |||
| 94d4909644 | |||
| 0da4b7d61b | |||
| 5c5ba9f038 | |||
| d65c8de1d2 | |||
| 3d93dbc66d | |||
| 436f2afd00 | |||
| 73284575d4 | |||
| e9b05ffc0b | |||
| 012bb2f6c9 | |||
| e883163fe9 | |||
| e5fb3f8328 | |||
| 302ae8d030 | |||
| 694c0a193c | |||
| 4075b08b7e | |||
| 65800371cd | |||
| 2c6196017e | |||
| 5a155e0cee | |||
| 08bec49da4 | |||
| 4940ddb8f5 | |||
| 6599bf1a07 | |||
| 0ef88eadf5 | |||
| e1ef4c390e | |||
| 11baeefe1c | |||
| ac7f58722d | |||
| acd395376a | |||
| a7a27bee0a | |||
| fc0a25acc9 | |||
| 0d363f065b | |||
| 51b70a2490 | |||
| 917f80c0c8 | |||
| 73e5fd6cd6 | |||
| 0abab83566 | |||
| f764e63b45 | |||
| 0a1c4676a4 | |||
| 8a38519fb0 | |||
| 54c9addb30 | |||
| 30d4843a5b | |||
| 3e73298806 | |||
| 01b16d0a82 | |||
| ac97d6019b | |||
| 4e2f0dbc72 | |||
| 9d1fb56cc1 | |||
| bc98c5a317 | |||
| 681bb19ab7 | |||
| 026b4f8682 | |||
| f74ac66569 | |||
| 4fb42df5fb | |||
| f1d8d18811 | |||
| 545db51fc9 | |||
| 20bf9efaa0 | |||
| a168cc62e7 | |||
| b9e89758ce | |||
| 19da9436ff |
@@ -1 +1,3 @@
|
||||
EIFGENs
|
||||
tests/temp/
|
||||
.svn/
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
[submodule "doc/wiki"]
|
||||
path = doc/wiki
|
||||
url = https://github.com/Eiffel-World/Eiffel-Web-Framework.wiki.git
|
||||
[submodule "contrib/library/server/nino"]
|
||||
path = contrib/library/server/nino
|
||||
url = https://github.com/Eiffel-World/EiffelWebNino.git
|
||||
[submodule "contrib/library/text/parser/json"]
|
||||
path = contrib/library/text/parser/json
|
||||
url = https://github.com/Eiffel-World/ejson-svn.git
|
||||
[submodule "contrib/ise_library/cURL"]
|
||||
path = contrib/ise_library/cURL
|
||||
url = https://github.com/EiffelSoftware/mirror-Eiffel-cURL.git
|
||||
@@ -0,0 +1,38 @@
|
||||
History for Eiffel-Web-Framework
|
||||
|
||||
[2011-09-23] Jocelyn
|
||||
* library "ewsgi":
|
||||
- NEW simple autotest cases using Nino web server
|
||||
-fixed issue with RAW_POST_DATA being added in form_data_parameters
|
||||
instead of meta_variables ...
|
||||
- Implemented WGI_VALUE for parameter's type (query_parameter,
|
||||
form_data_parameter, item ...)
|
||||
* Nino connector: added feature to shutdown the server from the WGI application
|
||||
* NEW library "http_client": a new library to perform simple http requests
|
||||
such as get, head, post, put, ... (currently implemented with Eiffel cURL)
|
||||
* NEW library "http_authorization": added simple library to support
|
||||
HTTP_AUTHORIZATION. For now only "Basic" auth type is supported ..
|
||||
|
||||
[2011-09-22] Javier
|
||||
* NEW Example: added partial Restbuck example
|
||||
|
||||
[2011-09-21] Jocelyn
|
||||
* Nino connector: fixed an issue with missing value for Content-Type and Content-Length
|
||||
|
||||
[2011-09-13] Jocelyn
|
||||
* library "router": now using a generic design to allow customization of
|
||||
request handler context class.
|
||||
* NEW library "server/request/rest": first attempt to provide a library to
|
||||
help building RESTful application (the interfaces are likely to change
|
||||
soon) EXPERIMENTAL
|
||||
|
||||
[2011-09-09] Jocelyn
|
||||
* library "uri-template": better support for {/vars} and {?vars}
|
||||
|
||||
[2011-09-07] Jocelyn
|
||||
* library "router": now routing depends on uri (or uri template) and request methods
|
||||
* Nino connector: Fixed issue where HTTP_ prefix were missing for header meta variable.
|
||||
|
||||
[2011-09-07] Jocelyn
|
||||
* changelog: starting to write down changelogs file
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Eiffel Forum License, version 2
|
||||
|
||||
1. Permission is hereby granted to use, copy, modify and/or distribute
|
||||
this package, provided that:
|
||||
* copyright notices are retained unchanged,
|
||||
* any distribution of this package, whether modified or not,
|
||||
includes this license text.
|
||||
|
||||
2. Permission is hereby also granted to distribute binary programs which
|
||||
depend on this package. If the binary program depends on a modified
|
||||
version of this package, you are encouraged to publicly release the
|
||||
modified version of this package.
|
||||
|
||||
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS PACKAGE.
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
# Eiffel Web Framework
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
Official project site for Eiffel Web Framework:
|
||||
|
||||
* http://eiffel-world.github.com/Eiffel-Web-Framework/
|
||||
|
||||
For more information please have a look at the related wiki:
|
||||
|
||||
* https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki
|
||||
|
||||
## Requirements
|
||||
|
||||
* Developped using EiffelStudio 7.0 (on Windows, Linux)
|
||||
* Tested using EiffelStudio 7.0 with "jenkins" CI server (and v6.8 for time to time)
|
||||
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](http://docs.eiffel.com/book/method/void-safe-programming-eiffel) )
|
||||
|
||||
## How to get the source code?
|
||||
|
||||
Using git version >= 1.6.5
|
||||
* git clone --recursive https://github.com/Eiffel-World/Eiffel-Web-Framework.git
|
||||
|
||||
Otherwise, try
|
||||
* git clone https://github.com/Eiffel-World/Eiffel-Web-Framework.git
|
||||
* cd Eiffel-Web-Framework
|
||||
* git submodule update --init
|
||||
* git submodule foreach --recursive git checkout master
|
||||
|
||||
An alternative to the last 2 instructions is to use the script from tools folder:
|
||||
* cd tools
|
||||
* update_git_working_copy
|
||||
|
||||
* And to build the required and related Clibs
|
||||
* cd contrib/ise_library/cURL
|
||||
* geant compile
|
||||
|
||||
## Libraries under 'library'
|
||||
|
||||
### server
|
||||
* __ewsgi__: Eiffel Web Server Gateway Interface [read more](library/server/ewsgi)
|
||||
* connectors: various web server connectors for EWSGI
|
||||
* libfcgi: Wrapper for libfcgi SDK
|
||||
* __wsf__: Web Server Framework [read more](library/server/wsf)
|
||||
* __router__: URL dispatching/routing based on uri, uri_template, or custom [read more](library/server/wsf/router)
|
||||
|
||||
### protocol
|
||||
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/protocol/http)
|
||||
* __uri_template__: URI Template library (parsing and expander) [read more](library/protocol/uri_template)
|
||||
* __CONNEG__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
|
||||
|
||||
### client
|
||||
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
|
||||
|
||||
### text
|
||||
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
|
||||
|
||||
### crypto
|
||||
* eel
|
||||
* eapml
|
||||
|
||||
### Others
|
||||
* error: very simple/basic library to handle error
|
||||
|
||||
## External libraries under 'contrib'
|
||||
* [Eiffel Web Nino](contrib/library/server/nino)
|
||||
* ..
|
||||
|
||||
## Draft folder = call for contribution ##
|
||||
### library/server/request ###
|
||||
* request
|
||||
* rest: (experimental) "a" RESTful library to help building RESTful services
|
||||
|
||||
## Examples
|
||||
..
|
||||
|
||||
|
||||
For more information please have a look at the related wiki:
|
||||
* https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki
|
||||
Submodule
+1
Submodule contrib/ise_library/cURL added at ad2a498fc0
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ECF_CONFIG_PATH)\curl\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ECF_CONFIG_PATH)/curl/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/curl/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/curl/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="curl" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ECF_CONFIG_PATH}\curl\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ECF_CONFIG_PATH}/curl/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ECF_CONFIG_PATH}/curl/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH}/curl/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH}\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH}\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH}\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<cluster name="curl" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
Submodule
+1
Submodule contrib/library/server/nino added at e85213689e
Submodule
+1
Submodule contrib/library/text/parser/json added at 769bb7d161
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 403 KiB |
Submodule
+1
Submodule doc/wiki added at 51b912c4f8
@@ -0,0 +1,25 @@
|
||||
This "draft" folder contains potential addition to EWF
|
||||
|
||||
Anyone wanting to contribute is welcome to the listed libraries, or by suggesting/contributing with extra libraries
|
||||
|
||||
## Current suggestions ##
|
||||
|
||||
### protocol ###
|
||||
* web syndication [__Atom__](library/protocol/syndication/atom)
|
||||
* web syndication [__RSS__](library/protocol/syndication/rss)
|
||||
* [__Twitter__](library/protocol/twitter)
|
||||
* [__XMPP__](library/protocol/xmpp) (also known as Jabber)
|
||||
|
||||
### Security ###
|
||||
* [__OAuth__](library/security/oauth)
|
||||
* [__OpenID__](library/security/openid)
|
||||
|
||||
### Text ###
|
||||
* [__Filters__](library/text/filter) : Wiki markup, Markdown, ...
|
||||
* [__Templates__](library/text/template) : Web template engine ...
|
||||
|
||||
|
||||
### ... ###
|
||||
|
||||
Any contribution is welcome, help us make Eiffel Web Framework bigger, richer and better.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Web Syndication
|
||||
|
||||
http://en.wikipedia.org/wiki/Web_syndication
|
||||
|
||||
* [Atom Pub](atom)
|
||||
* [RSS](rss)
|
||||
* ...
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,10 @@
|
||||
Atom protocol
|
||||
|
||||
http://en.wikipedia.org/wiki/Atom_(standard)
|
||||
|
||||
Atom standard
|
||||
* [RFC 4287](http://tools.ietf.org/html/rfc4287) – "The Atom Syndication Format"
|
||||
* [RFC 5023](http://tools.ietf.org/html/rfc5023) – "The Atom Publishing Protocol"
|
||||
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="atom" uuid="076DEABB-20DA-43E9-A4C7-F3FAEDF5B1FC" library_target="atom">
|
||||
<target name="atom">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="atom" uuid="076DEABB-20DA-43E9-A4C7-F3FAEDF5B1FC" library_target="atom">
|
||||
<target name="atom">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,22 @@
|
||||
note
|
||||
description: "[
|
||||
Main interface for ATOM interface
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
ATOM
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Instantiate Current object
|
||||
do
|
||||
check not_yet_implemented: False end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
RSS protocol
|
||||
|
||||
http://en.wikipedia.org/wiki/RSS
|
||||
|
||||
* [RSS specification](http://www.rssboard.org/rss-specification)
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rss" uuid="8D8E3E5A-2685-40AF-9EF9-E3113B3C62AA" library_target="rss">
|
||||
<target name="rss">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rss" uuid="8D8E3E5A-2685-40AF-9EF9-E3113B3C62AA" library_target="rss">
|
||||
<target name="rss">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,22 @@
|
||||
note
|
||||
description: "[
|
||||
Main interface for RSS interface
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
RSS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Instantiate Current object
|
||||
do
|
||||
check not_yet_implemented: False end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
Twitter protocol
|
||||
|
||||
http://en.wikipedia.org/wiki/Twitter
|
||||
|
||||
Eventually move http://bricabrac.origo.ethz.ch/wiki/Eiffel_Twitter here
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,6 @@
|
||||
XMPP/Jabber protocol
|
||||
|
||||
http://en.wikipedia.org/wiki/Xmpp
|
||||
|
||||
Eventually move http://bricabrac.origo.ethz.ch/wiki/Eiffel_XMPP here
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,7 @@
|
||||
OAuth
|
||||
|
||||
http://en.wikipedia.org/wiki/Oauth
|
||||
|
||||
* [RFC5849](http://tools.ietf.org/html/rfc5849)
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="oauth" uuid="F8B4DF74-C71B-45A3-9B9A-F6141C4D3C56" library_target="oauth">
|
||||
<target name="oauth">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="oauth" uuid="F8B4DF74-C71B-45A3-9B9A-F6141C4D3C56" library_target="oauth">
|
||||
<target name="oauth">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,22 @@
|
||||
note
|
||||
description: "[
|
||||
Main interface for OAUTH interface
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
OAUTH
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Instantiate Current object
|
||||
do
|
||||
check not_yet_implemented: False end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
OpenID
|
||||
|
||||
http://en.wikipedia.org/wiki/Openid
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="openid" uuid="E6B80EAB-AC99-46F5-9896-4892D3477A9A" library_target="openid">
|
||||
<target name="openid">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="openid" uuid="E6B80EAB-AC99-46F5-9896-4892D3477A9A" library_target="openid">
|
||||
<target name="openid">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||
<cluster name="src" location="./src" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,22 @@
|
||||
note
|
||||
description: "[
|
||||
Main interface for OPENID interface
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
OPENID
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Instantiate Current object
|
||||
do
|
||||
check not_yet_implemented: False end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
reference:forum2
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rest" uuid="97FA9457-7820-4A21-8A13-C8D0E9CCEC62" library_target="rest">
|
||||
<target name="rest">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\..\..\library\protocol\http\http-safe.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\..\..\library\protocol\uri_template\uri_template-safe.ecf"/>
|
||||
<cluster name="contrib" location=".\src\contrib\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/html$</exclude>
|
||||
</file_rule>
|
||||
<cluster name="html" location="$|doc\html\" recursive="true" hidden="true"/>
|
||||
</cluster>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/contrib$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rest" uuid="97FA9457-7820-4A21-8A13-C8D0E9CCEC62" library_target="rest">
|
||||
<target name="rest">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\..\library\server\wsf\wsf.ecf"/>
|
||||
<library name="http" location="..\..\..\..\..\library\protocol\http\http.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\..\..\library\protocol\uri_template\uri_template.ecf"/>
|
||||
<cluster name="contrib" location=".\src\contrib\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/html$</exclude>
|
||||
</file_rule>
|
||||
<cluster name="html" location="$|doc\html\" recursive="true" hidden="true"/>
|
||||
</cluster>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/contrib$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,184 @@
|
||||
note
|
||||
description: "Summary description for {HTML_PAGE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTML_PAGE
|
||||
|
||||
inherit
|
||||
HTML_UTILITIES
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_title: like title)
|
||||
do
|
||||
create {ARRAYED_LIST [like html_attributes.item]} html_attributes.make (0)
|
||||
create head.make (a_title)
|
||||
create {ARRAYED_LIST [like body_attributes.item]} body_attributes.make (0)
|
||||
create body.make_empty
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
-- Initialize
|
||||
do
|
||||
create headers.make
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
headers: HTTP_HEADER
|
||||
|
||||
feature -- Recycle
|
||||
|
||||
recycle
|
||||
do
|
||||
html_attributes.wipe_out
|
||||
headers.recycle
|
||||
head.recycle
|
||||
body_attributes.wipe_out
|
||||
body.wipe_out
|
||||
internal_header_string := Void
|
||||
internal_message_string := Void
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
html_attributes: LIST [TUPLE [name: STRING; value: STRING]]
|
||||
|
||||
head: HTML_PAGE_HEAD
|
||||
|
||||
body_attributes: LIST [TUPLE [name: STRING; value: STRING]]
|
||||
|
||||
body: STRING
|
||||
|
||||
feature -- Query
|
||||
|
||||
title: detachable STRING
|
||||
do
|
||||
Result := head.title
|
||||
end
|
||||
|
||||
add_html_ttribute (a: like html_attributes.item)
|
||||
do
|
||||
html_attributes.force (a)
|
||||
end
|
||||
|
||||
add_body_attribute (a: like body_attributes.item)
|
||||
do
|
||||
body_attributes.force (a)
|
||||
end
|
||||
|
||||
set_body (s: like body)
|
||||
-- Set `body' to `s'
|
||||
do
|
||||
body := s
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (t: like title)
|
||||
do
|
||||
head.title := t
|
||||
end
|
||||
|
||||
feature -- Output
|
||||
|
||||
compute
|
||||
-- Compute the string output
|
||||
local
|
||||
s, t: STRING
|
||||
do
|
||||
--| HTML beginning
|
||||
create s.make (128)
|
||||
s.append_string ("<html")
|
||||
s.append_string (attributes_to_string (html_attributes))
|
||||
s.append_string (">%N")
|
||||
|
||||
--| Head
|
||||
head.compute --| Be sure to have a fresh string
|
||||
t := head.string
|
||||
if not t.is_empty then
|
||||
s.append_string (t)
|
||||
s.append_character ('%N')
|
||||
end
|
||||
|
||||
--| Body
|
||||
s.append_string ("<body")
|
||||
s.append_string (attributes_to_string (body_attributes))
|
||||
s.append_string (">%N")
|
||||
s.append_string (body)
|
||||
s.append_string ("</body>")
|
||||
|
||||
--| End
|
||||
s.append_string ("</html>")
|
||||
|
||||
--| Http headers
|
||||
headers.put_content_length (s.count)
|
||||
internal_header_string := headers.string
|
||||
internal_message_string := s
|
||||
end
|
||||
|
||||
header_string: STRING
|
||||
local
|
||||
o: like internal_header_string
|
||||
do
|
||||
o := internal_header_string
|
||||
if o = Void then
|
||||
compute
|
||||
o := internal_header_string
|
||||
if o = Void then
|
||||
check output_computed: False end
|
||||
create o.make_empty
|
||||
end
|
||||
end
|
||||
Result := o
|
||||
end
|
||||
|
||||
message_string: STRING
|
||||
local
|
||||
o: like internal_message_string
|
||||
do
|
||||
o := internal_message_string
|
||||
if o = Void then
|
||||
compute
|
||||
o := internal_message_string
|
||||
if o = Void then
|
||||
check output_computed: False end
|
||||
create o.make_empty
|
||||
end
|
||||
end
|
||||
Result := o
|
||||
end
|
||||
|
||||
send (buf: WSF_RESPONSE)
|
||||
do
|
||||
buf.set_status_code (200)
|
||||
buf.put_header_text (header_string)
|
||||
buf.put_string (message_string)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: output
|
||||
|
||||
internal_header_string: detachable like header_string
|
||||
|
||||
internal_message_string: detachable like message_string
|
||||
|
||||
invariant
|
||||
header_attached: headers /= Void
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,111 @@
|
||||
note
|
||||
description: "Summary description for {HTML_PAGE_HEAD}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTML_PAGE_HEAD
|
||||
|
||||
inherit
|
||||
HTML_UTILITIES
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_title: like title)
|
||||
do
|
||||
initialize
|
||||
title := a_title
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
create text.make_empty
|
||||
create {ARRAYED_LIST [like attributes.item]} attributes.make (0)
|
||||
end
|
||||
|
||||
feature -- Recycle
|
||||
|
||||
recycle
|
||||
do
|
||||
attributes.wipe_out
|
||||
title := Void
|
||||
text.wipe_out
|
||||
internal_string := Void
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
attributes: LIST [TUPLE [name: STRING; value: STRING]]
|
||||
|
||||
title: detachable STRING assign set_title
|
||||
|
||||
text: STRING
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (t: like title)
|
||||
do
|
||||
title := t
|
||||
end
|
||||
|
||||
feature -- Output
|
||||
|
||||
compute
|
||||
-- Compute the string output
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
create s.make_empty
|
||||
if attached title as t then
|
||||
s.append_string ("<title>" + t + "</title>%N")
|
||||
end
|
||||
if text.count > 0 then
|
||||
s.append_string (text)
|
||||
s.append_character ('%N')
|
||||
end
|
||||
if s.count > 0 then
|
||||
internal_string := "<head" + attributes_to_string (attributes) + ">%N" + s + "</head>"
|
||||
else
|
||||
internal_string := s
|
||||
end
|
||||
end
|
||||
|
||||
string: STRING
|
||||
--
|
||||
local
|
||||
o: like internal_string
|
||||
do
|
||||
o := internal_string
|
||||
if o = Void then
|
||||
compute
|
||||
o := internal_string
|
||||
if o = Void then
|
||||
check output_computed: False end
|
||||
create o.make_empty
|
||||
end
|
||||
end
|
||||
Result := o
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: output
|
||||
|
||||
internal_string: detachable like string
|
||||
|
||||
invariant
|
||||
text_attached: text /= Void
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,90 @@
|
||||
note
|
||||
description: "Summary description for {HTML_UTILITIES}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTML_UTILITIES
|
||||
|
||||
feature -- Encoding
|
||||
|
||||
html_special_chars_encoded_string (s: STRING): STRING
|
||||
local
|
||||
c: CHARACTER
|
||||
i,n: INTEGER
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
create Result.make (n + 10)
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
c := s[i]
|
||||
inspect c
|
||||
when '&' then
|
||||
Result.append_string ("&")
|
||||
when '%"' then
|
||||
Result.append_string (""")
|
||||
when '%'' then
|
||||
Result.append_string ("'")
|
||||
when '<' then
|
||||
Result.append_string ("<")
|
||||
when '>' then
|
||||
Result.append_string (">")
|
||||
else
|
||||
Result.extend (c)
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
strings_to_string (lst: LIST [STRING]; sep: STRING): STRING
|
||||
do
|
||||
create Result.make_empty
|
||||
if lst.count > 0 then
|
||||
from
|
||||
lst.start
|
||||
until
|
||||
lst.after
|
||||
loop
|
||||
Result.append_string (lst.item)
|
||||
Result.append_string (sep)
|
||||
lst.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
attributes_to_string (atts: LIST [TUPLE [name: STRING; value: STRING]]): STRING
|
||||
do
|
||||
create Result.make_empty
|
||||
if atts.count > 0 then
|
||||
from
|
||||
atts.start
|
||||
until
|
||||
atts.after
|
||||
loop
|
||||
Result.append_character (' ')
|
||||
Result.append_string (atts.item.name)
|
||||
Result.append_character ('=')
|
||||
Result.append_character ('%"')
|
||||
Result.append_string (html_special_chars_encoded_string (atts.item.value))
|
||||
Result.append_character ('%"')
|
||||
atts.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,321 @@
|
||||
note
|
||||
description: "Summary description for {REST_API_DOCUMENTATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_API_DOCUMENTATION [C -> REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
inherit
|
||||
REST_REQUEST_HANDLER [C]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_router: like router; a_base_doc_url: like base_doc_url)
|
||||
do
|
||||
router := a_router
|
||||
base_doc_url := a_base_doc_url
|
||||
description := "Technical documention for the API"
|
||||
end
|
||||
|
||||
feature {NONE} -- Access: Implementation
|
||||
|
||||
router: REST_REQUEST_ROUTER [REST_REQUEST_HANDLER [C], C]
|
||||
|
||||
base_doc_url: READABLE_STRING_8
|
||||
|
||||
feature -- Access
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
rep: like new_html_page
|
||||
s: STRING
|
||||
rq: detachable REST_REQUEST_HANDLER [C]
|
||||
rq_resource: detachable READABLE_STRING_GENERAL
|
||||
-- l_dft_format_name: detachable STRING
|
||||
hdl_cursor: like router.new_cursor
|
||||
do
|
||||
rep := new_html_page
|
||||
rep.headers.put_content_type_text_html
|
||||
create s.make_empty
|
||||
|
||||
if
|
||||
attached {WSF_STRING} ctx.path_parameter ("resource") as l_resource_value and then
|
||||
attached l_resource_value.string as l_resource
|
||||
then
|
||||
from
|
||||
hdl_cursor := router.new_cursor
|
||||
until
|
||||
hdl_cursor.after or rq /= Void
|
||||
loop
|
||||
if hdl_cursor.item.resource.same_string_general (l_resource) then
|
||||
rq := hdl_cursor.item.handler
|
||||
rq_resource := l_resource
|
||||
end
|
||||
hdl_cursor.forth
|
||||
end
|
||||
end
|
||||
-- if a_args /= Void and then not a_args.is_empty then
|
||||
-- rq := router.handler_by_path (a_args)
|
||||
-- if rq = Void then
|
||||
-- rq := handler_manager.smart_handler_by_path (a_args)
|
||||
---- if attached {REST_REQUEST_GROUP_HANDLER} rq as grp then
|
||||
---- rq := grp.handlers.handler_by_path (a_args)
|
||||
---- end
|
||||
-- end
|
||||
-- if
|
||||
-- rq /= Void and then
|
||||
-- attached rq.path_information (a_args) as l_info
|
||||
-- then
|
||||
-- l_dft_format_name := l_info.format
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
if rq /= Void and then rq_resource /= Void then
|
||||
rep.set_big_title ("API: Technical documentation for ["+ rq_resource.as_string_8 +"]")
|
||||
|
||||
s.append_string ("<div class=%"api%">")
|
||||
s.append_string ("<h2 class=%"api-name%" >")
|
||||
|
||||
s.append_string ("<a href=%"" + base_doc_url + "%">.. Show all features ..</a>")
|
||||
s.append_string ("</h2></div>%N")
|
||||
|
||||
process_request_handler_doc (rq, rq_resource.as_string_8, s, ctx, req, res, Void)
|
||||
else
|
||||
rep.set_big_title ("API: Technical documentation")
|
||||
|
||||
from
|
||||
hdl_cursor := router.new_cursor
|
||||
until
|
||||
hdl_cursor.after
|
||||
loop
|
||||
if attached hdl_cursor.item as l_item then
|
||||
rq := l_item.handler
|
||||
rep.add_shortcut (l_item.resource)
|
||||
s.append ("<a name=%"" + rep.last_added_shortcut + "%"/>")
|
||||
process_request_handler_doc (rq, l_item.resource, s, ctx, req, res, Void)
|
||||
hdl_cursor.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
rep.set_body (s)
|
||||
rep.send (res)
|
||||
rep.recycle
|
||||
end
|
||||
|
||||
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; a_dft_format: detachable STRING)
|
||||
local
|
||||
l_dft_format_name: detachable STRING
|
||||
s: STRING
|
||||
l_uri_tpl: URI_TEMPLATE
|
||||
do
|
||||
s := buf
|
||||
|
||||
if a_dft_format /= Void then
|
||||
if rq.supported_format_names.has (a_dft_format) then
|
||||
l_dft_format_name := a_dft_format
|
||||
end
|
||||
end
|
||||
|
||||
s.append_string ("<div class=%"api%">")
|
||||
s.append_string ("<h2 class=%"api-name%" ><a href=%""+ url (req, base_doc_url, a_resource, False) +"%">"+ a_resource +"</a></h2>")
|
||||
s.append_string ("<div class=%"inner%">")
|
||||
-- if rq.hidden (req) then
|
||||
-- s.append_string ("<div class=%"api-description%">This feature is hidden</div>%N")
|
||||
-- else
|
||||
if attached rq.description as desc then
|
||||
s.append_string ("<div class=%"api-description%">" + desc + "</div>")
|
||||
end
|
||||
-- if attached {REST_REQUEST_GROUP_HANDLER} rq as grp then
|
||||
-- s.append_string ("<div class=%"api-format%">Handler: <strong>")
|
||||
-- if attached grp.handlers.new_cursor as l_handlers_cursor then
|
||||
-- from
|
||||
|
||||
-- until
|
||||
-- l_handlers_cursor.after
|
||||
-- loop
|
||||
-- s.append_string (" ")
|
||||
-- s.append_string ("<a class=%"api-handler%" href=%"")
|
||||
-- s.append_string (url (ctx, l_handlers_cursor.item.path, False))
|
||||
-- s.append_string ("%">"+ l_handlers_cursor.item.path +"</a>")
|
||||
-- l_handlers_cursor.forth
|
||||
-- end
|
||||
-- end
|
||||
-- s.append_string ("</strong></div>")
|
||||
-- end
|
||||
if attached rq.supported_format_names as l_formats and then not l_formats.is_empty then
|
||||
s.append_string ("<div class=%"api-format%">Supported formats: <strong>")
|
||||
if attached l_formats.new_cursor as l_formats_cursor then
|
||||
from
|
||||
|
||||
until
|
||||
l_formats_cursor.after
|
||||
loop
|
||||
s.append_string (" ")
|
||||
s.append_string ("<a class=%"api-name api-format")
|
||||
if l_formats_cursor.item ~ l_dft_format_name then
|
||||
s.append_string (" selected")
|
||||
end
|
||||
s.append_string ("%" href=%"" + url (req, base_doc_url, a_resource, False) + "." + l_formats_cursor.item + "%">"+ l_formats_cursor.item +"</a>")
|
||||
l_formats_cursor.forth
|
||||
end
|
||||
end
|
||||
s.append_string ("</strong></div>")
|
||||
end
|
||||
if attached rq.supported_request_method_names as l_methods and then not l_methods.is_empty then
|
||||
s.append_string ("<div class=%"api-method%">Supported request methods: <strong>")
|
||||
if attached l_methods.new_cursor as l_methods_cursor then
|
||||
from
|
||||
|
||||
until
|
||||
l_methods_cursor.after
|
||||
loop
|
||||
s.append_string (" ")
|
||||
s.append_string (l_methods_cursor.item)
|
||||
l_methods_cursor.forth
|
||||
end
|
||||
end
|
||||
s.append_string ("</strong></div>")
|
||||
end
|
||||
s.append_string ("<div class=%"api-auth%">Authentication required: <strong>" + rq.authentication_required (req).out + "</strong></div>")
|
||||
if attached {REST_REQUEST_URI_TEMPLATE_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]} router as l_uri_template_router then
|
||||
create l_uri_tpl.make (a_resource)
|
||||
if attached l_uri_tpl.query_variable_names as l_query_variable_names and then not l_query_variable_names.is_empty then
|
||||
s.append_string ("<div class=%"api-uri-template%">Query parameters: ")
|
||||
-- s.append_string (rq.path)
|
||||
from
|
||||
l_query_variable_names.start
|
||||
until
|
||||
l_query_variable_names.after
|
||||
loop
|
||||
if l_query_variable_names.isfirst then
|
||||
s.append_string ("?")
|
||||
else
|
||||
s.append_string ("&")
|
||||
end
|
||||
if attached l_query_variable_names.item as l_query_param then
|
||||
s.append_string ("<strong>" + l_query_param + "</strong>")
|
||||
s.append_string ("=<em>" + l_query_param + "</em>")
|
||||
end
|
||||
l_query_variable_names.forth
|
||||
end
|
||||
s.append_string ("</div>%N")
|
||||
end
|
||||
if attached l_uri_tpl.path_variable_names as l_path_variable_names and then not l_path_variable_names.is_empty then
|
||||
s.append_string ("<div class=%"api-uri-template%">Path Segment parameters: ")
|
||||
-- s.append_string (rq.path)
|
||||
from
|
||||
l_path_variable_names.start
|
||||
until
|
||||
l_path_variable_names.after
|
||||
loop
|
||||
if attached l_path_variable_names.item as l_seg_param then
|
||||
s.append_string ("<em>{" + l_seg_param + "}</em>")
|
||||
end
|
||||
l_path_variable_names.forth
|
||||
end
|
||||
s.append_string ("</div>%N")
|
||||
end
|
||||
|
||||
end
|
||||
-- if attached rq._parameters as l_uri_params and then not l_uri_params.is_empty then
|
||||
-- s.append_string ("<div class=%"api-uri-template%">URI Template: ")
|
||||
-- s.append_string (rq.path)
|
||||
-- if attached l_uri_params.new_cursor as l_uri_params_cursor then
|
||||
-- from
|
||||
|
||||
-- until
|
||||
-- l_uri_params_cursor.after
|
||||
-- loop
|
||||
-- if attached l_uri_params_cursor.item as l_uri_param then
|
||||
-- s.append_string ("/<strong>" + l_uri_param.name + "</strong>")
|
||||
-- s.append_string ("/<em>{" + l_uri_param.name + "}</em>")
|
||||
-- end
|
||||
-- l_uri_params_cursor.forth
|
||||
-- end
|
||||
-- end
|
||||
-- s.append_string ("</div>%N")
|
||||
-- end
|
||||
-- if attached rq.parameters as l_params and then not l_params.is_empty then
|
||||
-- s.append_string ("<div class=%"api-params%">Parameters: ")
|
||||
|
||||
-- --| show form only if we have a default format
|
||||
-- if l_dft_format_name = Void then
|
||||
-- s.append_string ("<span class=%"note%">to test the parameter(s), please first select a supported format.</span>%N")
|
||||
-- else
|
||||
-- if rq.method_post_supported then
|
||||
-- s.append_string ("<form id=%""+ rq.path +"%" method=%"POST%" action=%"" + ctx.script_url (rq.path) + "." + l_dft_format_name + "%">%N")
|
||||
-- else
|
||||
-- s.append_string ("<form id=%""+ rq.path +"%" method=%"GET%" action=%"" + ctx.script_url (rq.path) + "." + l_dft_format_name + "%">%N")
|
||||
-- end
|
||||
-- end
|
||||
-- s.append_string ("<ul>")
|
||||
-- if attached l_params.new_cursor as l_params_cursor then
|
||||
-- from
|
||||
|
||||
-- until
|
||||
-- l_params_cursor.after
|
||||
-- loop
|
||||
-- if attached l_params_cursor.item as l_param then
|
||||
-- s.append_string ("<li><strong>" + l_param.name + "</strong>")
|
||||
-- if l_param.optional then
|
||||
-- s.append_string (" <em>(Optional)</em>")
|
||||
-- end
|
||||
-- if attached l_param.description as l_param_desc then
|
||||
-- s.append_string (": <em>" + l_param_desc + "</em>")
|
||||
-- end
|
||||
-- if l_dft_format_name /= Void then
|
||||
-- s.append (" <input name=%"" + l_param.name + "%" type=%"text%" />")
|
||||
-- end
|
||||
-- s.append_string ("</li>")
|
||||
-- end
|
||||
-- l_params_cursor.forth
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- if l_dft_format_name /= Void then
|
||||
-- s.append_string ("<input type=%"submit%" value=%"Test "+ rq.path + "." + l_dft_format_name + "%"/>")
|
||||
-- s.append_string ("</form>")
|
||||
-- end
|
||||
-- s.append_string ("</ul></div>")
|
||||
-- else
|
||||
-- if l_dft_format_name /= Void then
|
||||
-- s.append_string ("<a class=%"api-name%" href=%"" + ctx.script_url (a_resource + "." + l_dft_format_name) + "%">Test "+ a_resource + "." + l_dft_format_name + "</a>")
|
||||
-- else
|
||||
-- s.append_string ("<a class=%"api-name%" href=%"" + ctx.script_url (a_resource) + "%">Test "+ a_resource +"</a>")
|
||||
-- end
|
||||
-- end
|
||||
s.append_string ("</div>%N")
|
||||
-- end
|
||||
s.append_string ("</div>%N") -- inner
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_html_page: REST_API_DOCUMENTATION_HTML_PAGE
|
||||
do
|
||||
create Result.make ("API Documentation")
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,124 @@
|
||||
note
|
||||
description: "Summary description for {REST_API_DOCUMENTATION_HTML_PAGE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_API_DOCUMENTATION_HTML_PAGE
|
||||
|
||||
inherit
|
||||
HTML_PAGE
|
||||
redefine
|
||||
head,
|
||||
initialize,
|
||||
recycle,
|
||||
compute
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
create {LINKED_LIST [like shortcuts.item]} shortcuts.make
|
||||
end
|
||||
|
||||
feature -- Recyle
|
||||
|
||||
recycle
|
||||
do
|
||||
Precursor
|
||||
shortcuts.wipe_out
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
head: REST_API_DOCUMENTATION_HTML_PAGE_HEAD
|
||||
|
||||
big_title: detachable STRING
|
||||
|
||||
shortcuts: LIST [TUPLE [name: STRING; anchor: STRING]]
|
||||
|
||||
add_shortcut (s: STRING)
|
||||
local
|
||||
t: STRING
|
||||
do
|
||||
t := s.string
|
||||
t.replace_substring_all ("/", "-")
|
||||
shortcuts.force ([s,t])
|
||||
end
|
||||
|
||||
last_added_shortcut: STRING
|
||||
do
|
||||
if shortcuts.count > 0 and then attached shortcuts.last as sht then
|
||||
Result := sht.anchor
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
shortcuts_to_html: detachable STRING
|
||||
do
|
||||
if not shortcuts.is_empty then
|
||||
from
|
||||
create Result.make_from_string ("<strong>Shortcuts:</strong> | ")
|
||||
shortcuts.start
|
||||
until
|
||||
shortcuts.after
|
||||
loop
|
||||
Result.append_string ("<a href=%"#"+ shortcuts.item.anchor +"%">"+ shortcuts.item.name +"</a> | ")
|
||||
shortcuts.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_big_title (t: like big_title)
|
||||
do
|
||||
big_title := t
|
||||
end
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
compute
|
||||
local
|
||||
l_old_body: STRING
|
||||
sh, bt: detachable STRING
|
||||
do
|
||||
sh := shortcuts_to_html
|
||||
bt := big_title
|
||||
if sh /= Void or bt /= Void then
|
||||
l_old_body := body
|
||||
if bt /= Void then
|
||||
bt := "<h1>" + bt + "</h2>%N"
|
||||
if sh /= Void then
|
||||
body := bt + sh + l_old_body
|
||||
else
|
||||
body := bt + l_old_body
|
||||
end
|
||||
elseif sh /= Void then
|
||||
body := sh + l_old_body
|
||||
end
|
||||
Precursor
|
||||
body := l_old_body
|
||||
else
|
||||
Precursor
|
||||
end
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
note
|
||||
description: "Summary description for {REST_API_DOCUMENTATION_HTML_PAGE_HEAD}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_API_DOCUMENTATION_HTML_PAGE_HEAD
|
||||
|
||||
inherit
|
||||
HTML_PAGE_HEAD
|
||||
redefine
|
||||
initialize,
|
||||
compute
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
style := "[
|
||||
body {margin: 0px;}
|
||||
a { text-decoration: none; }
|
||||
h1 { padding: 10px; border: solid 2px #000; background-color: #009; color: #fff;}
|
||||
div.api { padding: 5px; margin-bottom: 10px;}
|
||||
div.api .api-description { padding: 5px 5px 5px 0px; font-style: italic; color: #090;}
|
||||
div.api div.inner { padding-left: 40px;}
|
||||
div.api h2>a { color: #009; text-decoration: none;}
|
||||
div.api a.api-format { color: #009; text-decoration: none;}
|
||||
div.api a.api-format.selected { padding: 0 4px 0 4px; color: #009; text-decoration: none; border: solid 1px #99c; background-color: #eeeeff;}
|
||||
div.api>h2 { margin: 2px; padding: 2px 2px 2px 10px; display: inline-block; border: dotted 1px #cce; width: 100%; color: #009; background-color: #E7F3F8; text-decoration: none; font-weight: bold; font-size: 120%;}
|
||||
div.api span.note { font-style: italic;}
|
||||
]"
|
||||
end
|
||||
|
||||
feature {REST_API_DOCUMENTATION_HTML_PAGE} -- Access
|
||||
|
||||
style: STRING
|
||||
|
||||
feature -- Output
|
||||
|
||||
compute
|
||||
-- Compute the string output
|
||||
local
|
||||
s: detachable STRING
|
||||
p: INTEGER
|
||||
do
|
||||
Precursor
|
||||
s := internal_string
|
||||
if s /= Void then
|
||||
p := s.substring_index ("</head>", 1)
|
||||
if p > 0 then
|
||||
s.insert_string ("<style>%N" + style + "%N</style>%N", p)
|
||||
else
|
||||
s.append_string ("<style>%N" + style + "%N</style>%N")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
note
|
||||
description: "Summary description for REST_REQUEST_GROUP_HANDLER."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_GROUP_HANDLER [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
inherit
|
||||
REQUEST_ROUTING_HANDLER [H, C]
|
||||
redefine
|
||||
execute
|
||||
end
|
||||
|
||||
REST_REQUEST_HANDLER [C]
|
||||
redefine
|
||||
execute
|
||||
select
|
||||
execute_application
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- status
|
||||
|
||||
authentication_required: BOOLEAN
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||
do
|
||||
Precursor {REST_REQUEST_HANDLER} (ctx, req, res)
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,56 @@
|
||||
note
|
||||
description: "Summary description for {REST_RESPONSE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_RESPONSE
|
||||
|
||||
inherit
|
||||
WSF_PAGE_RESPONSE
|
||||
rename
|
||||
header as headers,
|
||||
body as message,
|
||||
set_body as set_message,
|
||||
put_string as append_message,
|
||||
make as page_make,
|
||||
send_to as send
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_api: like api)
|
||||
do
|
||||
api := a_api
|
||||
page_make
|
||||
end
|
||||
|
||||
feature -- Recycle
|
||||
|
||||
recycle
|
||||
do
|
||||
headers.recycle
|
||||
message := Void
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
api: STRING
|
||||
-- Associated api query string.
|
||||
|
||||
invariant
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
note
|
||||
description: "Summary description for REST_REQUEST_AGENT_HANDLER."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_AGENT_HANDLER [C -> REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
inherit
|
||||
REQUEST_AGENT_HANDLER [C]
|
||||
rename
|
||||
execute as execute_application
|
||||
end
|
||||
|
||||
REST_REQUEST_HANDLER [C]
|
||||
select
|
||||
execute
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- status
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
Result := internal_authentication_required
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_authentication_required (b: like authentication_required)
|
||||
do
|
||||
internal_authentication_required := b
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_authentication_required: BOOLEAN
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,330 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_HANDLER [C -> REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
inherit
|
||||
REQUEST_HANDLER [C]
|
||||
|
||||
feature -- Access
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
-- Is authentication required
|
||||
-- might depend on the request environment
|
||||
-- or the associated resources
|
||||
deferred
|
||||
end
|
||||
|
||||
description: detachable STRING
|
||||
-- Optional description
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_description (s: like description)
|
||||
-- Set `description' to `s'
|
||||
do
|
||||
description := s
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
do
|
||||
if request_method_name_supported (req.request_method) then
|
||||
if authentication_required (req) and then not authenticated (ctx) then
|
||||
execute_unauthorized (ctx, req, res)
|
||||
else
|
||||
pre_execute (ctx, req, res)
|
||||
execute_application (ctx, req, res)
|
||||
post_execute (ctx, req, res)
|
||||
end
|
||||
else
|
||||
execute_request_method_not_allowed (req, res, supported_request_method_names)
|
||||
end
|
||||
rescue
|
||||
execute_rescue (ctx, req, res)
|
||||
end
|
||||
|
||||
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
deferred
|
||||
end
|
||||
|
||||
pre_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
end
|
||||
|
||||
post_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
end
|
||||
|
||||
execute_rescue (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
post_execute (ctx, req, res)
|
||||
rescue
|
||||
--| Just in case, the rescue is raising other exceptions ...
|
||||
end
|
||||
|
||||
execute_unauthorized (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
res.put_header ({HTTP_STATUS_CODE}.unauthorized, Void)
|
||||
res.put_string ("Unauthorized")
|
||||
end
|
||||
|
||||
feature -- Auth
|
||||
|
||||
authenticated (ctx: C): BOOLEAN
|
||||
-- Is authenticated?
|
||||
do
|
||||
--| To redefine if needed
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
supported_formats: INTEGER
|
||||
-- Support request format result such as json, xml, ...
|
||||
|
||||
feature {NONE} -- Status report
|
||||
|
||||
format_id_supported (a_id: INTEGER): BOOLEAN
|
||||
do
|
||||
Result := (supported_formats & a_id) = a_id
|
||||
end
|
||||
|
||||
format_name_supported (n: STRING): BOOLEAN
|
||||
-- Is format `n' supported?
|
||||
do
|
||||
Result := format_id_supported (format_constants.format_id (n))
|
||||
end
|
||||
|
||||
format_constants: HTTP_FORMAT_CONSTANTS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
supported_format_names: LIST [STRING]
|
||||
-- Supported format names ...
|
||||
do
|
||||
create {LINKED_LIST [STRING]} Result.make
|
||||
if format_json_supported then
|
||||
Result.extend (format_constants.json_name)
|
||||
end
|
||||
if format_xml_supported then
|
||||
Result.extend (format_constants.xml_name)
|
||||
end
|
||||
if format_text_supported then
|
||||
Result.extend (format_constants.text_name)
|
||||
end
|
||||
if format_html_supported then
|
||||
Result.extend (format_constants.html_name)
|
||||
end
|
||||
if format_rss_supported then
|
||||
Result.extend (format_constants.rss_name)
|
||||
end
|
||||
if format_atom_supported then
|
||||
Result.extend (format_constants.atom_name)
|
||||
end
|
||||
end
|
||||
|
||||
format_json_supported: BOOLEAN
|
||||
do
|
||||
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.json)
|
||||
end
|
||||
|
||||
format_xml_supported: BOOLEAN
|
||||
do
|
||||
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.xml)
|
||||
end
|
||||
|
||||
format_text_supported: BOOLEAN
|
||||
do
|
||||
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.text)
|
||||
end
|
||||
|
||||
format_html_supported: BOOLEAN
|
||||
do
|
||||
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.html)
|
||||
end
|
||||
|
||||
format_rss_supported: BOOLEAN
|
||||
do
|
||||
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.rss)
|
||||
end
|
||||
|
||||
format_atom_supported: BOOLEAN
|
||||
do
|
||||
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.atom)
|
||||
end
|
||||
|
||||
feature -- Element change: formats
|
||||
|
||||
reset_supported_formats
|
||||
do
|
||||
supported_formats := 0
|
||||
end
|
||||
|
||||
enable_format_json
|
||||
do
|
||||
enable_format ({HTTP_FORMAT_CONSTANTS}.json)
|
||||
end
|
||||
|
||||
enable_format_xml
|
||||
do
|
||||
enable_format ({HTTP_FORMAT_CONSTANTS}.xml)
|
||||
end
|
||||
|
||||
enable_format_text
|
||||
do
|
||||
enable_format ({HTTP_FORMAT_CONSTANTS}.text)
|
||||
end
|
||||
|
||||
enable_format_html
|
||||
do
|
||||
enable_format ({HTTP_FORMAT_CONSTANTS}.html)
|
||||
end
|
||||
|
||||
enable_format (f: INTEGER)
|
||||
do
|
||||
supported_formats := supported_formats | f
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
supported_request_methods: INTEGER
|
||||
-- Support request method such as GET, POST, ...
|
||||
|
||||
feature {NONE} -- Status report
|
||||
|
||||
request_method_id_supported (a_id: INTEGER): BOOLEAN
|
||||
do
|
||||
Result := (supported_request_methods & a_id) = a_id
|
||||
end
|
||||
|
||||
request_method_name_supported (n: STRING): BOOLEAN
|
||||
-- Is request method `n' supported?
|
||||
do
|
||||
Result := request_method_id_supported (request_method_constants.method_id (n))
|
||||
end
|
||||
|
||||
request_method_constants: HTTP_REQUEST_METHOD_CONSTANTS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
supported_request_method_names: LIST [STRING]
|
||||
-- Support request method such as GET, POST, ...
|
||||
do
|
||||
create {LINKED_LIST [STRING]} Result.make
|
||||
if method_get_supported then
|
||||
Result.extend (request_method_constants.method_get)
|
||||
end
|
||||
if method_post_supported then
|
||||
Result.extend (request_method_constants.method_post)
|
||||
end
|
||||
if method_put_supported then
|
||||
Result.extend (request_method_constants.method_put)
|
||||
end
|
||||
if method_patch_supported then
|
||||
Result.extend (request_method_constants.method_patch)
|
||||
end
|
||||
if method_delete_supported then
|
||||
Result.extend (request_method_constants.method_delete)
|
||||
end
|
||||
if method_head_supported then
|
||||
Result.extend (request_method_constants.method_head)
|
||||
end
|
||||
end
|
||||
|
||||
method_get_supported: BOOLEAN
|
||||
do
|
||||
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.get)
|
||||
end
|
||||
|
||||
method_post_supported: BOOLEAN
|
||||
do
|
||||
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.post)
|
||||
end
|
||||
|
||||
method_put_supported: BOOLEAN
|
||||
do
|
||||
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.put)
|
||||
end
|
||||
|
||||
method_patch_supported: BOOLEAN
|
||||
do
|
||||
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.patch)
|
||||
end
|
||||
|
||||
method_delete_supported: BOOLEAN
|
||||
do
|
||||
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.delete)
|
||||
end
|
||||
|
||||
method_head_supported: BOOLEAN
|
||||
do
|
||||
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.head)
|
||||
end
|
||||
|
||||
feature -- Element change: request methods
|
||||
|
||||
reset_supported_request_methods
|
||||
do
|
||||
supported_request_methods := 0
|
||||
end
|
||||
|
||||
enable_request_method_get
|
||||
do
|
||||
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.get)
|
||||
end
|
||||
|
||||
enable_request_method_post
|
||||
do
|
||||
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.post)
|
||||
end
|
||||
|
||||
enable_request_method_put
|
||||
do
|
||||
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.put)
|
||||
end
|
||||
|
||||
enable_request_method_patch
|
||||
do
|
||||
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.patch)
|
||||
end
|
||||
|
||||
enable_request_method_delete
|
||||
do
|
||||
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.delete)
|
||||
end
|
||||
|
||||
enable_request_method_head
|
||||
do
|
||||
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.head)
|
||||
end
|
||||
|
||||
enable_request_method (m: INTEGER)
|
||||
do
|
||||
supported_request_methods := supported_request_methods | m
|
||||
end
|
||||
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,131 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_HANDLER_CONTEXT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_HANDLER_CONTEXT
|
||||
|
||||
inherit
|
||||
REQUEST_HANDLER_CONTEXT
|
||||
|
||||
feature -- Accept: Content-Type
|
||||
|
||||
accepted_content_type: detachable READABLE_STRING_8
|
||||
do
|
||||
if internal_accepted_content_type = Void then
|
||||
get_accepted_content_type (Void)
|
||||
end
|
||||
Result := internal_accepted_content_type
|
||||
end
|
||||
|
||||
get_accepted_content_type (a_supported_content_types: detachable ARRAY [STRING_8])
|
||||
do
|
||||
if internal_accepted_content_type = Void then
|
||||
internal_accepted_content_type := request_accepted_content_type (a_supported_content_types)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Format name
|
||||
|
||||
accepted_format_name: detachable READABLE_STRING_8
|
||||
do
|
||||
if internal_accepted_format_name = Void then
|
||||
get_accepted_format_name (Void, Void)
|
||||
end
|
||||
Result := internal_accepted_format_name
|
||||
end
|
||||
|
||||
get_accepted_format_name (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [STRING_8])
|
||||
do
|
||||
if internal_accepted_format_name = Void then
|
||||
internal_accepted_format_name := request_accepted_format (a_format_variable_name, a_supported_content_types)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Format id
|
||||
|
||||
accepted_format_id: INTEGER
|
||||
do
|
||||
if internal_accepted_format_id = 0 then
|
||||
get_accepted_format_id (Void, Void)
|
||||
end
|
||||
Result := internal_accepted_format_id
|
||||
end
|
||||
|
||||
get_accepted_format_id (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [STRING_8])
|
||||
do
|
||||
if internal_accepted_format_id = 0 then
|
||||
internal_accepted_format_id := request_accepted_format_id (a_format_variable_name, a_supported_content_types)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Constants
|
||||
|
||||
Format_constants: HTTP_FORMAT_CONSTANTS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
feature -- Format
|
||||
|
||||
request_accepted_format (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [READABLE_STRING_8]): detachable READABLE_STRING_8
|
||||
-- Format id for the request based on {HTTP_FORMAT_CONSTANTS}
|
||||
do
|
||||
if a_format_variable_name /= Void and then attached string_parameter (a_format_variable_name) as ctx_format then
|
||||
Result := ctx_format.as_string_8
|
||||
else
|
||||
Result := request_format_from_content_type (request_accepted_content_type (a_supported_content_types))
|
||||
end
|
||||
end
|
||||
|
||||
request_accepted_format_id (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [READABLE_STRING_8]): INTEGER
|
||||
-- Format id for the request based on {HTTP_FORMAT_CONSTANTS}
|
||||
do
|
||||
if attached request_accepted_format (a_format_variable_name, a_supported_content_types) as l_format then
|
||||
Result := Format_constants.format_id (l_format)
|
||||
else
|
||||
Result := 0
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Format/Content type implementation
|
||||
|
||||
request_format_from_content_type (a_content_type: detachable READABLE_STRING_8): detachable READABLE_STRING_8
|
||||
-- `a_content_type' converted into a request format name
|
||||
do
|
||||
if a_content_type /= Void then
|
||||
if a_content_type.same_string ({HTTP_MIME_TYPES}.text_json) then
|
||||
Result := {HTTP_FORMAT_CONSTANTS}.json_name
|
||||
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.application_json) then
|
||||
Result := {HTTP_FORMAT_CONSTANTS}.json_name
|
||||
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.text_xml) then
|
||||
Result := {HTTP_FORMAT_CONSTANTS}.xml_name
|
||||
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.text_html) then
|
||||
Result := {HTTP_FORMAT_CONSTANTS}.html_name
|
||||
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.text_plain) then
|
||||
Result := {HTTP_FORMAT_CONSTANTS}.text_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Internal
|
||||
|
||||
internal_accepted_content_type: like accepted_content_type
|
||||
|
||||
internal_accepted_format_id: like accepted_format_id
|
||||
|
||||
internal_accepted_format_name: like accepted_format_name
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_ROUTER [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
inherit
|
||||
REQUEST_ROUTER [H, C]
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_SERVICE
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_HANDLER_CONTEXT], REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "Summary description for {REST_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_SERVICE_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
inherit
|
||||
ROUTED_SERVICE_I [H, C]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
feature -- Setup
|
||||
|
||||
router: REST_REQUEST_ROUTER [H, C]
|
||||
-- Request router
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_REQUEST_URI_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_URI_HANDLER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
|
||||
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
note
|
||||
description: "Summary description for {REQUEST_URI_HANDLER_CONTEXT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_HANDLER_CONTEXT
|
||||
|
||||
inherit
|
||||
REQUEST_URI_HANDLER_CONTEXT
|
||||
|
||||
REST_REQUEST_HANDLER_CONTEXT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_REQUEST_URI_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_ROUTER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
|
||||
redefine
|
||||
map_agent_with_request_methods
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Mapping
|
||||
|
||||
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||
local
|
||||
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
|
||||
do
|
||||
create h.make (a_action)
|
||||
map_with_request_methods (a_id, h, rqst_methods)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_URI_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_ROUTER_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_URI_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REQUEST_URI_ROUTER_I [H, C]
|
||||
|
||||
REST_REQUEST_ROUTER [H, C]
|
||||
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Mapping
|
||||
|
||||
-- map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: like {REST_REQUEST_AGENT_HANDLER}.action; rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||
-- do
|
||||
-- Precursor (a_id, a_action, rqst_methods)
|
||||
-- end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_REQUEST_URI_ROUTING_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_ROUTING_HANDLER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_ROUTING_HANDLER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Routing
|
||||
|
||||
router: REST_REQUEST_URI_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
note
|
||||
description: "Summary description for {REQUEST_ROUTING_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_ROUTING_HANDLER_I [H -> REST_REQUEST_HANDLER [C],
|
||||
C -> REST_REQUEST_URI_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REQUEST_URI_ROUTING_HANDLER_I [H, C]
|
||||
redefine
|
||||
router,
|
||||
execute
|
||||
end
|
||||
|
||||
REST_REQUEST_HANDLER [C]
|
||||
undefine
|
||||
execute
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Status report
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
Result := internal_authentication_required
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_authentication_required: BOOLEAN
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
Precursor {REQUEST_URI_ROUTING_HANDLER_I} (ctx, req, res)
|
||||
end
|
||||
|
||||
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
check should_not_occur: False end
|
||||
end
|
||||
|
||||
|
||||
feature {NONE} -- Routing
|
||||
|
||||
router: REST_REQUEST_URI_ROUTER_I [H, C]
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_URI_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_URI_SERVICE
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
feature -- Router
|
||||
|
||||
router: REST_REQUEST_URI_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_URI_TEMPLATE_HANDLER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
note
|
||||
description: "Summary description for {REQUEST_URI_TEMPLATE_HANDLER_CONTEXT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
|
||||
|
||||
inherit
|
||||
REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
|
||||
|
||||
REST_REQUEST_HANDLER_CONTEXT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
redefine
|
||||
map_agent_with_request_methods
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_base_url
|
||||
|
||||
feature -- Mapping
|
||||
|
||||
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||
local
|
||||
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
do
|
||||
create h.make (a_action)
|
||||
map_with_request_methods (a_id, h, rqst_methods)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_URI_TEMPLATE_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTER_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REQUEST_URI_TEMPLATE_ROUTER_I [H, C]
|
||||
|
||||
REST_REQUEST_ROUTER [H, C]
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_base_url
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_base_url
|
||||
|
||||
feature {NONE} -- Routing
|
||||
|
||||
router: REST_REQUEST_URI_TEMPLATE_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
note
|
||||
description: "Summary description for {REQUEST_ROUTING_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [H -> REST_REQUEST_HANDLER [C],
|
||||
C -> REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [H, C]
|
||||
redefine
|
||||
router,
|
||||
execute
|
||||
end
|
||||
|
||||
REST_REQUEST_HANDLER [C]
|
||||
undefine
|
||||
execute
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_base_url
|
||||
|
||||
feature -- Status report
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
Result := internal_authentication_required
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_authentication_required: BOOLEAN
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
pre_execute (ctx, req, res)
|
||||
Precursor {REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
|
||||
post_execute (ctx, req, res)
|
||||
end
|
||||
|
||||
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
check should_not_occur: False end
|
||||
end
|
||||
|
||||
feature {NONE} -- Routing
|
||||
|
||||
router: REST_REQUEST_URI_TEMPLATE_ROUTER_I [H, C]
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
note
|
||||
description: "Summary description for {DEFAULT_URI_TEMPLATE_REST_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_URI_TEMPLATE_SERVICE
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
feature -- Router
|
||||
|
||||
router: REST_REQUEST_URI_TEMPLATE_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
Options Indexes FollowSymLinks ExecCGI
|
||||
|
||||
<IfModule mod_fcgid.c>
|
||||
AddHandler fcgid-script .eapp
|
||||
FcgidWrapper c:/_dev/Dev-Process/web-framework/library/server/request/rest/tests/htdocs/../EIFGENs/rest_sample_cgi/W_code/sample.exe .eapp
|
||||
|
||||
</IfModule>
|
||||
|
||||
Options +ExecCGI
|
||||
AddHandler cgi-script exe
|
||||
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteBase /REST
|
||||
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} !=/favicon.ico
|
||||
RewriteRule ^(.*)$ sample.eapp/$1
|
||||
|
||||
# To let CGI app knows about HTTP_AUTHORIZATION
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||
|
||||
</IfModule>
|
||||
@@ -0,0 +1,31 @@
|
||||
= How to make this works with Apache =
|
||||
* In the apache's configuration file, be sure to add the following, or similar
|
||||
LoadModule fcgid_module modules/mod_fcgid.so
|
||||
<IfModule mod_fcgid.c>
|
||||
FcgidIdleTimeout 60
|
||||
FcgidBusyScanInterval 120
|
||||
FcgidProcessLifeTime 1600
|
||||
#7200
|
||||
FcgidMaxProcesses 5
|
||||
FcgidMaxProcessesPerClass 100
|
||||
FcgidMinProcessesPerClass 100
|
||||
FcgidConnectTimeout 8
|
||||
FcgidIOTimeout 3000
|
||||
FcgidBusyTimeout 3200
|
||||
FcgidMaxRequestLen 10000000
|
||||
FcgidPassHeader Authorization
|
||||
</IfModule>
|
||||
|
||||
|
||||
alias /REST/ "c:/_dev/Dev-Process/src/server/htdocs/"
|
||||
<directory "c:/_dev/Dev-Process/src/server/htdocs/">
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</directory>
|
||||
|
||||
* You can use <Location>, but then the AllowOverride All, should be somewhere else, since <Location> does not allow it.
|
||||
|
||||
* And then, check the .htaccess from this folder for additional settings (but required)
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="update_htdocs" default="menu">
|
||||
|
||||
<target name="menu">
|
||||
<echo message="1 - update_cgi_link" />
|
||||
<echo message="2 - update_htaccess" />
|
||||
<echo message="0 - quit" />
|
||||
<input message="Your choice :" variable="answer" defaultvalue="0" validargs="1,2,0" answer_required="true" />
|
||||
<geant target="update_cgi_link" if="$answer=1" />
|
||||
<geant target="update_htaccess" if="$answer=2" />
|
||||
</target>
|
||||
|
||||
<target name="update_cgi_link">
|
||||
<echo message="Update CGI link" />
|
||||
<exec executable="junction CGI ..\EIFGENs\rest_sample_cgi\W_code" accept_errors="true" exit_code_variable="return_code" dir="$cwd" />
|
||||
</target>
|
||||
|
||||
<target name="update_htaccess">
|
||||
<replace file="htaccess" to_file=".htaccess" token="##SAMPLE-CGI-DIR##" replace="$cwd/../EIFGENs/rest_sample_cgi/W_code" flags="g" />
|
||||
<replace file=".htaccess" to_file=".htaccess" token="\" replace="/" flags="g" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,26 @@
|
||||
Options Indexes FollowSymLinks ExecCGI
|
||||
|
||||
<IfModule mod_fcgid.c>
|
||||
AddHandler fcgid-script .eapp
|
||||
FcgidWrapper ##SAMPLE-CGI-DIR##/sample.exe .eapp
|
||||
|
||||
</IfModule>
|
||||
|
||||
Options +ExecCGI
|
||||
AddHandler cgi-script exe
|
||||
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteBase /REST
|
||||
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} !=/favicon.ico
|
||||
RewriteRule ^(.*)$ sample.eapp/$1
|
||||
|
||||
# To let CGI app knows about HTTP_AUTHORIZATION
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||
|
||||
</IfModule>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="common" uuid="4E02DF53-9DF0-44B6-B8A8-7554E0B94957">
|
||||
<target name="common">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option cat_call_detection="false" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="rest" location="..\rest-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="..\..\..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\..\..\..\library\protocol\http\http-safe.ecf" readonly="false"/>
|
||||
</target>
|
||||
<target name="sample_fcgi" extends="common">
|
||||
<root class="APP_SERVER" feature="make"/>
|
||||
<setting name="executable_name" value="sample"/>
|
||||
<library name="ewsgi_fcgi" location="..\..\..\..\..\..\library\server\ewsgi\connectors\libfcgi\libfcgi-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/gateway$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
<cluster name="gateway" location=".\src\gateway\fcgi\" recursive="true"/>
|
||||
</target>
|
||||
<target name="sample_cgi" extends="common">
|
||||
<root class="APP_SERVER" feature="make"/>
|
||||
<setting name="executable_name" value="sample"/>
|
||||
<library name="ewsgi_cgi" location="..\..\..\..\..\..\library\server\ewsgi\connectors\cgi\cgi-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/gateway$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
<cluster name="gateway" location=".\src\gateway\cgi\" recursive="true"/>
|
||||
|
||||
</target>
|
||||
<target name="sample_nino" extends="common">
|
||||
<root class="APP_SERVER" feature="make"/>
|
||||
<setting name="executable_name" value="sample"/>
|
||||
<library name="ewsgi_nino" location="..\..\..\..\..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/>
|
||||
<library name="default_nino" location="..\..\..\..\..\..\library\server\wsf\default\nino-safe.ecf" readonly="false"/>
|
||||
|
||||
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/gateway$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
<cluster name="gateway" location=".\src\gateway\nino\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,112 @@
|
||||
note
|
||||
description: "Summary description for {APP_ACCOUNT_VERIFY_CREDENTIAL}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_ACCOUNT_VERIFY_CREDENTIAL
|
||||
|
||||
inherit
|
||||
APP_REQUEST_HANDLER
|
||||
redefine
|
||||
initialize,
|
||||
execute_unauthorized
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
description := "Verify credentials"
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
enable_request_method_get
|
||||
enable_format_json
|
||||
enable_format_xml
|
||||
enable_format_text
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
Result := True
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_unauthorized (a_hdl_context: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
s: STRING
|
||||
lst: LIST [STRING]
|
||||
do
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
||||
res.put_header ({HTTP_STATUS_CODE}.unauthorized, <<["WWW-Authenticate", "Basic realm=%"My Silly demo auth, password must be the same as login such as foo:foo%""]>>)
|
||||
res.put_string ("Unauthorized")
|
||||
end
|
||||
|
||||
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
l_full: BOOLEAN
|
||||
h: HTTP_HEADER
|
||||
l_login: STRING_8
|
||||
s: STRING
|
||||
content_type_supported: ARRAY [STRING]
|
||||
l_format_id: INTEGER
|
||||
do
|
||||
content_type_supported := <<{HTTP_CONSTANTS}.application_json, {HTTP_CONSTANTS}.text_xml, {HTTP_CONSTANTS}.text_plain>>
|
||||
l_format_id := ctx.request_accepted_format_id ("format", content_type_supported)
|
||||
if authenticated (ctx) then
|
||||
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
|
||||
if attached authenticated_identifier (ctx) as log then
|
||||
l_login := log.as_string_8
|
||||
|
||||
create h.make
|
||||
|
||||
create s.make_empty
|
||||
inspect l_format_id
|
||||
when {HTTP_FORMAT_CONSTANTS}.json then
|
||||
h.put_content_type_text_plain
|
||||
s.append_string ("{ %"login%": %"" + l_login + "%" }%N")
|
||||
when {HTTP_FORMAT_CONSTANTS}.xml then
|
||||
h.put_content_type_text_xml
|
||||
s.append_string ("<login>" + l_login + "</login>%N")
|
||||
when {HTTP_FORMAT_CONSTANTS}.text then -- Default
|
||||
h.put_content_type_text_plain
|
||||
s.append_string ("login: " + l_login + "%N")
|
||||
else
|
||||
execute_content_type_not_allowed (req, res, content_type_supported,
|
||||
<<{HTTP_FORMAT_CONSTANTS}.json_name, {HTTP_FORMAT_CONSTANTS}.html_name, {HTTP_FORMAT_CONSTANTS}.xml_name, {HTTP_FORMAT_CONSTANTS}.text_name>>
|
||||
)
|
||||
end
|
||||
if not s.is_empty then
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (s)
|
||||
end
|
||||
else
|
||||
send_error (ctx.path, 0, "User/password unknown", Void, ctx, req, res)
|
||||
end
|
||||
else
|
||||
send_error (ctx.path, 0, "Authentication rejected", Void, ctx, req, res)
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,97 @@
|
||||
note
|
||||
description: "Summary description for {APP_TEST}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_TEST
|
||||
|
||||
inherit
|
||||
APP_REQUEST_HANDLER
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
description := "Return a simple test output "
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
enable_request_method_get
|
||||
enable_format_text
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
local
|
||||
s: STRING
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
|
||||
create s.make_empty
|
||||
s.append_string ("test")
|
||||
if attached {WSF_STRING} req.meta_variable ("REQUEST_COUNT") as l_request_count_val then
|
||||
s.append_string ("(request_count="+ l_request_count_val.string +")%N")
|
||||
end
|
||||
|
||||
-- ctx.request_format_id ("format", Void)
|
||||
|
||||
if attached ctx.request_accepted_format ("format", Void) as l_format then
|
||||
s.append_string (" format=" + l_format + "%N")
|
||||
end
|
||||
|
||||
if attached ctx.string_parameter ("op") as l_op then
|
||||
s.append_string (" op=" + l_op)
|
||||
if l_op.same_string ("crash") then
|
||||
(create {DEVELOPER_EXCEPTION}).raise
|
||||
elseif l_op.starts_with ("env") then
|
||||
s.append_string ("%N%NAll variables:")
|
||||
s.append (wgi_value_iteration_to_string (req.items, False))
|
||||
s.append_string ("<br/>script_url(%"" + req.path_info + "%")=" + ctx.script_url (req.path_info) + "%N")
|
||||
-- if attached ctx.http_authorization_login_password as t then
|
||||
-- s.append_string ("Check login=" + t.login + "<br/>%N")
|
||||
-- end
|
||||
if authenticated (ctx) and then attached authenticated_identifier (ctx) as l_login then
|
||||
s.append_string ("Authenticated: login=" + l_login.as_string_8 + "<br/>%N")
|
||||
end
|
||||
end
|
||||
else
|
||||
s.append ("%N Try " + ctx.script_absolute_url (req.path_info + "?op=env") + " to display all variables%N")
|
||||
s.append ("%N Try " + ctx.script_absolute_url (req.path_info + "?op=crash") + " to demonstrate exception trace%N")
|
||||
end
|
||||
|
||||
res.set_status_code (200)
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (s)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,150 @@
|
||||
note
|
||||
description: "Summary description for {APP_SERVER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_SERVER
|
||||
|
||||
inherit
|
||||
APP_SERVICE
|
||||
redefine
|
||||
execute
|
||||
end
|
||||
|
||||
REST_SERVICE_GATEWAY
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
initialize_router
|
||||
build_gateway_and_launch
|
||||
end
|
||||
|
||||
feature {NONE} -- Handlers
|
||||
|
||||
create_router
|
||||
-- Create `router'
|
||||
do
|
||||
create router.make (5)
|
||||
end
|
||||
|
||||
setup_router
|
||||
local
|
||||
h: APP_REQUEST_HANDLER
|
||||
rah: APP_REQUEST_AGENT_HANDLER
|
||||
gh: APP_REQUEST_ROUTING_HANDLER
|
||||
do
|
||||
create {APP_ACCOUNT_VERIFY_CREDENTIAL} h.make
|
||||
router.map ("/account/verify_credentials", h)
|
||||
router.map ("/account/verify_credentials.{format}", h)
|
||||
|
||||
|
||||
create {APP_TEST} h.make
|
||||
|
||||
create gh.make (4)
|
||||
router.map ("/test", gh)
|
||||
gh.map_default (h)
|
||||
-- gh.map ("/test", h)
|
||||
gh.map ("/test/{op}", h)
|
||||
gh.map ("/test.{format}", h)
|
||||
gh.map ("/test.{format}/{op}", h)
|
||||
|
||||
|
||||
create rah.make (agent execute_exit_application)
|
||||
h := rah
|
||||
h.set_description ("tell the REST server to exit (in FCGI context, this is used to reload the FCGI server)")
|
||||
h.enable_request_method_get
|
||||
h.enable_format_text
|
||||
router.map ("/debug/exit", h)
|
||||
router.map ("/debug/exit.{format}", h)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
request_count := request_count + 1
|
||||
Precursor (req, res)
|
||||
end
|
||||
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
rqst_uri: detachable STRING
|
||||
l_path_info: detachable STRING
|
||||
h: HTTP_HEADER
|
||||
s: STRING
|
||||
l_redir_url: STRING
|
||||
do
|
||||
create h.make
|
||||
-- h.put_refresh (ctx.script_url ("/doc"), 2)
|
||||
l_redir_url := "/doc"
|
||||
h.put_refresh (l_redir_url, 2)
|
||||
h.put_content_type_text_html
|
||||
create s.make_empty
|
||||
s := "Request [" + req.path_info + "] is not available. <br/>%N";
|
||||
s.append ("You are being redirected to <a href=%"" + l_redir_url + "%">/doc</a> in 2 seconds ...%N")
|
||||
h.put_content_length (s.count)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.temp_redirect)
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (s)
|
||||
end
|
||||
|
||||
request_count: INTEGER
|
||||
|
||||
-- execute_rescue (ctx: like new_request_context)
|
||||
-- -- Execute the default rescue behavior
|
||||
-- do
|
||||
-- execute_exception_trace (ctx)
|
||||
-- end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
-- execute_exception_trace (ctx: like new_request_context)
|
||||
-- local
|
||||
-- h: HTTP_HEADER
|
||||
-- s: STRING
|
||||
-- do
|
||||
-- create h.make
|
||||
-- h.put_content_type_text_plain
|
||||
-- ctx.output.put_string (h.string)
|
||||
-- ctx.output.put_string ("Error occurred .. rq="+ request_count.out +"%N")
|
||||
|
||||
-- if attached (create {EXCEPTIONS}).exception_trace as l_trace then
|
||||
-- ctx.output.put_string ("<pre>" + l_trace + "</pre>")
|
||||
-- end
|
||||
-- h.recycle
|
||||
-- exit_with_code (-1)
|
||||
-- end
|
||||
|
||||
execute_exit_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
res.set_status_code (200)
|
||||
res.put_header (200, <<["Content-Type", "text/html"]>>)
|
||||
|
||||
create s.make_empty
|
||||
s.append_string ("Exited")
|
||||
s.append_string (" <a href=%"" + ctx.script_url ("/") + "%">start again</a>%N")
|
||||
res.put_string (s)
|
||||
exit_with_code (0)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
deferred class
|
||||
REST_SERVICE_GATEWAY
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Access
|
||||
|
||||
build_gateway_and_launch
|
||||
local
|
||||
cgi: WGI_CGI_CONNECTOR
|
||||
do
|
||||
create cgi.make (Current)
|
||||
cgi.launch
|
||||
end
|
||||
|
||||
gateway_name: STRING = "CGI"
|
||||
|
||||
exit_with_code (a_code: INTEGER)
|
||||
do
|
||||
(create {EXCEPTIONS}).die (a_code)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,35 @@
|
||||
deferred class
|
||||
REST_SERVICE_GATEWAY
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Access
|
||||
|
||||
build_gateway_and_launch
|
||||
local
|
||||
libfcgi: WGI_LIBFCGI_CONNECTOR
|
||||
do
|
||||
create libfcgi.make (Current)
|
||||
libfcgi.launch
|
||||
end
|
||||
|
||||
gateway_name: STRING = "libFCGI"
|
||||
|
||||
exit_with_code (a_code: INTEGER)
|
||||
do
|
||||
(create {EXCEPTIONS}).die (a_code)
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
deferred class
|
||||
REST_SERVICE_GATEWAY
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Access
|
||||
|
||||
build_gateway_and_launch
|
||||
local
|
||||
app: NINO_SERVICE
|
||||
port_number: INTEGER
|
||||
base_url: STRING
|
||||
do
|
||||
port_number := 8080
|
||||
base_url := ""
|
||||
debug ("nino")
|
||||
print ("Example: start a Nino web server on port " + port_number.out +
|
||||
", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N")
|
||||
end
|
||||
create app.make_custom (agent wgi_execute, base_url)
|
||||
app.force_single_threaded
|
||||
|
||||
app.listen (port_number)
|
||||
end
|
||||
|
||||
gateway_name: STRING = "NINO"
|
||||
|
||||
exit_with_code (a_code: INTEGER)
|
||||
do
|
||||
(create {EXCEPTIONS}).die (a_code)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,35 @@
|
||||
note
|
||||
description: "Summary description for REST_REQUEST_AGENT_HANDLER."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_REQUEST_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
APP_REQUEST_HANDLER
|
||||
undefine
|
||||
execute, pre_execute, post_execute
|
||||
end
|
||||
|
||||
REST_REQUEST_AGENT_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
|
||||
undefine
|
||||
authenticated
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
deferred class
|
||||
APP_REQUEST_HANDLER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
|
||||
redefine
|
||||
authenticated
|
||||
end
|
||||
|
||||
APP_REQUEST_HELPER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
-- Initialize various attributes
|
||||
do
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
wgi_value_iteration_to_string (v: ITERABLE [WSF_VALUE]; using_pre: BOOLEAN): STRING_8
|
||||
do
|
||||
create Result.make (100)
|
||||
if using_pre then
|
||||
Result.append ("<pre>")
|
||||
end
|
||||
across
|
||||
v as cur
|
||||
loop
|
||||
Result.append_string (cur.item.name.as_string_8 + " = " + cur.item.string_representation.as_string_8 + "%N")
|
||||
end
|
||||
if using_pre then
|
||||
Result.append ("</pre>")
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Auth
|
||||
|
||||
authenticated (ctx: APP_REQUEST_HANDLER_CONTEXT): BOOLEAN
|
||||
-- Is authenticated?
|
||||
do
|
||||
--| To redefine if needed
|
||||
if attached ctx.request.http_authorization as l_http_authorization then
|
||||
Result := True
|
||||
end
|
||||
end
|
||||
|
||||
authenticated_identifier (ctx: APP_REQUEST_HANDLER_CONTEXT): detachable READABLE_STRING_32
|
||||
do
|
||||
if attached ctx.request.http_authorization as l_http_authorization then
|
||||
Result := "foo" -- Implement it as you want
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
format_id (s: detachable STRING): INTEGER
|
||||
do
|
||||
Result := {HTTP_FORMAT_CONSTANTS}.text
|
||||
if s /= Void then
|
||||
Result := format_constants.format_id (s)
|
||||
end
|
||||
end
|
||||
|
||||
exit_with_code (a_code: INTEGER)
|
||||
do
|
||||
(create {EXCEPTIONS}).die (a_code)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
APP_REQUEST_HANDLER_CONTEXT
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,101 @@
|
||||
note
|
||||
description: "Summary description for {APP_REQUEST_HELPER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
APP_REQUEST_HELPER
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
send_error (a_path: STRING; a_error_id: INTEGER; a_error_name: STRING; a_error_message: detachable STRING; ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
s: STRING
|
||||
i,nb: INTEGER
|
||||
rep_data: REST_RESPONSE
|
||||
do
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.expectation_failed)
|
||||
create rep_data.make (a_path)
|
||||
rep_data.headers.put_content_type_text_plain
|
||||
|
||||
create s.make_empty
|
||||
inspect ctx.accepted_format_id
|
||||
when {HTTP_FORMAT_CONSTANTS}.json then
|
||||
rep_data.headers.put_content_type_text_plain
|
||||
s := "{%"application%": %"" + a_path + "%""
|
||||
s.append_string (", %"error%": {")
|
||||
s.append_string ("%"id%": " + a_error_id.out)
|
||||
s.append_string (",%"name%": %"" + a_error_name + "%"")
|
||||
if a_error_message /= Void then
|
||||
s.append_string (",%"message%": %"")
|
||||
|
||||
if a_error_message.has ('%N') then
|
||||
from
|
||||
i := s.count
|
||||
s.append_string (a_error_message)
|
||||
nb := s.count
|
||||
until
|
||||
i > nb
|
||||
loop
|
||||
inspect s[i]
|
||||
when '%R' then
|
||||
if s.valid_index (i+1) and then s[i+1] = '%N' then
|
||||
s[i] := '\'
|
||||
s[i+1] := 'n'
|
||||
i := i + 1
|
||||
end
|
||||
when '%N' then
|
||||
s.insert_character ('\', i)
|
||||
s[i] := 'n'
|
||||
else
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
else
|
||||
s.append_string (a_error_message)
|
||||
end
|
||||
s.append_string ("%"")
|
||||
end
|
||||
|
||||
s.append_string ("}") -- end error
|
||||
s.append_string ("}") -- end global object
|
||||
rep_data.set_message (s)
|
||||
when {HTTP_FORMAT_CONSTANTS}.xml then
|
||||
rep_data.headers.put_content_type_text_xml
|
||||
s := "<application path=%"" + a_path + "%"><error id=%"" + a_error_id.out + "%" name=%""+ a_error_name +"%">"
|
||||
if a_error_message /= Void then
|
||||
s.append_string (a_error_message)
|
||||
end
|
||||
s.append_string ("</error></application>")
|
||||
rep_data.set_message (s)
|
||||
when {HTTP_FORMAT_CONSTANTS}.html then
|
||||
rep_data.headers.put_content_type_text_html
|
||||
s := "<strong>application</strong>: " + a_path + "<br/>%N<strong>Error</strong> (" + a_error_id.out + ") %"" + a_error_name + "%"<br/>%N"
|
||||
if a_error_message /= Void then
|
||||
s.append_string ("<blockquote>" + a_error_message + "</blockquote>")
|
||||
end
|
||||
rep_data.set_message (s)
|
||||
when {HTTP_FORMAT_CONSTANTS}.text then -- Default
|
||||
s := "Application: " + a_path + "<br/>%N"
|
||||
s.append_string ("Error (" + a_error_id.out + ") %"" + a_error_name + "%"%N")
|
||||
if a_error_message /= Void then
|
||||
s.append_string ("%T" + a_error_message + "%N")
|
||||
end
|
||||
rep_data.set_message (s)
|
||||
end
|
||||
rep_data.send (res)
|
||||
rep_data.recycle
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_URI_TEMPLATE_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_REQUEST_ROUTER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_base_url
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
note
|
||||
description: "Summary description for {APP_REQUEST_ROUTING_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_REQUEST_ROUTING_HANDLER
|
||||
|
||||
inherit
|
||||
APP_REQUEST_HANDLER
|
||||
undefine
|
||||
execute
|
||||
end
|
||||
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
|
||||
undefine
|
||||
authenticated,
|
||||
pre_execute,
|
||||
post_execute
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Routing
|
||||
|
||||
router: APP_REQUEST_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
note
|
||||
description: "Summary description for {APP_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
APP_SERVICE
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
|
||||
feature {NONE} -- Router
|
||||
|
||||
router: APP_REQUEST_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
Support for various text filters such as
|
||||
|
||||
* [wikitext](http://en.wikipedia.org/wiki/Wiki_markup)
|
||||
* [Markdown](http://en.wikipedia.org/wiki/Markdown)
|
||||
* ...
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -0,0 +1,7 @@
|
||||
We could add libraries for template engines such as
|
||||
|
||||
* [Velocity](http://en.wikipedia.org/wiki/Apache_Velocity)
|
||||
* [Smarty](http://en.wikipedia.org/wiki/Smarty)
|
||||
* ...
|
||||
|
||||
Anyone wanting to contribute is welcome
|
||||
@@ -1,38 +0,0 @@
|
||||
note
|
||||
description : "nino application root class"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
inherit
|
||||
ARGUMENTS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Run application.
|
||||
local
|
||||
l_server : HTTP_SERVER
|
||||
l_cfg: HTTP_SERVER_CONFIGURATION
|
||||
l_http_handler : HTTP_HANDLER
|
||||
do
|
||||
create l_cfg.make
|
||||
l_cfg.http_server_port := 9_000
|
||||
l_cfg.document_root := default_document_root
|
||||
|
||||
create l_server.make (l_cfg)
|
||||
create {APPLICATION_CONNECTION_HANDLER} l_http_handler.make (l_server, "HTTP_HANDLER")
|
||||
l_server.setup (l_http_handler)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
default_document_root: STRING = "webroot"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {HTTP_CONNECTION_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APPLICATION_CONNECTION_HANDLER
|
||||
|
||||
inherit
|
||||
HTTP_CONNECTION_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Request processing
|
||||
|
||||
process_request (a_handler: HTTP_CONNECTION_HANDLER; a_input: HTTP_INPUT_STREAM; a_output: HTTP_OUTPUT_STREAM)
|
||||
-- Process request ...
|
||||
local
|
||||
a_method: STRING
|
||||
do
|
||||
a_method := a_handler.method
|
||||
|
||||
if a_method.is_equal (Get) then
|
||||
execute_get_request (a_handler.uri, a_handler.request_header_map, a_handler.request_header, a_input, a_output)
|
||||
elseif a_method.is_equal (Post) then
|
||||
execute_post_request (a_handler.uri, a_handler.request_header_map, a_handler.request_header, a_input, a_output)
|
||||
elseif a_method.is_equal (Put) then
|
||||
elseif a_method.is_equal (Options) then
|
||||
elseif a_method.is_equal (Head) then
|
||||
elseif a_method.is_equal (Delete) then
|
||||
elseif a_method.is_equal (Trace) then
|
||||
elseif a_method.is_equal (Connect) then
|
||||
else
|
||||
debug
|
||||
print ("Method [" + a_method + "] not supported")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
execute_get_request (a_uri: STRING; a_headers_map: HASH_TABLE [STRING, STRING]; a_headers_text: STRING; a_input: HTTP_INPUT_STREAM; a_output: HTTP_OUTPUT_STREAM)
|
||||
local
|
||||
l_http_request : HTTP_REQUEST_HANDLER
|
||||
do
|
||||
create {GET_REQUEST_HANDLER} l_http_request.make (a_input, a_output)
|
||||
l_http_request.set_uri (a_uri)
|
||||
l_http_request.process
|
||||
end
|
||||
|
||||
execute_post_request (a_uri: STRING; a_headers_map: HASH_TABLE [STRING, STRING]; a_headers_text: STRING; a_input: HTTP_INPUT_STREAM; a_output: HTTP_OUTPUT_STREAM)
|
||||
local
|
||||
l_http_request : HTTP_REQUEST_HANDLER
|
||||
do
|
||||
check not_yet_implemented: False end
|
||||
create {POST_REQUEST_HANDLER} l_http_request.make (a_input, a_output)
|
||||
l_http_request.set_uri (a_uri)
|
||||
l_http_request.process
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,175 +0,0 @@
|
||||
class
|
||||
GET_REQUEST_HANDLER
|
||||
|
||||
inherit
|
||||
HTTP_REQUEST_HANDLER
|
||||
|
||||
HTTP_SERVER_SHARED_CONFIGURATION
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
SHARED_URI_CONTENTS_TYPES
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
HTTP_CONSTANTS
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_input: like input; a_output: like output)
|
||||
do
|
||||
default_create
|
||||
input := a_input
|
||||
output := a_output
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
input: HTTP_INPUT_STREAM
|
||||
|
||||
output: HTTP_OUTPUT_STREAM
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- process the request and create an answer
|
||||
local
|
||||
fname: STRING_8
|
||||
f: RAW_FILE
|
||||
ctype, extension: detachable STRING_8
|
||||
do
|
||||
answer.reset
|
||||
if script_name.is_equal ("/") then
|
||||
process_default
|
||||
answer.set_content_type ("text/html")
|
||||
else
|
||||
create fname.make_from_string (Document_root)
|
||||
fname.append (script_name)
|
||||
debug
|
||||
print ("URI filename: " + fname)
|
||||
end
|
||||
create f.make (real_filename (fname))
|
||||
if f.exists then
|
||||
extension := Ct_table.extension (script_name)
|
||||
ctype := Ct_table.content_types.item (extension)
|
||||
if f.is_directory then
|
||||
process_directory (f)
|
||||
else
|
||||
if ctype = Void then
|
||||
process_raw_file (f)
|
||||
answer.set_content_type ("text/html")
|
||||
else
|
||||
if ctype.is_equal ("text/html") then
|
||||
process_text_file (f)
|
||||
else
|
||||
process_raw_file (f)
|
||||
end
|
||||
answer.set_content_type (ctype)
|
||||
end
|
||||
end
|
||||
else
|
||||
answer.set_status_code (Not_found)
|
||||
answer.set_reason_phrase (Not_found_message)
|
||||
answer.set_reply_text ("Not found on this server")
|
||||
end
|
||||
end
|
||||
if attached answer.reply_text as t then
|
||||
answer.set_content_length (t.count)
|
||||
else
|
||||
answer.set_content_length (0)
|
||||
end
|
||||
|
||||
--| Output the result
|
||||
output.put_string (answer.reply_header + answer.reply_text)
|
||||
end
|
||||
|
||||
process_default
|
||||
-- Return a default response
|
||||
local
|
||||
html: STRING_8
|
||||
do
|
||||
answer.set_reply_text ("")
|
||||
html := " <html> <head> <title> NINO HTTPD </title> " + " </head> " + " <body> " + " <h1> Welcome to NINO HTTPD! </h1> " + " <p> Default page " + " </p> " + " </body> " + " </html> "
|
||||
answer.append_reply_text (html)
|
||||
end
|
||||
|
||||
process_text_file (f: FILE)
|
||||
-- send a text file reply
|
||||
require
|
||||
valid_f: f /= Void
|
||||
do
|
||||
f.open_read
|
||||
from
|
||||
answer.set_reply_text ("")
|
||||
f.read_line
|
||||
until
|
||||
f.end_of_file
|
||||
loop
|
||||
answer.append_reply_text (f.last_string)
|
||||
answer.append_reply_text (Crlf)
|
||||
f.read_line
|
||||
end
|
||||
f.close
|
||||
end
|
||||
|
||||
process_raw_file (f: FILE)
|
||||
-- send a raw file reply
|
||||
require
|
||||
valid_f: f /= Void
|
||||
do
|
||||
f.open_read
|
||||
from
|
||||
answer.set_reply_text ("")
|
||||
until
|
||||
f.end_of_file
|
||||
loop
|
||||
f.read_stream_thread_aware (1024)
|
||||
answer.append_reply_text (f.last_string)
|
||||
end
|
||||
f.close
|
||||
end
|
||||
|
||||
process_directory (f: FILE)
|
||||
--read the directory
|
||||
require
|
||||
is_directory: f.is_directory
|
||||
local
|
||||
l_dir: DIRECTORY
|
||||
files: ARRAYED_LIST [STRING_8]
|
||||
html1: STRING_8
|
||||
html2: STRING_8
|
||||
htmldir: STRING_8
|
||||
path: STRING_8
|
||||
do
|
||||
answer.set_reply_text ("")
|
||||
html1 := " <html> <head> <title> NINO HTTPD </title> " + " </head> " + " <body> " + " <h1> Welcome to NINO HTTPD! </h1> " + " <p> Default page "
|
||||
html2 := " </p> " + " </body> " + " </html> "
|
||||
path := script_name
|
||||
if path[path.count] = '/' then
|
||||
path.remove_tail (1)
|
||||
end
|
||||
create l_dir.make_open_read (f.name)
|
||||
files := l_dir.linear_representation
|
||||
from
|
||||
files.start
|
||||
htmldir := "<ul>"
|
||||
until
|
||||
files.after
|
||||
loop
|
||||
htmldir := htmldir + "<li><a href=%"" + path + "/" + files.item_for_iteration + "%">" + files.item_for_iteration + "</a> </li>%N"
|
||||
files.forth
|
||||
end
|
||||
htmldir := htmldir + "</ul>"
|
||||
answer.append_reply_text (html1 + htmldir + html2)
|
||||
end
|
||||
|
||||
end -- class GET_REQUEST_HANDLER
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {HEAD_REQUEST_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HEAD_REQUEST_HANDLER
|
||||
|
||||
inherit
|
||||
|
||||
SHARED_DOCUMENT_ROOT
|
||||
|
||||
SHARED_URI_CONTENTS_TYPES
|
||||
|
||||
HTTP_REQUEST_HANDLER
|
||||
|
||||
HTTP_CONSTANTS
|
||||
|
||||
feature
|
||||
|
||||
|
||||
process
|
||||
-- process the request and create an answer
|
||||
local
|
||||
fname: STRING
|
||||
f: RAW_FILE
|
||||
ctype, extension: STRING
|
||||
do
|
||||
fname := document_root_cell.item.twin
|
||||
fname.append (request_uri)
|
||||
debug
|
||||
print ("URI name: " + fname )
|
||||
end
|
||||
create f.make (fname)
|
||||
create answer.make
|
||||
if f.exists then
|
||||
extension := ct_table.extension (request_uri)
|
||||
ctype := ct_table.content_types.item (extension)
|
||||
-- TODO: This code could be improved to avoid string
|
||||
-- comparisons
|
||||
if ctype = Void then
|
||||
process_default
|
||||
answer.set_content_type ("text/html")
|
||||
else
|
||||
if ctype.is_equal ("text/html") then
|
||||
process_text_file (f)
|
||||
else
|
||||
process_raw_file (f)
|
||||
end
|
||||
answer.set_content_type (ctype)
|
||||
end
|
||||
else
|
||||
answer.set_status_code (not_found)
|
||||
answer.set_reason_phrase (not_found_message)
|
||||
answer.set_reply_text ("Not found on this server%N%R")
|
||||
end
|
||||
end
|
||||
|
||||
process_default
|
||||
--
|
||||
local
|
||||
html : STRING
|
||||
do
|
||||
answer.set_reply_text ("")
|
||||
html := " <html> <head> <title> Micro HTTPD </title> " +
|
||||
" </head> " +
|
||||
" <body> " +
|
||||
" <h1> Welcome to Micro HTTPD! </h1> "+
|
||||
" <p> Default page " +
|
||||
|
||||
" </p> " +
|
||||
" </body> " +
|
||||
" </html> "
|
||||
answer.append_reply_text (html)
|
||||
end
|
||||
|
||||
|
||||
process_text_file (f: FILE)
|
||||
-- send a text file reply
|
||||
require
|
||||
valid_f: f /= Void
|
||||
do
|
||||
f.open_read
|
||||
from
|
||||
answer.set_reply_text ("")
|
||||
f.read_line
|
||||
until f.end_of_file
|
||||
loop
|
||||
answer.append_reply_text (f.last_string)
|
||||
answer.append_reply_text (crlf)
|
||||
f.read_line
|
||||
end
|
||||
f.close
|
||||
end
|
||||
|
||||
process_raw_file (f: FILE)
|
||||
-- send a raw file reply
|
||||
require
|
||||
valid_f: f /= Void
|
||||
do
|
||||
-- this is not quite right....
|
||||
f.open_read
|
||||
from
|
||||
answer.set_reply_text ("")
|
||||
until f.end_of_file
|
||||
loop
|
||||
f.read_stream (1024)
|
||||
answer.append_reply_text (f.last_string)
|
||||
end
|
||||
f.close
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,42 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {POST_REQUEST_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
POST_REQUEST_HANDLER
|
||||
|
||||
inherit
|
||||
GET_REQUEST_HANDLER
|
||||
redefine
|
||||
process
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- process the request and create an answer
|
||||
local
|
||||
l_data: STRING
|
||||
s: STRING
|
||||
n: INTEGER
|
||||
do
|
||||
from
|
||||
n := 1_024
|
||||
input.read_stream (n)
|
||||
s := input.last_string
|
||||
create l_data.make_empty
|
||||
until
|
||||
s.count < n
|
||||
loop
|
||||
l_data.append_string (s)
|
||||
input.read_stream (n)
|
||||
end
|
||||
Precursor
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="web_server" uuid="B1D3254D-A58E-4259-9796-8A2843A511A9">
|
||||
<target name="web_server">
|
||||
<root class="APPLICATION" feature="make"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/.git$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" is_attached_by_default="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||
<library name="nino" location="../../nino-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="web_server" uuid="B1D3254D-A58E-4259-9796-8A2843A511A9">
|
||||
<target name="web_server">
|
||||
<root class="APPLICATION" feature="make"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" is_attached_by_default="true" void_safety="none">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
|
||||
<library name="nino" location="..\..\nino.ecf"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 578 B |
@@ -1,91 +0,0 @@
|
||||
1.4.2
|
||||
[Feature]
|
||||
- The plugin support percentages as target ('50%' or {top:'50%', left:'45%'})
|
||||
- Exposed the max() calculation as $.scrollTo.max
|
||||
[Enhancement]
|
||||
- Renamed $.fn.scrollable to $.fn._scrollable to avoid conflicts with other plugins
|
||||
[Fix]
|
||||
- Fixing max calculations for regular DOM elements
|
||||
|
||||
1.4.1
|
||||
[Feature]
|
||||
- The target can be 'max' to scroll to the end while keeping it elegant.
|
||||
[Enhancement]
|
||||
- Default duration is 0 for jquery +1.3. Means sync animation
|
||||
- The plugin works on all major browsers, on compat & quirks modes, including iframes.
|
||||
- In addition to window/document, if html or body are received, the plugin will choose the right one.
|
||||
[Fix]
|
||||
- The plugin accepts floating numbers, Thanks Ramin
|
||||
- Using jQuery.nodeName where neccessary so that this works on xml+xhtml
|
||||
- The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
|
||||
|
||||
1.4
|
||||
[Fix]
|
||||
- Fixed the problem when scrolling the window to absolute positioned elements on Safari.
|
||||
- Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
|
||||
[Feature]
|
||||
- Added the settings object as 2nd argument to the onAfter callback.
|
||||
- The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
|
||||
- Added full support for iframes (even max scroll calculation).
|
||||
- Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
|
||||
- Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
|
||||
[Enhancement]
|
||||
- Cleaned the code a bit, specially the comments
|
||||
|
||||
1.3.3
|
||||
[Change]
|
||||
- Changed the licensing from GPL to GPL+MIT.
|
||||
|
||||
1.3.2
|
||||
[Enhancement]
|
||||
- Small improvements to make the code shorter.
|
||||
[Change]
|
||||
- Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
|
||||
|
||||
1.3.1
|
||||
[Feature]
|
||||
- Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
|
||||
- Added option 'over'.
|
||||
[Enhancement]
|
||||
- Made the code as short as possible.
|
||||
[Change]
|
||||
- Changed the arguments received by onAfter
|
||||
|
||||
1.3
|
||||
[Enhancement]
|
||||
- Added semicolon to the start, for safe file concatenation
|
||||
- Added a limit check, values below 0 or over the maximum are fixed.
|
||||
- Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
|
||||
[Fix]
|
||||
- Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
|
||||
- The border is also reduced, when 'margin' is set to true.
|
||||
[Change]
|
||||
- The option speed has been renamed to duration.
|
||||
[Feature]
|
||||
- The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
|
||||
- Remade the demo
|
||||
|
||||
1.2.4
|
||||
[Enhancement]
|
||||
- The target can be in the form of { top:x, left:y } allowing different position for each axis.
|
||||
[Feature]
|
||||
- The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
|
||||
|
||||
1.2.3
|
||||
[Feature]
|
||||
- Exposed the defaults.
|
||||
[Enhancement]
|
||||
- Made the callback functions receive more parameters.
|
||||
|
||||
1.2.2
|
||||
[Fix]
|
||||
- Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
|
||||
|
||||
1.2
|
||||
[Change]
|
||||
- The option 'onafter' is now called 'onAfter'.
|
||||
[Feature]
|
||||
- Two axes can be scrolled together, this is set with the option 'axis'.
|
||||
- In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
|
||||
- There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
|
||||
- If the option 'margin' is set to true, the plugin will take in account, the margin of the target(no use if target is a value).
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* jQuery.ScrollTo - Easy element scrolling using jQuery.
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 5/25/2009
|
||||
* @author Ariel Flesler
|
||||
* @version 1.4.2
|
||||
*
|
||||
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
||||
*/
|
||||
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
|
||||
@@ -1,215 +0,0 @@
|
||||
/**
|
||||
* jQuery.ScrollTo
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 5/25/2009
|
||||
*
|
||||
* @projectDescription Easy element scrolling using jQuery.
|
||||
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
||||
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
|
||||
*
|
||||
* @author Ariel Flesler
|
||||
* @version 1.4.2
|
||||
*
|
||||
* @id jQuery.scrollTo
|
||||
* @id jQuery.fn.scrollTo
|
||||
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
|
||||
* The different options for target are:
|
||||
* - A number position (will be applied to all axes).
|
||||
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
|
||||
* - A jQuery/DOM element ( logically, child of the element to scroll )
|
||||
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
|
||||
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
|
||||
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
|
||||
* - The string 'max' for go-to-end.
|
||||
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
|
||||
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
|
||||
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
|
||||
* @option {Number} duration The OVERALL length of the animation.
|
||||
* @option {String} easing The easing method for the animation.
|
||||
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
|
||||
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
|
||||
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
|
||||
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
|
||||
* @option {Function} onAfter Function to be called after the scrolling ends.
|
||||
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
|
||||
* @return {jQuery} Returns the same jQuery object, for chaining.
|
||||
*
|
||||
* @desc Scroll to a fixed position
|
||||
* @example $('div').scrollTo( 340 );
|
||||
*
|
||||
* @desc Scroll relatively to the actual position
|
||||
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
|
||||
*
|
||||
* @dec Scroll using a selector (relative to the scrolled element)
|
||||
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
|
||||
*
|
||||
* @ Scroll to a DOM element (same for jQuery object)
|
||||
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
|
||||
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
|
||||
* alert('scrolled!!');
|
||||
* }});
|
||||
*
|
||||
* @desc Scroll on both axes, to different values
|
||||
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
|
||||
*/
|
||||
;(function( $ ){
|
||||
|
||||
var $scrollTo = $.scrollTo = function( target, duration, settings ){
|
||||
$(window).scrollTo( target, duration, settings );
|
||||
};
|
||||
|
||||
$scrollTo.defaults = {
|
||||
axis:'xy',
|
||||
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
|
||||
};
|
||||
|
||||
// Returns the element that needs to be animated to scroll the window.
|
||||
// Kept for backwards compatibility (specially for localScroll & serialScroll)
|
||||
$scrollTo.window = function( scope ){
|
||||
return $(window)._scrollable();
|
||||
};
|
||||
|
||||
// Hack, hack, hack :)
|
||||
// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
|
||||
$.fn._scrollable = function(){
|
||||
return this.map(function(){
|
||||
var elem = this,
|
||||
isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
|
||||
|
||||
if( !isWin )
|
||||
return elem;
|
||||
|
||||
var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
|
||||
|
||||
return $.browser.safari || doc.compatMode == 'BackCompat' ?
|
||||
doc.body :
|
||||
doc.documentElement;
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.scrollTo = function( target, duration, settings ){
|
||||
if( typeof duration == 'object' ){
|
||||
settings = duration;
|
||||
duration = 0;
|
||||
}
|
||||
if( typeof settings == 'function' )
|
||||
settings = { onAfter:settings };
|
||||
|
||||
if( target == 'max' )
|
||||
target = 9e9;
|
||||
|
||||
settings = $.extend( {}, $scrollTo.defaults, settings );
|
||||
// Speed is still recognized for backwards compatibility
|
||||
duration = duration || settings.speed || settings.duration;
|
||||
// Make sure the settings are given right
|
||||
settings.queue = settings.queue && settings.axis.length > 1;
|
||||
|
||||
if( settings.queue )
|
||||
// Let's keep the overall duration
|
||||
duration /= 2;
|
||||
settings.offset = both( settings.offset );
|
||||
settings.over = both( settings.over );
|
||||
|
||||
return this._scrollable().each(function(){
|
||||
var elem = this,
|
||||
$elem = $(elem),
|
||||
targ = target, toff, attr = {},
|
||||
win = $elem.is('html,body');
|
||||
|
||||
switch( typeof targ ){
|
||||
// A number will pass the regex
|
||||
case 'number':
|
||||
case 'string':
|
||||
if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
|
||||
targ = both( targ );
|
||||
// We are done
|
||||
break;
|
||||
}
|
||||
// Relative selector, no break!
|
||||
targ = $(targ,this);
|
||||
case 'object':
|
||||
// DOMElement / jQuery
|
||||
if( targ.is || targ.style )
|
||||
// Get the real position of the target
|
||||
toff = (targ = $(targ)).offset();
|
||||
}
|
||||
$.each( settings.axis.split(''), function( i, axis ){
|
||||
var Pos = axis == 'x' ? 'Left' : 'Top',
|
||||
pos = Pos.toLowerCase(),
|
||||
key = 'scroll' + Pos,
|
||||
old = elem[key],
|
||||
max = $scrollTo.max(elem, axis);
|
||||
|
||||
if( toff ){// jQuery / DOMElement
|
||||
attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
|
||||
|
||||
// If it's a dom element, reduce the margin
|
||||
if( settings.margin ){
|
||||
attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
|
||||
attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
|
||||
}
|
||||
|
||||
attr[key] += settings.offset[pos] || 0;
|
||||
|
||||
if( settings.over[pos] )
|
||||
// Scroll to a fraction of its width/height
|
||||
attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
|
||||
}else{
|
||||
var val = targ[pos];
|
||||
// Handle percentage values
|
||||
attr[key] = val.slice && val.slice(-1) == '%' ?
|
||||
parseFloat(val) / 100 * max
|
||||
: val;
|
||||
}
|
||||
|
||||
// Number or 'number'
|
||||
if( /^\d+$/.test(attr[key]) )
|
||||
// Check the limits
|
||||
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
|
||||
|
||||
// Queueing axes
|
||||
if( !i && settings.queue ){
|
||||
// Don't waste time animating, if there's no need.
|
||||
if( old != attr[key] )
|
||||
// Intermediate animation
|
||||
animate( settings.onAfterFirst );
|
||||
// Don't animate this axis again in the next iteration.
|
||||
delete attr[key];
|
||||
}
|
||||
});
|
||||
|
||||
animate( settings.onAfter );
|
||||
|
||||
function animate( callback ){
|
||||
$elem.animate( attr, duration, settings.easing, callback && function(){
|
||||
callback.call(this, target, settings);
|
||||
});
|
||||
};
|
||||
|
||||
}).end();
|
||||
};
|
||||
|
||||
// Max scrolling position, works on quirks mode
|
||||
// It only fails (not too badly) on IE, quirks mode.
|
||||
$scrollTo.max = function( elem, axis ){
|
||||
var Dim = axis == 'x' ? 'Width' : 'Height',
|
||||
scroll = 'scroll'+Dim;
|
||||
|
||||
if( !$(elem).is('html,body') )
|
||||
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
|
||||
|
||||
var size = 'client' + Dim,
|
||||
html = elem.ownerDocument.documentElement,
|
||||
body = elem.ownerDocument.body;
|
||||
|
||||
return Math.max( html[scroll], body[scroll] )
|
||||
- Math.min( html[size] , body[size] );
|
||||
|
||||
};
|
||||
|
||||
function both( val ){
|
||||
return typeof val == 'object' ? val : { top:val, left:val };
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
@@ -1,12 +0,0 @@
|
||||
$(document).ready(function(){
|
||||
/* This code is executed after the DOM has been completely loaded */
|
||||
|
||||
$('nav a,footer a.up').click(function(e){
|
||||
|
||||
// If a link has been clicked, scroll the page to the link's hash target:
|
||||
|
||||
$.scrollTo( this.hash || 0, 1500);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,219 +0,0 @@
|
||||
*{
|
||||
/* Universal reset: */
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
header,footer,
|
||||
article,section,
|
||||
hgroup,nav,
|
||||
figure{
|
||||
/* Giving a display value to the HTML5 rendered elements: */
|
||||
display:block;
|
||||
}
|
||||
|
||||
body{
|
||||
/* Setting the default text color, size, page background and a font stack: */
|
||||
font-size:0.825em;
|
||||
color:#fcfcfc;
|
||||
background-color:#355664;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
/* Hyperlink Styles: */
|
||||
|
||||
a, a:visited {
|
||||
color:#0196e3;
|
||||
text-decoration:none;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
a:hover{
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
a img{
|
||||
border:none;
|
||||
}
|
||||
|
||||
/* Headings: */
|
||||
|
||||
h1,h2,h3{
|
||||
font-family:"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
|
||||
text-shadow:0 1px 1px black;
|
||||
}
|
||||
|
||||
h1{
|
||||
/* The logo text */
|
||||
font-size:3.5em;
|
||||
padding:0.5em 0 0;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
|
||||
h3{
|
||||
/* The slogan text */
|
||||
font-family:forte,"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
|
||||
font-size:2em;
|
||||
font-weight:normal;
|
||||
margin:0 0 1em;
|
||||
}
|
||||
|
||||
|
||||
h2{
|
||||
font-size:2.2em;
|
||||
font-weight:normal;
|
||||
letter-spacing:0.01em;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
|
||||
p{
|
||||
line-height:1.5em;
|
||||
padding-bottom:1em;
|
||||
}
|
||||
|
||||
.line{
|
||||
/* The dividing line: */
|
||||
height:1px;
|
||||
background-color:#24404c;
|
||||
border-bottom:1px solid #416371;
|
||||
margin:1em 0;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
article .line{
|
||||
/* The dividing line inside of the article is darker: */
|
||||
background-color:#15242a;
|
||||
border-bottom-color:#204656;
|
||||
margin:1.3em 0;
|
||||
}
|
||||
|
||||
footer .line{
|
||||
margin:2em 0;
|
||||
}
|
||||
|
||||
nav{
|
||||
background:url(img/gradient_light.jpg) repeat-x 50% 50% #f8f8f8;
|
||||
padding:0 5px;
|
||||
position:absolute;
|
||||
right:0;
|
||||
top:4em;
|
||||
|
||||
border:1px solid #FCFCFC;
|
||||
|
||||
-moz-box-shadow:0 1px 1px #333333;
|
||||
-webkit-box-shadow:0 1px 1px #333333;
|
||||
box-shadow:0 1px 1px #333333;
|
||||
}
|
||||
|
||||
/* The clearfix hack to clear the floats: */
|
||||
|
||||
.clear:after{
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* The navigation styling: */
|
||||
|
||||
nav ul li{
|
||||
display:inline;
|
||||
}
|
||||
|
||||
nav ul li a,
|
||||
nav ul li a:visited{
|
||||
color:#565656;
|
||||
display:block;
|
||||
float:left;
|
||||
font-size:1.25em;
|
||||
font-weight:bold;
|
||||
margin:5px 2px;
|
||||
padding:7px 10px 4px;
|
||||
text-shadow:0 1px 1px white;
|
||||
text-transform:uppercase;
|
||||
}
|
||||
|
||||
nav ul li a:hover{
|
||||
text-decoration:none;
|
||||
background-color:#f0f0f0;
|
||||
}
|
||||
|
||||
nav, article, nav ul li a,figure{
|
||||
/* Applying CSS3 rounded corners: */
|
||||
-moz-border-radius:10px;
|
||||
-webkit-border-radius:10px;
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
/* Article styles: */
|
||||
|
||||
#page{
|
||||
width:960px;
|
||||
margin:0 auto;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
article{
|
||||
background-color:#213E4A;
|
||||
margin:3em 0;
|
||||
padding:20px;
|
||||
|
||||
text-shadow:0 2px 0 black;
|
||||
}
|
||||
|
||||
figure{
|
||||
border:3px solid #142830;
|
||||
float:right;
|
||||
height:300px;
|
||||
margin-left:15px;
|
||||
overflow:hidden;
|
||||
width:500px;
|
||||
}
|
||||
|
||||
figure:hover{
|
||||
-moz-box-shadow:0 0 2px #4D7788;
|
||||
-webkit-box-shadow:0 0 2px #4D7788;
|
||||
box-shadow:0 0 2px #4D7788;
|
||||
}
|
||||
|
||||
figure img{
|
||||
margin-left:-60px;
|
||||
}
|
||||
|
||||
/* Footer styling: */
|
||||
|
||||
footer{
|
||||
margin-bottom:30px;
|
||||
text-align:center;
|
||||
font-size:0.825em;
|
||||
}
|
||||
|
||||
|
||||
footer p{
|
||||
margin-bottom:-2.5em;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
footer a,footer a:visited{
|
||||
color:#cccccc;
|
||||
background-color:#213e4a;
|
||||
display:block;
|
||||
padding:2px 4px;
|
||||
z-index:100;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
footer a:hover{
|
||||
text-decoration:none;
|
||||
background-color:#142830;
|
||||
}
|
||||
|
||||
footer a.by{
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
footer a.up{
|
||||
float:right;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user