Compare commits

...

799 Commits

Author SHA1 Message Date
256f7581f1 Updated changelogs 2019-05-30 16:38:27 +02:00
5df220beef Removed redefinitions that violates VDRS(4). 2019-05-30 16:21:53 +02:00
5ff361af54 Simplified proxy example, no more proxy.conf file.
Added forwarding case based on server name.
2019-01-24 11:19:05 +01:00
65525aa112 updated proxy example's README file. 2019-01-24 09:23:47 +01:00
d4bbdea5e4 Removed unneeded redefine. 2019-01-23 23:50:26 +01:00
8260336d6c Added support for X-Forwarded-For .., and Forwarded header, for the simple proxy implementation.
Also added the possibility to "keep" the original host name.
Updated related example.
2019-01-23 23:46:35 +01:00
19c14d28c7 Updated EiffelWeb wizard. 2018-11-19 19:10:26 +01:00
f1e8dfa40b Updated to use ARGUMENTS_32 as client. 2018-11-19 18:04:35 +01:00
e73302639d updated changelog. 2018-11-16 19:39:13 +01:00
1c58674523 Updated notes for JWS. 2018-11-16 19:35:34 +01:00
7cfe0cc5ed Removed obsolete v0 code. 2018-11-16 19:31:41 +01:00
4f8341e04e Updated JWT library with class descriptions and better features names.
JWT library fixed to use agorithms names in upper case.
Updated README.
2018-11-16 19:28:46 +01:00
7f36e539f1 Accepts string general in html_encoded_string. 2018-11-16 19:28:05 +01:00
8241c0209a Updated JWT README content. 2018-10-29 15:17:31 +01:00
45179b58a3 Fixed custom error creation, do not create default message, otherwise the info will be duplicated in error output. 2018-10-29 15:14:28 +01:00
31fa31bd53 Updated changelog 2018-10-29 13:22:01 +01:00
a8a3ca5b97 typo. 2018-10-29 13:15:32 +01:00
7c6fe5a04a Added HTTP_COOKIE.set_expiration_from_max_age, to add the "Expiration:" based on the max-age value. 2018-10-29 13:15:14 +01:00
c8e2009638 Use double quotes only when needed for put_content_type_with_parameters. 2018-10-29 13:11:19 +01:00
627ec7aefc removed unneeded inheritance. 2018-10-29 13:04:46 +01:00
e7087bcbc1 Added missing WSF_TIMEOUT_UTILITIES file. 2018-10-29 12:19:36 +01:00
8d881bcd7d Updated changelog.md 2018-10-29 12:16:01 +01:00
ed3ad962d1 Updated a few classes from http_client to use nanoseconds as timeout precision.
Fixed typo in comments.
2018-10-29 12:15:20 +01:00
d3e865cf6c Fixed setting of socket.timeout in httpd (was not currently set before).
Adopted the nanoseconds timeout precision
 - in config file added support for ns, us, ms, s timeout precision (without indication, it uses `seconds` precision).
2018-10-29 11:27:26 +01:00
9fcd30b4e1 removed useless JWT_ENCODER 2018-10-17 14:25:56 +02:00
0baa05cf63 JWT: updated to make JWT algorithm support more flexible, and simple to extend with specific algorithm. 2018-10-17 11:00:20 +02:00
f97f59b703 renamed a png file to avoid blank character. 2018-09-27 22:01:34 +02:00
dc377b84d3 Duplicated images to see expected images embedded in github markdown pages, and also in github web pages (jekyll on eiffelweb.org). 2018-09-27 21:57:16 +02:00
f14431fc05 Update basics.md 2018-09-27 21:50:02 +02:00
9577d7d82a Update basics.md 2018-09-27 21:48:45 +02:00
99f8377721 Include images twices to see them under github pages, and also in markdown pages 2018-09-27 21:47:48 +02:00
73d5555532 test (ignore) 2018-09-27 21:39:58 +02:00
ce3c7ac57a try change for related links. 2018-09-27 21:34:18 +02:00
Javier Velilla
8754c2d67d Update basics.md 2018-09-27 16:22:20 -03:00
5e928b9a47 use image location that works for md files, and also generated web files (jekyll) 2018-09-27 21:10:04 +02:00
Javier Velilla
9cdfbd2538 Update basics.md 2018-09-27 16:08:39 -03:00
e4fcc863ca Updated image locations 2018-09-27 21:05:54 +02:00
Javier Velilla
7c8d6b9eef Updated path to Application execution png file 2018-09-27 15:58:09 -03:00
a97eb4b062 Added missing dependencies. 2018-05-30 19:27:04 +02:00
bd5aba3db6 Updated Windows DOS script to build the libfcgi binary lib files. 2018-05-30 17:30:05 +02:00
d43c4edb7d Updated the default rescue response (i.e when exception or bad internal error occurs).
Factorized the implementation in WGI_RESCUE_EXECUTION, and now by redefining the `WGI_EXECUTION.execute_rescue (...)` procedure, it is possible to have a custom response on such rescued execution.
2018-05-30 17:28:24 +02:00
9cdd676417 Fixed HTTP_HEADER.put_raw_header (..) by ignoring any empty line of the argument value.
(note: "%R" is considered as empty line here.)
2018-05-30 17:25:04 +02:00
cb273c3176 Updated to compile with upcoming EiffelStudio 18.05 (with and without ssl). 2018-05-28 17:21:11 +02:00
ec7d504502 Fixed EOL. 2018-05-28 16:18:59 +02:00
7ed1e815b0 Updated to compile with upcoming EiffelStudio 18.05 . 2018-05-28 16:11:24 +02:00
da2e26f697 Renamed the fcgi executable. 2018-04-26 11:58:00 +02:00
bc169d6b26 Fixed remaining issues with docker setup. 2018-04-26 10:58:01 +02:00
cf2f0f09fa Updated container files. 2018-04-24 15:13:47 +02:00
207a109e44 Updated to match docker expectation. 2018-04-24 10:36:20 +02:00
2f2e2067ba Added an example to run the debug app with apache2+libfcgi inside a docker container. 2018-04-23 22:13:07 +02:00
7aa7bf1ab2 Updated travis CI config.
Updated install dos script to include wsf_security.
2018-02-13 18:49:14 +01:00
8e8c3602c6 Allow (websocket) upgrade even without persistent connection for normal http request.
(note: this allows to use websocket in single-threaded mode, and avoid the keep-alive-timeout delay before websocket begins its execution)
2018-02-13 18:39:47 +01:00
Jocelyn Fiat
ffd7dd8540 Improved WSF download response implementation.
- Do not set Transfer-Encoding to binary for download response.
- Use WSF_RESPONSE.put_file_content (...)
2018-02-05 21:02:23 +01:00
Jocelyn Fiat
947c94644e Apply win32 workaround only on Windows 32bits. 2018-02-02 22:43:50 +01:00
Jocelyn Fiat
6a779797a5 Removed a few obsolete calls.
Updated tests/all.ecf to include a few missing libraries.
2018-02-02 22:40:18 +01:00
Jocelyn Fiat
7b0ccc0aec Merge branch 'develop' 2018-01-29 22:16:57 +01:00
Jocelyn Fiat
74001fe674 Properly JSON encode null character as \u0000 . 2018-01-29 22:13:03 +01:00
Jocelyn Fiat
c7eb12ad8e Return NotFound response for "/favicon.ico" request instead of returning wrong plain text response. 2017-12-18 19:15:19 +01:00
Jocelyn Fiat
36eeff9285 Fixed the websocket example to also work for remote client.
(i.e not from the same machine).
2017-12-18 14:52:09 +01:00
Jocelyn Fiat
e9292b3eac Reverted last change as error_message on curl is not available for 17.05. 2017-12-01 12:05:01 +01:00
Jocelyn Fiat
30625d460f Added curl error message to the response error message (in addition to just the curl error code). 2017-11-30 20:08:58 +01:00
Jocelyn Fiat
24eb0a4002 Updated changelog 2017-11-30 15:05:54 +01:00
Jocelyn Fiat
7d738a164d Added missing comments. 2017-11-30 14:54:46 +01:00
Jocelyn Fiat
1037256ea6 Refactored using an abstraction WSF_PROTECTION.
This protection could be implemented with a regular expression,
    or using another solution (as manual parsing).
  Also, when a protection detects an issue, instead of returning empty string,
    it returns Void. If the value is a multiple string value, if an item is detected for an issue,
    the returned multiple string value is now Void.
  This abstraction will allow to return either Void, or a "corrected" value,
    for instance the string value, without the detected "<script..>..</script>" text.
  TODO: improve the WSF_PROTECTION_REGEXP to allow replacement strategy.
2017-11-27 15:44:19 +01:00
Jocelyn Fiat
4d79bba04b Merge branch 'ewf_xss' 2017-11-23 11:50:47 +01:00
jvelilla
5de024923e Updated xss support.
Added a new library wsf_security.
Updated test cases to cover protections policy.
Added a simple filter using an XSS implementation with WSF_XSS_REQUEST, but
it's possible to build custom filters and request using different protection patterns.
2017-11-22 17:22:02 -03:00
jvelilla
8b90241986 Moved XSS protection to WSF_EXTENSION.
Updated code to protect meta_variables.
Fixed typos.
Updated ecf's to use 1-16-0.
2017-11-13 15:06:02 -03:00
Jocelyn Fiat
da1c0b8545 Fixed typo in script. 2017-11-13 19:01:16 +01:00
Jocelyn Fiat
603bedf71d Reverted change that made WSF_URI_FILTER_HANDLER and WSF_URI_TEMPLATE_FILTER_HANDLER inheriting from WSF_EXECUTE_FILTER_HANDLER as it breaks existing projects using EiffelWeb. 2017-11-13 18:58:29 +01:00
Jocelyn Fiat
5fedad7f2e Updated Changelog. 2017-11-13 12:31:19 +01:00
Jocelyn Fiat
e83f5654d8 Updated NOTIFICATION_SMTP_MAILER to follow the EiffelNet EMAIL design. 2017-11-13 12:29:16 +01:00
jvelilla
25446cac12 Initial import WSF XSS protection.
Added an utility class to get safe query and form parameters.
Added a new WSF_XSS_REQUEST to use safe parameters.
Added a filter WSF_XSS_FILTER using WSF_XSS_REQUEST.
Added test cases

Signed-off-by: jvelilla <javier.hector@gmail.com>
2017-11-10 10:37:32 -03:00
Jocelyn Fiat
ccff084642 Updated travis CI config to use install script. 2017-11-08 10:20:50 +01:00
Jocelyn Fiat
830adbe10c Fixed response handlers compilation. 2017-11-07 23:52:42 +01:00
Jocelyn Fiat
e6d998953e Updated changelog. 2017-11-07 23:17:39 +01:00
Jocelyn Fiat
6ca3cca88b Reverted change that made WSF_URI_HANDLER and WSF_URI_TEMPLATE_HANDLER inheriting from WSF_EXECUTE_HANDLER, as it breaks existing project using EiffelWeb. 2017-11-07 23:05:22 +01:00
Jocelyn Fiat
f91a676f41 fixed obsolete v0 wsf_extension ecf file. 2017-11-04 22:44:27 +01:00
Jocelyn Fiat
1c75e11e34 removed unused local variable. 2017-11-03 18:54:46 +01:00
Jocelyn Fiat
b5b4fa6b2f added develop branch for CI 2017-11-03 18:06:47 +01:00
Jocelyn Fiat
211fc425a3 Added handler to add support for CGI scripts.
Added a new tool `httpd` which is a basic httpd server product (with file server and CGI handler).
2017-11-03 18:00:39 +01:00
Jocelyn Fiat
95cebe26bb Added routing condition mapping.
Added WSF_EXECUTE_HANDLER as common ancestor for handler with `execute (WSF_REQUEST, WSF_RESPONSE) ..` routine.
Made more flexible a few routine by accepting ITERABLE instead of ARRAY, and READABLE_STRING_GENERAL when possible.
2017-11-03 17:59:10 +01:00
Jocelyn Fiat
f770c236d5 Improved support for absolute url passed tp HTTP_REQUEST_SESSION . 2017-10-27 19:24:52 +02:00
Jocelyn Fiat
503e5f7915 Merge branch 'master' into v1 2017-10-26 10:23:33 +02:00
Jocelyn Fiat
39f01e95fd Use single ecf file. 2017-10-26 10:19:56 +02:00
Jocelyn Fiat
c725159d7e Merge branch 'master' into with_compression 2017-10-26 10:13:27 +02:00
Jocelyn Fiat
e66f1cf7be updated changelog 2017-10-24 17:51:55 +02:00
Jocelyn Fiat
c03d28cabc Use new on_timer solution, to check every 1 second, the presence of ".stop" file.
If this file exists, close all active websockets.

Redesigned the commands implementation for this example.
2017-10-24 17:45:08 +02:00
Jocelyn Fiat
e834b2b360 Added on_timer callback event so that server can check regularly external state.
This is a basic solution to implement a way to check for time to time for events to notify websocket clients.
2017-10-24 17:43:06 +02:00
Jocelyn Fiat
d089fd3a03 Merge branch 'master' into v1 2017-10-19 11:20:55 +02:00
Jocelyn Fiat
a0c1ab5232 updated simple.ini settings. 2017-10-19 11:20:14 +02:00
Jocelyn Fiat
a8ddd10b46 Merge branch 'master' into v1 2017-10-19 10:57:45 +02:00
Jocelyn Fiat
db39068ceb Updated documentation for standalone connector.
Changed `default_max_keep_alive_requests` from 100 to 300.
2017-10-19 00:14:23 +02:00
Jocelyn Fiat
a1b4337438 Set keep_alive_timeout to 2, this way for single threaded case, browser does not wait too much to start the websocket connection.
Set max_keep_alive_requests to -1, to allow unlimited number of requests within a same websocket connection.
2017-10-18 23:41:03 +02:00
Jocelyn Fiat
74121be470 Support persistent connection, even in single thread mode (i.e concurrency=none).
Warning: as there is no concurrent request handling in single threaded mode,
            it is recommended to either set the keep_alive_timeout to a small value,
            or disable persistent connection by setting max_keep_alive_requests to 0.
Change the default keep_alive_timeout from 15 to 5 seconds.
Accept -1 as value of max_keep_alive_requests to have unlimited number of request in the same persistent connection.
2017-10-18 23:29:16 +02:00
Jocelyn Fiat
1c9f5ac0e7 Merge branch 'master' into v1 2017-10-17 14:52:17 +02:00
Jocelyn Fiat
edec837c4e Made interface of wsf forms and widgets a bit more flexible by accepting READABLE_STRING_GENERAL. 2017-10-17 14:34:50 +02:00
Jocelyn Fiat
f1642a444a Improved support of absolute/relative https:// and http:// in http_client. 2017-10-17 14:30:44 +02:00
Jocelyn Fiat
48af63af83 Fixed typo to process relative or absolute url. 2017-10-09 14:23:45 +02:00
Jocelyn Fiat
2f98d7031f Updated a few package.iron files. 2017-10-06 14:06:46 +02:00
Jocelyn Fiat
70f00651c7 update test case. 2017-10-06 13:58:54 +02:00
Jocelyn Fiat
199f84c7ef Updated Readme file with Build Status on Master Branch. 2017-10-06 10:37:11 +02:00
Jocelyn Fiat
9b97627c76 Update package.iron files. 2017-10-06 10:27:32 +02:00
Jocelyn Fiat
72c87cd74d Fixed curl implementation by setting Content-Type to x-www-form-urlencoded (if not set) when POST send data as x-www-form-urlencoded. 2017-10-06 10:24:48 +02:00
Jocelyn Fiat
2ed4d03168 Renamed ciphers_settings as ciphers_setting . 2017-10-06 09:34:08 +02:00
Jocelyn Fiat
18ed92a61d Moved to unique .ecf from ecf version 1-16-0 .
Requires 17.05 or newer.
2017-10-06 09:02:10 +02:00
Jocelyn Fiat
0a6a4281e7 Merge branch 'master' into es17.05 2017-10-06 08:18:50 +02:00
Jocelyn Fiat
38cf5d7a6f Updated requirements, now EiffelWeb requires 17.05 or newer.
Improved support for future 17.11 version with new openssl library.
2017-10-05 22:07:05 +02:00
jvelilla
96648a16dc Updated Readme file with Build Status on Master Branch.
Update code style: refactor rename ciphers_settings to ciphers_setting.
2017-09-25 14:21:35 -03:00
Javier Velilla
6f35ad7b16 Merge pull request #181 from jvelilla/ewf_http_client
Update HTTP Client cURL implementation:
2017-09-25 11:05:45 -03:00
Jocelyn Fiat
8ff20d34a7 Merge branch 'master' into v1 2017-09-21 21:22:38 +02:00
jvelilla
85c8a46c89 Update Readme.md with a note about ciphers implementation. 2017-09-21 08:07:11 -03:00
Jocelyn Fiat
498e4a6ec2 Fixed validation of iss and aud when issuer and audience are not set. 2017-09-21 10:46:08 +02:00
Jocelyn Fiat
ab507d543a Now HTTP_AUTHORIZATION acceps READABLE_STRING_GENERAL for username and password argument. 2017-09-21 10:45:40 +02:00
Jocelyn Fiat
20a90db2e3 If url is relative, use session.url (...) to get valid url.
It could happen with relative url in `Location: ...` header (for redirection).
2017-09-21 10:45:08 +02:00
Jocelyn Fiat
97fe16b4c2 Code cleaning. 2017-09-21 10:26:29 +02:00
jvelilla
6ed91699b8 Renamed feature 'set_ciphers' to 'set_ciphers_settings' and added description. 2017-09-19 10:32:17 -03:00
jvelilla
bb334aef80 Updated HTTP client cURL implementation.
Refactor rename cipher_list by ciphers_settings and description.
Updated ciphers_settings representation to STIRNG_8
Refactor rename set_cipher_list by set_ciphers.
2017-09-14 11:58:43 -03:00
jvelilla
c2764e25ff Update HTTP Client cURL implementation:
Added the option to set cipher list used to negotiate security settings
(SSL handshake)
2017-09-14 10:21:32 -03:00
Jocelyn Fiat
cdada71f7e Corrected wsf_compression.ecf which was missing a few libraries.
The -safe.ecf was correct.
2017-09-02 21:49:41 +02:00
Jocelyn Fiat
a7d0398ec6 Introduce WSF_COMPRESSION and applied to WSF_*_WITH_COMPRESSION classes.
Modified the example to send the file with or without compression.
2017-09-01 18:59:18 +02:00
jvelilla
267655d7bc Update code, comment style and removed hardcoded value. 2017-08-18 13:55:54 -03:00
jvelilla
e735da1bcb Merge branch 'ewf_compression' of https://github.com/jocelyn/EWF into ewf_compression_2017 2017-08-18 09:52:03 -03:00
Jocelyn Fiat
6425482070 Fixed ecf by removing the override declaration. 2017-08-08 15:55:52 +02:00
Jocelyn Fiat
818c3fb460 Made compilable with EiffelStudio 17.05 and probably before as well. 2017-08-08 15:54:21 +02:00
Jocelyn Fiat
dac50b490d Added output for the travis CI job. 2017-08-08 14:10:12 +02:00
Jocelyn Fiat
16d5076fe5 Added Travis CI support with 17.05. 2017-08-08 14:03:39 +02:00
Jocelyn Fiat
2748e1d9ee Now JWT_LOADER takes the alg as argument, to avoid security issue where the lib is taking alg from the header (which may be a bad security weakness). 2017-07-11 23:32:11 +02:00
Jocelyn Fiat
27ee20f99b Added convenient get and custom functions on HTTP_CLIENT directly. 2017-07-11 23:29:42 +02:00
Javier Velilla
9a3164df70 Merge pull request #178 from jvelilla/ewf_ssl
Updated EWF  http_network, websocket, httpd to use the latest EiffelN…
2017-06-23 09:53:26 -03:00
jvelilla
02383810b4 Fixed bad identation
Updated date to current date in obsolte message.
2017-06-23 09:51:59 -03:00
jvelilla
dbf5e76047 Updated EWF network and httpd libraries.
Updated features using ssl_2 and ssl_3 as obsolete and raise a
developer exception.
2017-06-22 10:23:56 -03:00
jvelilla
5c31905427 Updated EWF http_network, websocket, httpd to use the latest EiffelNet SSL
version.
2017-06-21 18:34:07 -03:00
Jocelyn Fiat
21adef6998 Merge branch 'master' into es17.05
# Conflicts:
#	library/network/http_client/http_client-safe.ecf
#	library/network/http_client/libcurl_http_client-safe.ecf
#	library/network/http_client/net_http_client-safe.ecf
2017-06-21 09:01:27 +02:00
Jocelyn Fiat
c7ef652322 Made the parameters not hidden implementation classes. 2017-06-21 08:59:07 +02:00
Jocelyn Fiat
67bdcfb6ef Made the parameters not hidden implementation classes. 2017-06-21 08:58:15 +02:00
Jocelyn Fiat
ca4043b102 Merge branch 'master' into v1 2017-06-20 18:17:30 +02:00
Jocelyn Fiat
310e96e185 Updated EOL for 2 ecf files. 2017-06-20 18:16:43 +02:00
Jocelyn Fiat
46a48625ac Merge branch 'master' into es17.05 2017-06-20 18:15:03 +02:00
Jocelyn Fiat
7feb45b549 Updated error library (cosmetic, and loop iteration). 2017-06-20 18:08:50 +02:00
Jocelyn Fiat
aeb3392ad8 Merge branch 'master' into es17.05
# Conflicts:
#	contrib/library/network/server/nino/example/SimpleWebServer/web_server-safe.ecf
#	contrib/library/network/server/nino/example/SimpleWebServer/web_server.ecf
#	library/network/http_client/libcurl_http_client-safe.ecf
#	library/network/http_client/net_http_client-safe.ecf
2017-06-20 17:52:40 +02:00
Jocelyn Fiat
5bbd031275 Update EOL on ecf files. 2017-06-20 17:49:28 +02:00
Jocelyn Fiat
90e60fad26 Updated changelog. 2017-06-20 17:47:17 +02:00
Jocelyn Fiat
98c20ee7c1 Fixed specific ecf files for http_client library. 2017-06-20 17:37:24 +02:00
Jocelyn Fiat
9fc5a7c364 Merge branch 'v1' into es17.05 2017-06-20 09:54:07 +02:00
Jocelyn Fiat
64027f56bd Merge branch 'master' into v1 2017-06-20 09:53:29 +02:00
Jocelyn Fiat
0b99e84728 Added installation of JWT into Eiffel installation. 2017-06-20 09:53:13 +02:00
Jocelyn Fiat
c51a0a4788 Merge branch 'v1' into es17.05
# Conflicts:
#	library/network/http_client/tests/test.ecf
2017-06-20 09:49:51 +02:00
Jocelyn Fiat
a6806c676a Updated ecf files to version 1-16-0 .
Minor cosmetic changes.
2017-06-20 09:48:10 +02:00
Jocelyn Fiat
9e5e8bb1bf Added simple way to set the issued_at claim value to current UTC date time. 2017-06-14 16:27:24 +02:00
Jocelyn Fiat
10a83c6ad8 Added possibility to create JWS object with specific algo hs256 or none easily. 2017-06-14 16:26:31 +02:00
Jocelyn Fiat
1ec3b8e7a4 Added support for multiple file in form data.
Made clear what is the meaning of upload_filename, upload_data and form_data.
2017-06-14 16:19:43 +02:00
Jocelyn Fiat
0783049fb4 updated package.iron 2017-06-08 11:25:26 +02:00
Jocelyn Fiat
7e54825b84 Updated JWT library, add supports for claim exp, iat, nbf, iss, aud . 2017-06-07 23:24:46 +02:00
Jocelyn Fiat
40cbe7dfc9 Merge branch 'master' into dev_jwt 2017-06-06 10:58:38 +02:00
Jocelyn Fiat
d4b9301a57 Reverted to previous TYPE.name to be compilable with version prior to 17.05.
(TYPE.name_32 exists since 17.05).
2017-06-02 17:40:53 +02:00
Jocelyn Fiat
06cda97535 New JSON Web Token (JWT) library. 2017-05-24 11:56:15 +02:00
Jocelyn Fiat
406a46816e Merge branch 'master' into es17.05 2017-05-17 17:40:44 +02:00
Jocelyn Fiat
c83b9d4231 Updated CHANGELOG.md 2017-05-17 17:38:25 +02:00
Jocelyn Fiat
49c46f8d8b Merge branch 'master' into es17.01 2017-05-17 13:54:01 +02:00
Jocelyn Fiat
69b5ce637e Improved query and form data encoding (based on a very early version of the general URI percent-encoding rules).
- now correct encoding of space by '%20' in path segment, and '+' in query parameters.
Unify and fixed query parameters handling for libcurl and net implementation.
Fixed file uploading (various issue in libcurl, and net implementation).
Fixed form multipart encoding by using correctly the boundary.
Updated autotest cases.
Code cleaning.
2017-05-17 12:16:35 +02:00
Jocelyn Fiat
cd382bca64 Merge branch 'master' into es17.01 2017-05-15 13:20:24 +02:00
Jocelyn Fiat
485a3812d9 Integrated recent changes on SOCKET.socket_buffer splitted as read_socket_buffer and put_socket_buffer. 2017-05-15 12:20:52 +02:00
Jocelyn Fiat
24d834fb0b Revert changes on notification_email lib. 2017-05-12 14:57:29 +02:00
Jocelyn Fiat
7028892374 Removed unwanted committed files. 2017-05-12 14:55:02 +02:00
Jocelyn Fiat
88dec34a1e Made "common" targets as abstract. 2017-05-12 14:39:48 +02:00
Jocelyn Fiat
a928f27b1a Updated or added timestamp to obsolete and fixme messages.
Fixed ecf file exclusion for .svn and .git .
Cosmetic changed.
2017-05-12 14:31:35 +02:00
Jocelyn Fiat
fb9af26d32 Updated or added timestamp to obsolete and fixme messages.
Fixed ecf file exclusion for .svn and .git .
Cosmetic changed.
2017-05-12 14:11:22 +02:00
Jocelyn Fiat
7ba678d726 Added empty .travis.yml for now (see https://travis-ci.com/) 2017-04-14 13:32:37 +02:00
Jocelyn Fiat
3d146d9be9 Merge branch 'v1' into es17.01 2017-04-14 12:52:48 +02:00
Jocelyn Fiat
2371ad4bd1 Commented unwanted change. 2017-04-14 12:52:08 +02:00
Jocelyn Fiat
146b78e5b0 Updated code regarding to string 32 vs string 8. 2017-04-14 12:49:34 +02:00
Jocelyn Fiat
94ba19920e Merge branch 'v1' into es17.01
# Conflicts:
#	library/text/parser/uri_template/uri_template-safe.ecf
#	library/text/parser/uri_template/uri_template.ecf
2017-04-14 12:04:33 +02:00
Jocelyn Fiat
273a55d93c Merge branch 'pr177' 2017-04-14 11:48:29 +02:00
Jocelyn Fiat
2e920f063a Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2017-04-14 11:48:14 +02:00
Jocelyn Fiat
3b8261ff08 Updated code regarding to string 32 vs string 8. 2017-04-14 11:45:38 +02:00
Jocelyn Fiat
a530bbebb4 Merge remote-tracking branch 'javier/ewf_get_rid_obsolete_messages' into pr177 2017-04-13 22:58:12 +02:00
Jocelyn Fiat
d41dbb9f47 Syntax in ecf files. 2017-04-13 22:56:40 +02:00
Jocelyn Fiat
a57e041003 Added precondition to WSF_FILTER.set_next (..) to avoid cycle. 2017-04-13 22:55:39 +02:00
jvelilla
5d9752f257 Updated code, get rid of obsolete feature calls in libraries and examples 2017-04-13 16:48:17 -03:00
Jocelyn Fiat
d4d988e532 Update README.md 2017-03-21 15:20:11 +01:00
Jocelyn Fiat
ce11a3c0fc Fixed markdown links related to network libraries. 2017-03-21 15:17:43 +01:00
Jocelyn Fiat
4eb743fa58 Updated CHANGELOG.md
Added full commit log in doc/CommitLog
2017-03-15 18:58:41 +01:00
Jocelyn Fiat
358b6bfb77 Updated ChangeLog using gitlog-to-changelog script for now. 2017-03-15 18:27:13 +01:00
3590f8546f Merge branch 'master' into es17.01 2017-03-08 22:01:46 +01:00
6f200bbf22 Allow forcing multipart/form-data or application/x-www-form-urlencoded to choose how the form data should be sent. 2017-03-08 22:01:04 +01:00
4763ec095f Merge branch 'master' into es17.01 2017-03-08 14:11:33 +01:00
8bb9675719 Update email notification storage classes. 2017-03-08 14:10:55 +01:00
1ddb27ca84 Merge branch 'master' into es17.01 2017-03-08 10:34:17 +01:00
4e21adc41f Fixed the notification_email_file_storage.
Added a new notification_email_directory_storage.
2017-03-08 10:33:16 +01:00
739c33b317 Merge branch 'master' into es17.01 2017-03-07 14:37:09 +01:00
9c207f4c9b Added put_content_type_utf_8_text_html to HTTP_HEADER .
Improved the directory index access denied message.
2017-03-07 14:36:16 +01:00
d4c79f1893 Fixed xml info of ecf files. 2017-03-07 14:31:36 +01:00
fa19976f60 Merge branch 'master' into es17.01 2017-03-07 13:17:10 +01:00
b2e795d2d1 removed useless local variable. 2017-03-07 13:14:47 +01:00
f2ecccce4f Improved NOTIFICATION_SMTP_MAILER.make (..) to support user:password@...
Propage error in notification_chain_mailer.
2017-03-07 13:14:16 +01:00
d8745fd61d Merge branch 'master' into es17.01 2017-03-02 10:01:33 +01:00
5988d9d74b Updated code related to force_single_threaded setting to mark it obsolete, and for now, have coherent value 1 vs 0 among the standalone code and the httpd library. 2017-03-02 09:59:14 +01:00
305425960b Merge branch 'v1' into es17.01 2017-02-16 16:58:27 +01:00
c160f63ddc Updated restbuck example and fixed the policy driven variant. 2017-02-16 16:56:47 +01:00
e53230d93c Merge branch 'v1' into es17.01 2017-02-16 14:58:12 +01:00
ae7aeaea30 Added test to the simple db lib, and depending on config, exclude or not json or memory database. 2017-02-16 14:53:55 +01:00
ad3fe2fc7b Updated restbuck example to avoid using the new (since 17.01) JSON serialization component. 2017-02-16 11:26:22 +01:00
Jocelyn Fiat
1792c956f4 New location for the workbook doc. 2017-02-15 18:02:13 +01:00
Jocelyn Fiat
56f48d8c72 workbook moved from doc/workbook to docs/workbook 2017-02-15 17:59:47 +01:00
Jocelyn Fiat
e0d3ceb4e8 Removed extra indentations. 2017-02-15 17:54:17 +01:00
Jocelyn Fiat
94f3c3b849 Updated workbook content.
cosmetic.
2017-02-15 17:49:31 +01:00
Jocelyn Fiat
fa2fa6f35c use workbook.md as main entry. 2017-02-15 17:35:01 +01:00
Jocelyn Fiat
e0d95ee4bd Fixed jekyll syntax. 2017-02-15 17:28:06 +01:00
Jocelyn Fiat
2cac9c73d1 Try again to have github pages fixed. 2017-02-15 17:24:14 +01:00
Jocelyn Fiat
5f96e56386 Use {{ site.url }} instead of page.base_url. 2017-02-15 17:21:30 +01:00
Jocelyn Fiat
687402930a Fixed the jeykill page.baseurl variable name. 2017-02-15 17:16:17 +01:00
Jocelyn Fiat
7dbecc7f38 Removed jekyll specific code from the workbook files. 2017-02-15 17:11:07 +01:00
Jocelyn Fiat
a90780fde2 Have the github pages source in the same branch. 2017-02-15 17:06:34 +01:00
eb4079789c Merge branch 'master' into es17.01 2017-02-14 19:59:19 +01:00
f66dbc3ad4 Declared code as eiffel code. 2017-02-14 19:52:18 +01:00
ff8da87fe3 Removed extra indentations in code. 2017-02-14 19:51:23 +01:00
f216e98430 Updated markdown syntax. 2017-02-14 19:43:54 +01:00
5dc9d82df7 Added wsf_html documentation in the doc/workbook.
Also improved the structure of `wsf_html` library.
Added a few widgets.
2017-02-14 19:37:03 +01:00
a44ca1a76c Converted all ecf files to ecf version 1-16-0 . 2017-02-14 14:47:07 +01:00
b93cb17f7c Added readme files to the examples.
Minor changes in various ecf file and code.
Moved filter example under _update_needed since it has obsolete code.
2017-02-14 11:21:32 +01:00
fbdf034b9b Conflict response can also have a payload to help the client understand the source of the conflict. 2017-02-13 17:36:10 +01:00
d6f3e500b8 Fixed implementation. 2017-02-13 17:35:14 +01:00
b56aec67a9 Updated, improved and cleaned RESTbucks example.
Moved it under "rest" subfolder.
2017-02-13 16:23:38 +01:00
a44c4d9a16 Minor changes. 2017-02-12 12:42:25 +01:00
7be394c689 Fixed more markdown syntax usage issue. 2017-02-12 12:29:58 +01:00
4d4bc89129 Fixed markdown syntax [..]() by .. . 2017-02-12 12:24:14 +01:00
Jocelyn Fiat
847b890b48 Merge pull request #176 from jvelilla/ewf_doc
Updated EWF documentation
2017-02-12 12:00:07 +01:00
Javier Velilla
14e260bea4 Cosmetic 2017-02-10 20:37:01 -03:00
Javier Velilla
5f1bb64d26 Update generating_response.md 2017-02-10 20:32:49 -03:00
Javier Velilla
c6de55b903 Cosmetic 2017-02-10 20:31:08 -03:00
Javier Velilla
65e1b1bfed Cosmetic 2017-02-10 19:55:18 -03:00
Javier Velilla
91a5fb2886 Cosmetic 2017-02-10 19:37:35 -03:00
Javier Velilla
b456f02a14 Updated documentation
Cosmetic, style, typos.
2017-02-10 18:55:38 -03:00
Javier Velilla
6596959724 Cosmetic 2017-02-10 18:32:48 -03:00
Javier Velilla
828c75f0c2 Cosmetic 2017-02-10 18:04:39 -03:00
Javier Velilla
7662afc17b Fixed typos
Updated document, fixed typos.
2017-02-10 18:02:17 -03:00
0786f1700f Added an example demonstrating the WSF_FORM component from wsf_html library. 2017-02-09 16:19:22 +01:00
08440b5c0c Use WSF_REQUEST.absolute_script_url (...) to compute expected url. 2017-01-26 22:26:45 +01:00
7f50409d08 Follow redirection only for redirection http status 3** . 2017-01-26 22:18:14 +01:00
681151e9b9 Fixed http_client EiffelNet implementation when port is not the default one.
- previously the client was not sending the complete `host:port` but only `host` as `host` http header.
2017-01-26 21:56:21 +01:00
1b24fb63f7 Fixed temporary restbucks example.
- use concurrency none to workaround a concurrency issue of DB_ACCESS
- use console_application for convenience
- use default http client, to use net implementation if curl is not available.
2017-01-26 09:52:44 +01:00
a6245351ef Updated http_client README. 2017-01-16 21:36:03 +01:00
d09d452ad5 Added test cases for PATH_INFO and percent_encoded_path_info for root url cases.
Removed obsolete calls from TEST_EXECUTION_I .
2017-01-10 12:37:37 +01:00
56fa773b30 If PATH_INFO is "/", the percent encoded path info is also "/". No need for complex computation.
Note this fixes an issue with libfcgi app not hosted as root url such as "/sub/app.fcgi" on (old) IIS server.
2017-01-10 11:59:48 +01:00
ee9746449c If PATH_INFO is empty, the percent encoded path info is also empty. No need for complex computation.
Note this fixes an issue with libfcgi app not hosted as root url such as "/sub/app.fcgi".
2017-01-10 00:16:50 +01:00
e14bb568d2 Extracted compression code from wsf, and provided new wsf_compression library.
Renamed features.
2016-12-06 14:18:51 +01:00
05d37439bc Merge branch 'ewf_compression' of https://github.com/jvelilla/EWF into ewf_compression 2016-12-06 12:53:41 +01:00
9f04c52265 Updated wsf_js_widget example ecf files. 2016-12-06 12:51:37 +01:00
54ebafba0d Updated doc workbook ecf files. 2016-12-06 12:37:41 +01:00
c70d3124df Updated tutorial ecf files to compile with 16.05 and upcoming release. 2016-12-06 12:29:17 +01:00
cad33e124d Fixed a few compilation issue with 16.11 . 2016-12-06 12:15:36 +01:00
ece6607bcf Disable debug clause for the wsf tests suite.
Removed useless dep on EiffelThread
2016-12-05 21:50:02 +01:00
f56aa22c29 Fixed compilation of proxy and simple examples.
Made the websocket client library scoop capable.
2016-12-05 15:56:46 +01:00
186e5514eb If the count for put_file_content is not positive (i.e <= 0), do not send anything.
Output/log more information for request handling when standalone httpd server has verbose enabled.
2016-12-01 21:20:14 +01:00
9fd53b9b1f Fixed debug.ecf file from debug example. 2016-12-01 21:08:13 +01:00
27c77721fd Fixed a few void-safety issue, attribute not initialized before computing agent objects. 2016-12-01 20:41:03 +01:00
c2202e82f6 Fixed compilation of desktop app example. 2016-12-01 18:43:22 +01:00
72a40a2673 Fixed potential void-safety issue in descendants related to initialization of router and filter. 2016-12-01 18:14:07 +01:00
2fbffd0c1e Fixed compilation. 2016-12-01 16:09:41 +01:00
9e5fec9c34 Removed unwanted files. 2016-12-01 15:02:40 +01:00
ca8f95a594 Made library ecf compilable in scoop concurrency mode by default.
So ecf files are compilable with 16.05 and 16.11 .
2016-12-01 14:56:56 +01:00
jvelilla
99bf552b89 Added compression support to WSF_FILE_SYSTEM_HANDLER.
Added a simple example using eiffel web compression.
2016-11-29 18:17:44 -03:00
5a9ccce558 Made library ecf compilable in scoop concurrency mode by default.
Except nino related projects that depends on EiffelThread.
2016-11-01 14:30:19 +01:00
d05c919668 Made the notification_email library compilable with 16.05 and upcoming 16.11 . 2016-11-01 14:22:48 +01:00
087b5d49bb Fixed wsf_js_widget compilation. 2016-11-01 14:01:50 +01:00
c7b1d4bb4c Use the theoretical version number of EiffelStudio when we inserted new features to EiffelNet. 2016-10-31 17:12:55 +01:00
193f22ebc8 Fixed wsf tests project.
Added ini config support to simple_file example.
2016-10-25 15:22:18 +02:00
5e79751522 Updated WGI_OUTPUT_STREAM.put_file_content . 2016-10-25 13:44:44 +02:00
ac908e4efd Fixed expiration, and cache-control: max-age implementation.
Also use `FILE.date` instead of `FILE.change_date` (`change_date` is the date of the last status change, quite often same as creation date, while `date` is the last modification date).
2016-10-24 12:51:21 +02:00
885195dbaa Added WSF_RESPONSE.put_file_content (f: FILE, a_offset: INTEGER; a_count: INTEGER) to allow potential future optimization. 2016-10-24 12:47:33 +02:00
2e49febca8 Fixed the EiffelStudio EiffelWeb wizard. 2016-10-21 19:40:13 +02:00
53f4f64596 Added feature to manipulate easily the chain of filters. 2016-10-21 19:39:42 +02:00
dff9007aa6 Updated (un)install script to include new network, httpd, and websocket libraries. 2016-10-18 13:29:47 +02:00
c34f89df9b Added connection header related functions.
- WSF_REQUEST.is_keep_alive_http_connection: BOOLEAN
  - HTTP_HEADER_MODIFIER.put_connection_keep_alive
  - HTTP_HEADER_MODIFIER.put_connection_close
In Standalone request handler code, better detection of Connection: keep-alive header.
2016-10-18 13:22:32 +02:00
Jocelyn Fiat
4a47a00747 Better all-safe.ecf file under wsf/connector . 2016-10-15 22:37:16 +02:00
Jocelyn Fiat
12508c8e21 Updated to use new standalone option names. 2016-10-15 22:19:19 +02:00
Jocelyn Fiat
3d58ef84fa Fixed void-safety settings on web_socket_protocol.ecf . 2016-10-15 22:14:03 +02:00
Jocelyn Fiat
3a120f3311 Updated http_client library to benefit from http_network library. 2016-10-15 21:42:51 +02:00
Jocelyn Fiat
d45b90e52a Fixed ecf to get them compiled. 2016-10-14 17:57:02 +02:00
c74b9e0c45 The network classes are now under http_network library, thus renamed the header file as ew_network.h . 2016-10-14 16:46:26 +02:00
b8aee435dd Updated simple_ssl example to use directly the standalone connector,
and use the new WSF_STANDALONE_SERVICE_OPTIONS class.
Added WSF_STANDALONE_SERVICE to make it easy to use directly.
2016-10-14 15:13:27 +02:00
Jocelyn Fiat
a4d737d548 Be sure to use ecf custom variable "ssl_enabled" and not the variant "httpd_ssl_enabled" or else.
Include again the openssl include folder for EiffelStudio before 16.11, otherwise eif_openssl is not found.
2016-10-14 14:32:04 +02:00
Jocelyn Fiat
16f667af2c Reverted a few ecf files from ecf version 1-16-0 to ecf version 1-15-0.
Added target "http_network_ssl" to test http_network with ssl support.
2016-10-14 14:00:03 +02:00
Jocelyn Fiat
27a5c9d969 Fixed http_network compilation for EiffelStudio before version 16.11. 2016-10-14 13:51:57 +02:00
32ad7f0c65 Merged changes related to websocket and restructured httpd, http_
network libraries.
2016-10-14 13:17:17 +02:00
78f24ecb37 Updated ws.ini (for now, keep is_secure False, due to remaining issue with websocket and SSL implementation). 2016-10-14 13:11:26 +02:00
1161e541fa Accept "yes" or "true" in wsf launcher option boolean values.
Set socket_error when network occurs in `read_to_managed_pointer_noexception`.
2016-10-14 13:10:44 +02:00
d4ec640ac8 Renamed many classes and feature to use "secure" term instead of "ssl". (note, the .ecf are still using the "ssl" terminologie).
Provided easy way to set secure settings for Standalone.
For wsf launcher boolean option accept "true" or "yes" for True boolean, anything else is False.
2016-10-14 11:52:48 +02:00
01a9d02586 Added websocket examples for the server and client. 2016-10-13 22:01:50 +02:00
1e4203111f Use socket .._noexception functions in websocket networking. 2016-10-13 21:55:53 +02:00
b84f4838f5 Added new WSF_STANDALONE_SERVICE_OPTIONS, a descendant of WSF_SERVICE_LAUNCHER_OPTIONS specialized for standalone connectors. 2016-10-13 21:55:16 +02:00
8b43cb909a Do not use put_readable_string_8_noexception, and just update put_string_8_noexception to accept READABLE_STRING_8. 2016-10-13 21:53:12 +02:00
897f64e4fe Reuse http_network library.
Reintroduced HTTPD_STREAM_SOCKET for backward compatibility, and ease of usage.
Added websocket libraries (client, and protocol).
2016-10-13 16:25:11 +02:00
981942b2d6 Extracted network socket classes from httpd folder, and created a new library/network/http_network library.
Renamed HTTPD_STREAM_SOCKET as HTTP_STREAM_SOCKET.
Made http_client (net) library use the new http_network library.
2016-10-12 23:27:55 +02:00
c132d7734b Moved httpd library from ewsgi/connectors/standalone/lib/httpd to httpd.
Reused the http_network library as well inside httpd library.
2016-10-12 22:54:21 +02:00
Jocelyn Fiat
b66cfce138 Use custom variable net_ssl_enabled instead of httpd_ssl_enabled for the http_netword lib. 2016-10-12 22:23:26 +02:00
d28f794828 Implemented chunked Transfer-Encoding in net_http_client.
Implemented support for buffer_size and chunk_size for net_http_client.
2016-10-12 16:49:08 +02:00
9e92b8c0fa Fixed typo in restbuck name. 2016-10-12 11:21:42 +02:00
ef704790a8 Fixed the "wsf_tests" autocase suite, which was wrong for cookies, and other minor changes. 2016-10-12 11:21:27 +02:00
57b1691243 Added support for debug.ini to debug example. 2016-10-12 11:19:54 +02:00
29590b1c0d Fixed potential issue related to PATH_INFO, and percent_encoded_path_info computing , when script name is in different path. 2016-10-12 11:19:23 +02:00
ed959042d7 Fixed issue with input using "Transfer-Encoding: chunked". 2016-10-12 11:12:37 +02:00
1170417e54 Fixed regression with persistent connection, be sure to keep the remote_info data for all successive requests within a same persistent connection. 2016-10-11 17:34:07 +02:00
2cfe00e61b Updated desktop_app example with embedded standalone web server. 2016-10-11 17:30:50 +02:00
a498a167ed Updated desktop application example for scoop concurrency mode. 2016-10-11 16:20:04 +02:00
f12158e535 Use the ..._noexception network features in the WGI standalone input and output classes. 2016-10-11 10:57:05 +02:00
080881368a Also check for SOCKET.was_error when accessing the socket data. 2016-10-11 10:29:38 +02:00
Jocelyn Fiat
3e935c7e33 Use `was_error' to get expected behavior on Linux. 2016-10-10 22:27:45 +02:00
Jocelyn Fiat
ad2bb0d1a7 Fixed C compilation on non Windows platform for EiffelStudio until 16.05 .
(the required c function are coming with EiffelNet from EiffelStudio 16.11 ).
2016-10-10 22:17:41 +02:00
7a546622bc Updated deprecated EiffelWeb nino to make it compilable with upcoming EiffelStudio 16.11.
Updated various projects to make them up-to-date and compilable with this latest EiffelWeb.
2016-10-10 21:40:15 +02:00
aed7461faf Improved networking implementation for httpd server and sockets.
Use new EiffelNet routines that do not raise exception on error.
Made compilable with 16.05 and dev-and-upcoming release 16.11.
Fixed various minor issues related to base_url, and added comments.
2016-10-08 01:10:16 +02:00
56819d6793 Replace Nino by Standalone whenever it is relevant. 2016-10-08 01:02:12 +02:00
b4fd04ad9f Updated has_incoming_data comment. 2016-10-05 16:19:48 +02:00
71a98f3c28 Make EiffelWeb standalone easier to debug by using in some locations error instead of exception for network error.
- Added C external to use C `recv` feature with error (as opposed to have exception raised on network error).
2016-10-05 10:45:57 +02:00
ed22be2551 Commented the execute_bad_request, since it is not ready and will trigger error most of the time. 2016-10-05 00:04:21 +02:00
77085364ee Improve socket management for EiffelWeb standalone connector. 2016-10-04 18:49:48 +02:00
0217c6d3f4 First attempt to response with bad request message when bad request is detected. 2016-10-04 13:00:38 +02:00
55fec2423c Added ssl test case for standalone wsf connector. 2016-10-04 12:59:56 +02:00
1f7a81a2d6 Updated workbook, minor changes (removed mention about nino, added libfcgi info). 2016-10-04 12:56:11 +02:00
612ff243c1 Also display SSL information when verbose is enabled for EiffelWeb standalone connector. 2016-10-02 20:05:44 +02:00
40fb3893af Include wsf_proxy to the installation process. 2016-09-27 16:18:06 +02:00
21407f8dcf Fixed SSL support on the httpd component, and also on the EiffelWeb standalone connector.
- the standalone connector support for SSL, is using certicate files for now (no in-memory support).
  - to enable ssl support, set ecf variable `httpd_ssl_enabled=true`.
  - added the `simple_ssl` example to demonstrate how to have standalone ssl server.
    (be careful when using EiffelNet SSL and the http_client library, disable the libcurl
      via ecf variable `libcurl_http_client_disabled=true` )

Added support for recv timeout to the EiffelWeb standalone connector.
  - made EiffelWeb compilable with 16.05 and upcoming 16.11.
    Done via ecfs condition on version to accept EiffelNet with recv_timeout (from 16.11), and without (until 16.05).
  - adding recv timeout prevents server to hang for ever if a client wait too long to send data.

Updated various comments.
2016-09-27 16:11:47 +02:00
356eb143ea Fixed the non void-safe ecf for wsf_proxy. 2016-09-26 17:42:49 +02:00
df551d4a4f Use latest API from http_client using DEFAULT_HTTP_CLIENT,
that could use libcurl or EiffelNet depending on the configuration (.ecf).
2016-09-26 13:13:57 +02:00
f010da04e9 Merge branch 'reverse_proxy' 2016-09-19 22:19:21 +02:00
5029049ef0 Replaced host+port by uri (http://remotemachine:port/path).
Added support for SSL (https).
2016-08-08 12:30:28 +02:00
80254b2278 When possible keep ecf location relative within the same EiffelWeb directory structure. 2016-08-06 10:07:42 +02:00
210fae5000 First step towards SSL support. 2016-08-06 10:04:45 +02:00
9cc9b95190 Added a simple reverse proxy handler.
- For now, it does not support SSL connection on the target yet.
- No external config file support, this is all about coding.
2016-08-05 11:38:35 +02:00
8b172b5d33 Revisited WSF_REQUEST.read_input_data* functions:
- read_input_data_into_file now accepts a IO_MEDIUM argument instead of just FILE.
- cleaned the implementation, and make sure that eventual `raw_input_data` is containing only the raw input data.
2016-08-05 11:32:14 +02:00
cc2d7dbb1c Ignore empty header line. 2016-08-05 11:28:59 +02:00
c88394b9fd Added support for category in ATOM format (input and output). 2016-06-24 13:03:09 +02:00
4283662f43 Removed unwanted .ecf file. 2016-06-22 10:55:41 +02:00
1b951376f9 Added more application logic for the example. 2016-06-22 10:52:36 +02:00
193cc3cbde Renamed WGI_STANDALONE_CONNECTOR_ACCESS as WGI_STANDALONE_CONNECTOR_EXPORTER.
Isolate the websocket implementation in descendant of {WEB_SOCKET_EVENT_I}.
Added very simple echo websocket example.
+ code cleaning.
2016-06-22 10:46:15 +02:00
b49e841ac7 Added WSF standalone_websocket connector, that provides websocket on top of standalone connector. 2016-06-21 23:37:48 +02:00
8ba74e1c90 Log when a persistent connection is reused.
Use anchor type on `{WGI_STANDALONE_CONNECTOR}.configuration` and `{WSF_STANDALONE_SERVICE_LAUNCHER}.connector`.
Add access to the socket of standalone input stream from `{WSF_STANDALONE_CONNECTOR_ACCESS}`.
Removed a useless redefination in `WSF_EXECUTION`.
2016-06-21 23:36:22 +02:00
0cecb9594c Fixed signature of {HTTPD_CONFIGURATION_I}.set_ca_key . 2016-06-16 10:37:26 +02:00
e384a6d6ed Make it easier to reuse the http network classes.
This is to make it easier for websocket solution to reuse httpd implementation.
2016-06-16 10:23:30 +02:00
71a5c086a5 Moved httpd from src to lib, under standalone connector. 2016-06-15 18:04:00 +02:00
dfa60bf8f5 Prepared httpd_stream to be useable for client too.
Fixed obsolete tests/dev compilation (mainly to avoid wrong failure reports).
added package.iron files.
2016-06-15 17:56:22 +02:00
113aa69efc Added advanced settings for standalone connector
- max_concurrent_connections=100
- keep_alive_timeout=15
- max_tcp_clients=100
- socket_timeout=300
- max_keep_alive_requests=300
And then can be set via the options as well, and via .ini file.
Also improved the verbose console output system.
2016-06-15 09:19:23 +02:00
af5fc75743 Using passive regions.
Improve connector options mainly for standalone connector.
Updated "simple" example to return a timestamp.
2016-06-14 16:01:37 +02:00
Jocelyn Fiat
e53c960a89 Added libfcgi target, in addition to standalone target for the upload_image example. 2016-05-31 22:24:26 +02:00
Jocelyn Fiat
63be2c278c Fixed bad usage of {SOCKET}.socket_ok that resulted in bad behavior on linux. 2016-05-31 22:19:52 +02:00
Jocelyn Fiat
f8ba741aa2 Using -lfcgi as external linker flag, rather than /usr/lib/libfcgi.so .
Note on Ubuntu: apt-get install libfcgi-dev
2016-05-31 18:51:15 +02:00
Jocelyn Fiat
fe07af587d Updated link to github pages documentation. 2016-05-31 16:57:06 +02:00
Jocelyn Fiat
a3a9dd1393 Fixed link to image or source code in markdown workbook text. 2016-05-31 16:51:20 +02:00
Jocelyn Fiat
fbb860024d Updated markdown text to conform strictly to kramdown syntax. 2016-05-31 16:39:50 +02:00
Jocelyn Fiat
a14488346f Updated to kramdown markdown syntax (i.e github).
Updated various content and nav links.
2016-05-27 09:51:24 +02:00
Jocelyn Fiat
f74d1b3069 Updated markdown relative links. 2016-05-26 23:11:19 +02:00
Jocelyn Fiat
1ba3528974 Added readme.md in /doc/. And updated workbook readme.md itself. 2016-05-26 10:41:07 +02:00
5890ca6f73 Removed warning about unknown class in export clause. 2016-05-25 22:51:45 +02:00
7f4bf09d84 updated readme.md to link to workbook. 2016-05-25 19:17:38 +02:00
Colin Adams
ad90e7c135 Fix for missing error reporting in WSF_PUT/POST_HELPER 2016-05-20 17:37:47 +02:00
cc3c8af6b4 Updated HTTP_COOKIE implementation
- by default the Cookie does not set max-age and expires, so it defines a Session Cookie.
   (max_age and expires attributes are not included in the response)
 - set_* and unset_* features to define max_age and expire attributes.
 - marked old features as obsolete.
Updated test cases.

Signed-off-by: jvelilla <javier.hector@gmail.com>
2016-05-04 12:26:17 +02:00
b35ec65577 Updated EWF Windows tools to install EWF into EiffelStudio source tree. 2016-02-03 18:03:43 +01:00
4482520a86 Removed useless library declarations. 2016-02-03 15:12:54 +01:00
e9afc9ad17 Updated package.iron files. 2016-02-02 09:57:03 +01:00
55ab6969ee Do not html escape ' with &apos;
reason: the named character reference &apos; (the apostrophe, U+0027) was introduced in XML 1.0 but does not appear in HTML. Authors should therefore use &#39; instead of &apos; to work as expected in HTML 4 user agents.
2016-01-20 17:53:06 +01:00
d982bc06ad Eiffel code and ECFs update to support new agent notations. 2016-01-18 21:42:59 +01:00
2ca87d53b8 Added process_transfer to implement process_file. This way, it is easier to redefine the transfert implementation, or the process_file directly, if needed. 2016-01-18 17:05:35 +01:00
1a4db1d7c6 Eiffel code and ECFs update to support new agent notations.
Removed contrib/library/.../json library.
2016-01-18 16:41:10 +01:00
3bb9101b07 Improved error library by refactorying the sync as two way propagation.
Now one can setup error handler propagation in one way, or two way (sync).
The "reset" applies in both way, even if this is a one way propagation to fit current existing usage.
Added optional id for the error handlers.
Feature renaming according to design changes.
Added related autotest cases.
2016-01-12 16:09:29 +01:00
1b2496b7f0 Better EMAIL.message computing.
Send end of input file for stdin mode.
2016-01-12 16:04:24 +01:00
d20c377580 Fixed Reply-To: implementation in notification mailer.
Added helper routines to query additional header, and reset Cc:, and Bcc: values.
2016-01-08 21:46:01 +01:00
166d0839b7 Fixed end_of_input by using SOCKET.readable. 2015-12-28 23:45:04 +01:00
fbe0732210 Removed uuid in wsf_session ecf files. 2015-12-28 18:05:18 +01:00
b5d6a75155 Fixed table item output by appending html attribute for WSF widget table item. 2015-12-28 17:40:59 +01:00
4fc4b02449 Made WSF_TABLE a TABLE_ITERABLE. 2015-12-28 17:40:20 +01:00
5276bd1479 Fixed URI mapping with regard to trailing slash handling. 2015-12-28 17:39:54 +01:00
Javier Velilla
81ab31b19a Updated workbook
Added EWF Deployment title
2015-12-22 11:44:21 -03:00
Javier Velilla
e21e30ff74 Updated workbook
Added deployment document
2015-12-22 11:43:17 -03:00
Javier Velilla
3a9ba75717 Initial commit Deployment file 2015-12-22 11:37:25 -03:00
7d94413297 removed non void-safe tests.ecf for feeds library 2015-11-05 21:48:17 +01:00
35855941e6 Comment and code cleaning. 2015-11-05 21:37:44 +01:00
50ba8ca703 Fixed various unicode issue related to query and form parameters.
(Especially for the multipart/form-data encoding.)
Factorized code related to smart parameters computing (handling list , table, ...) in WSF_VALUE_UTILITIES.
Fixed an issue with percent_encoded_path_info computation from request_uri.
Fixed issue with cookie addition having same cookie name.
Fixed unicode support for uploaded file.
WSF_STRING is reusing WSF_PERCENT_ENCODER.
Use unicode output for WSF_DEBUG_HANDLER.
Code cleaning
2015-11-05 21:32:24 +01:00
dde6a0b7de Added specific configuration file, so that it is easier to use either libcurl or net implementation. 2015-10-19 08:46:31 +02:00
b64a281d75 Fixed timeout issue due to too many "ready_for_reading".
Fixed Connection behavior.
Fixed Content-Type settings.
Removed condition on POST or PUT, since code also applied to any request methods.
Added verbose output implementation.
2015-10-19 08:46:30 +02:00
b69b8aaaf9 Added first support for persistent connection in NET http client implementation.
Various improvement related to eventual errors.
2015-10-19 08:46:29 +02:00
65b28ed877 Updated README.md with configuration topics related to libcurl or net disabling.
Fixed ssl test by precising insecure ssl.
2015-10-19 08:46:27 +02:00
6c7637716b Updated a few comments
Removed useless NULL_HTTP_CLIENT.
Extracted mime code from NET_HTTP_CLIENT_REQUEST.response into specific routine.
2015-10-19 08:46:26 +02:00
ff9a238f5c Added https support with Net implementation.
Added notion of default HTTP_CLIENT, to be able to build portable code among http client implementation.
2015-10-19 08:46:25 +02:00
eec3cbdba1 Added null http client for upcoming changes.
Refactored NET request implementation.
  - fixed potential issue with header conflict.
  - simplified, and extract parts of the code into routine.
  - Implemented read of chunked Transfer-Encoding
  - Fixed potential issue with socket handling.
First steps to be able to exclude net or libcurl implementation when using http_client lib.
Removed from NET implementation the hack related to PUT and upload data (it was used to workaround an issue with libcurl).
2015-10-19 08:46:23 +02:00
29c4931dc0 Added support for chunked transfer-encoding response.
Implemented correctly the redirection support for NET_HTTP_CLIENT...
Added the possibility to use HTTP/1.0 .
Splitted the manual tests that were using during development.
First step to redesign and clean the new code.
2015-10-19 08:46:22 +02:00
Florian Jacky
9cd0f0b117 Fixed configuration files 2015-10-19 08:46:21 +02:00
Florian Jacky
aa0eb4fc43 Fixed configuration files 2015-10-19 08:46:20 +02:00
Florian Jacky
dbdc594b59 config files 2015-10-19 08:46:18 +02:00
Florian Jacky
4176a8c68b correct password for authentication test 2015-10-19 08:46:17 +02:00
Florian Jacky
0557d1ee2d added remaining features 2015-10-19 08:46:16 +02:00
Florian Jacky
eed8af9a0a now supports sending requests, receiving headers, receiving message text, redirection, agent header, cookies, basic http authorization, sending data using post using url-encoding, sending file as post as data, sending put data 2015-10-19 08:46:15 +02:00
Florian Jacky
1b881c4f60 implemented http authorization, support for redirection and user-agent 2015-10-19 08:46:14 +02:00
Florian Jacky
770488dbd3 implemented http authorization, support for redirection and user-agent 2015-10-19 08:46:12 +02:00
3f69081d32 Added postcondition to ensure the result of {HTTP_CLIENT_REQUEST}.response is attached.
(useless with void-safety compilation, but keep it for non void-safe execution).
2015-10-19 08:46:11 +02:00
7033db7dc4 Removed useless redefination of is_equal. 2015-10-19 08:46:10 +02:00
a1a16b4a22 Fixing http_client.ecf file with correct locations. 2015-10-19 08:46:09 +02:00
98e92ee0fe Basic initial Eiffel NET implementation. 2015-10-19 08:46:07 +02:00
29b55f36cf Added skeleton for Eiffel Net implementation of HTTP_CLIENT solution.
This is work in progress.
2015-10-19 08:46:06 +02:00
061e88c9fe Added FEED.prune (a_item: FEED_ITEM). 2015-10-14 17:40:38 +02:00
66f204b1f2 Make custom error interface more flexible with READABLE_STRING_... instead of STRING_... 2015-10-10 00:58:07 +02:00
c92b1b8c3b Added feed to xhtml visitor.
Updated interfaces, mainly related to date attributes.
2015-10-09 19:08:53 +02:00
98c12b8fb9 Made HTTP_DATE more flexible and support UTC+0000, GMT+0000 and now also +0000.
Added comments.
2015-10-08 11:00:01 +02:00
5fee483fd9 Added FEED + FEED operator to merge two feeds.
Added FEED sorting routine.
Added FEED_ITEM.link: detachable FEED_LINK that represents the main feed link.
Comments.
2015-10-08 10:10:08 +02:00
f7a7afccd6 Fixed compilation of non void-safe feed.ecf 2015-10-05 22:58:58 +02:00
e2c70e6d70 Updated a few comments.
Renamed generator to follow *_FEED_GENERATOR naming.
Renamed feed entry as feed item.
Made FEED conforms to ITERABLE [FEED_ITEM] for convenience.
2015-09-16 10:02:09 +02:00
a5e150d1c0 Improved feed library with comments, bug fixes and code factorization. 2015-09-08 21:45:27 +02:00
39887c8bdb Added initial ATOM and RSS feed parser and generator.
(work in progress)
2015-09-07 19:22:50 +02:00
jvelilla
1f1e2abbda Removed support for SSLv3 2015-08-26 11:56:24 -03:00
1796d9631f Added target "all_stable_with_ssl" to check compilation with ssl enabled. 2015-08-26 13:38:50 +02:00
389975e409 Merge branch 'v1' 2015-08-24 16:13:01 +02:00
6c51590369 Updated installation location of openid and http_authorization in ISE package.
Added iron package file for ewsgi.
2015-08-24 16:12:25 +02:00
jvelilla
cc65bae644 Fixed typo: Aug instead of Aou. 2015-08-06 10:45:47 +02:00
jvelilla
c824f707cf Fixed typo: Aug instead of Aou. 2015-08-06 10:42:15 +02:00
47c5b798b3 Cosmetic true -> True 2015-08-04 13:24:03 +02:00
f0cba1d536 Fixing script_url' that wrongly used path_info' instead of `percent_encoded_path_info'.
(issue on script_url when path info contains unicode character).
2015-08-04 13:21:36 +02:00
ed891546bc Updated set_value for WSF_FORM_SELECTABLE_INPUT (for example a checkbox).
Call the feature set_checked_by_value iff the the current value exist in the
list of values, in other case set checked in Flase.
If we call set_checked_by_value without filter, previous checked values will be
set in False.
2015-08-04 13:21:07 +02:00
8651ff6e1e Fixing script_url' that wrongly used path_info' instead of `percent_encoded_path_info'.
(issue on script_url when path info contains unicode character).
2015-08-04 13:03:51 +02:00
629edea991 Merge remote-tracking branch 'javier/ewf_html_form' into v1 2015-08-04 13:00:08 +02:00
jvelilla
1e10ce8518 Updated set_value for WSF_FORM_SELECTABLE_INPUT (for example a checkbox).
Call the feature set_checked_by_value iff the the current value exist in the
list of values, in other case set checked in Flase.
If we call set_checked_by_value without filter, previous checked values will be
set in False.
2015-07-31 11:55:23 -03:00
4f8f17ad48 Fixed various compilation issues.
Ensure the obsolete/v0 ecf has new UUID.
2015-07-03 20:02:13 +02:00
148518984e Added the possibility to provide the sendmail location in NOTIFICATION_SENDMAIL_MAILER.
Added NOTIFICATION_STORAGE_MAILER which allow to store the email in a storage (could be just output, file, database ...)
Added SMTP implementation, based on EiffelNet SMTP_PROTOCOL.
   note: it is possible to exclude this by setting ecf variable "smtp_notification_email_disabled" to "True"
   this way help to manage dependencies, since the Eiffel Net library would not be included neither.
Fixed Date header value computation.
2015-07-03 10:02:56 +02:00
33150e34d6 Reverted previous changed related to redefinition of set_status_code which was against existing assertions. 2015-07-02 15:11:33 +02:00
af60a5719e Updated eiffelstudio locations for EWF libraries. 2015-07-02 13:06:38 +02:00
31557cfc33 Fixed WGI_HTTPD_REQUEST_HANDLER.process_rescue
Fixed WGI_STANDALONE_OUTPUT_STREAM.is_available
Added WGI_STANDALONE_RESPONSE_STREAM.is_persistent_connection_supported
2015-07-02 10:50:41 +02:00
78c0cd5b0d Merge branch 'v1' of https://github.com/EiffelWebFramework/EWF into v1 2015-07-01 21:48:47 +02:00
412534d0be Fixed compilation of all*-safe.ecf files.
Corrected a few comments.
2015-07-01 21:43:54 +02:00
jvelilla
0f6aa8d7ae Merge branch 'jvelilla-ewf_v1_workbook' into v1 2015-06-30 09:58:40 -03:00
jvelilla
2c745c63d3 Updated workbook: generating response, handling cookies and headers documents. 2015-06-30 09:21:12 -03:00
jvelilla
efd80c1287 Updated workbook form document 2015-06-30 09:00:47 -03:00
jvelilla
01f649fd88 Updated: workbook headers document.
Removed: unnecessary files.
2015-06-30 08:57:00 -03:00
jvelilla
f23aeb6412 Updated Workbook basic documentation. 2015-06-30 08:42:29 -03:00
jvelilla
1a4596c79b Merge branch 'ewf_v1_workbook' of https://github.com/jvelilla/EWF into ewf_v1_workbook 2015-06-29 19:05:25 -03:00
jvelilla
b16e4aa570 Updated basic documentation 2015-06-29 19:03:54 -03:00
Javier Velilla
5255b15fa9 Update basics.md 2015-06-29 18:36:44 -03:00
jvelilla
57048373f4 Update basic document 2015-06-29 18:30:11 -03:00
Javier Velilla
9e06fb2ab8 Update basics.md 2015-06-29 16:24:09 -03:00
Javier Velilla
f2405e0ccd Update basics.md 2015-06-29 16:22:01 -03:00
Javier Velilla
6e3a7deb6e Update workbook.md 2015-06-29 16:20:19 -03:00
jvelilla
f254b599c0 Update basic document to the new EWF concurrent design 2015-06-29 16:17:43 -03:00
99a05b95ba Improved code related to cookie management (avoid duplicated cookie). 2015-06-22 22:06:16 +02:00
54dd43c38a Synchronized wsf-safe.ecf and wsf.ecf 2015-06-18 14:53:19 +02:00
903f925a79 Changed the way SSL is supported with standalone connector (httpd lib).
Now by default, SSL is not supported,
  and if an application wants the SSL support,
  the related .ecf has to set custom variable "httpd_ssl_enabled" to "true"
2015-06-17 17:22:59 +02:00
80709578d6 Updated workbook Eiffel code to follow new EWF concurrent design. 2015-06-16 20:34:57 +02:00
c0d5b7c968 Added make_from_execution procedure to ease implementing various use cases. 2015-06-16 15:02:17 +02:00
7bea163f46 Updated ecf from obsolete v0 folder to include the "_v0" suffix in the library names. 2015-06-14 21:34:41 +02:00
8992dbc515 Added wsf_html in the obsolete v0 folder.
mostly because it is also dependent on "wsf", so it has to be using the obsolete v0 ecf.
2015-06-12 19:01:35 +02:00
c2d3ea6138 Simplified file names, and harmonized with estudio wizards. 2015-06-12 12:56:46 +02:00
9e336deb49 Updated EWF estudio wizard. 2015-06-12 12:43:54 +02:00
0160ce05dd Updated wizard template ecf to take into account current limitation, or known issue related to libcurl and ssl. 2015-06-12 12:00:54 +02:00
7d089a88c2 Made compilable without SSL enabled
(i.e when variable named "httpd_ssl_disabled" is set to "true")
2015-06-11 10:08:44 +02:00
ab0bc7b314 Marked most of the *_with_request_methods procedure obsolete by the same feature name without the "_with_request_methods".
Added argument passing request methods to feature without the _with_request_methods.
Prefer "thread" concurrency for now in examples.
2015-06-10 17:52:26 +02:00
0e3e97a7fd Added a few example based on the obsolete libraries (v0).
Updated the tutorial example.
Added WSF_MESSAGE_EXECUTION.
2015-06-10 16:49:23 +02:00
b790c7fd21 cosmetic, cleaning. 2015-06-10 10:59:24 +02:00
d0836d49a4 Merge branch 'v1' 2015-06-10 09:49:28 +02:00
9424b1e369 Merge branch 'master' into v1 2015-06-08 10:10:51 +02:00
64463df552 Fixed various compilation error or warning. 2015-06-05 12:17:53 +02:00
jvelilla
61f90bba38 Merge branch 'jvelilla-ewf_wsf_html5' 2015-05-29 15:38:30 -03:00
jvelilla
fac3dd3946 Merge branch 'ewf_wsf_html5' of https://github.com/jvelilla/EWF into jvelilla-ewf_wsf_html5 2015-05-29 15:38:08 -03:00
jvelilla
e1b583a2b3 Updated code based on comments 2015-05-28 10:07:40 -03:00
jvelilla
8c8dfdd4a3 Updated code based on review 2015-05-28 10:04:13 -03:00
jvelilla
857397e226 Updated code inherit from SHARED_HTML_ENCODER instead of creating new objects. 2015-05-28 09:39:14 -03:00
jvelilla
94340c1c01 Updated html5 classes based on review 2015-05-28 09:19:21 -03:00
8b60ab08e3 Added WSF_FILE_UTILITIES.new_file (p: PATH): detachable G
in order to provide non existing file, but not only for temporary files purpose.
2015-05-22 22:27:28 +02:00
jvelilla
28e51cc314 Initial import HTML5 support for attributes and input types.
Attributes
- Added support for new HTML5 attributes.
missing support for : form, list, and multiple attributes.

Input types: added the all the new input types.

Added test cases, still in progress.
2015-05-21 12:32:08 -03:00
jvelilla
a7c8d40b3e Moved EWF workbook from ewf_example to EWF main repository. 2015-05-18 11:06:04 -03:00
d4c0ff03b4 Added package.iron for nino library. 2015-05-12 19:04:36 +02:00
7fbfda3a66 Refactored wsf router dispatching implementation.
Now the path to take into account during dispatching is computed once
  in WSF_ROUTER.path_to_dispatch (req: WSF_REQUEST): READABLE_STRING_8
  And this function could be redefined in descendant of WSF_ROUTER.
2015-05-12 18:37:25 +02:00
9e467689df improved nino port number validation 2015-05-12 18:25:22 +02:00
dd5c89e31c Fixed compilation of SSL_TCP_STREAM_SOCKET with recent do_accept changes. 2015-05-07 10:44:38 +02:00
fffa763d05 Updated a few comments. 2015-05-06 22:37:55 +02:00
d015c065f6 Updated readme. 2015-05-06 22:18:27 +02:00
8ea443c115 Added abstraction WSF_ROUTED, and WSF_FILTERED.
Added under library/server/obsolete/v0 the previous non concurrent friendly version of EWF/WSF, for backward compatiblity.
Removed WSF_CALLBACK_SERVICE and WSF_TO_WGI_SERVICE which are not need with new EWF.
2015-05-06 22:17:37 +02:00
019393fdb1 Fixed typo. 2015-05-06 22:17:35 +02:00
da8028f8b3 Fixed a typo. 2015-05-06 22:17:33 +02:00
20ed000879 Added a few descriptions and comments. 2015-05-06 22:16:57 +02:00
jvelilla
24620b228c Added feature comments.
Added missing postconditions.
2015-05-06 22:16:10 +02:00
jvelilla
9c7e29b836 Added descriptions and comments 2015-05-06 22:16:08 +02:00
jvelilla
a0e9a41e21 Added descriptions and feature comments. 2015-05-06 22:16:07 +02:00
jvelilla
dd9aff03d3 Added features comments. 2015-05-06 22:16:05 +02:00
jvelilla
dc35925eb0 Added Missing Class and feature descriptions.
Removed author entry.
2015-05-06 22:16:03 +02:00
a1a620a9c3 Export request and response from WGI_EXECUTION to itself.
Added WSF_FILTERED_ROUTED_SKELETON_EXECUTION
2015-05-06 22:16:00 +02:00
d8ea9ba63c renamed keep_alive_requested as is_persistent_connection_requested. 2015-05-06 22:15:59 +02:00
c42af5b2de Following the spec, use "keep-alive" and "close" in lowercase for Connection header. 2015-05-06 22:15:57 +02:00
d9cbc72058 Better support for HTTP/1.0 and also related to persistent connection. 2015-05-06 22:15:56 +02:00
7e057b20b1 Improved support for HTTP/1.0 persistent connection. 2015-05-06 22:15:54 +02:00
3165c1e5c6 Enable support for persistent connections.
(test: works fine with curl -k , but weird behavior with ab -k ...)
2015-05-06 22:15:53 +02:00
89e26519e4 First step to improve a bit error handling related to socket disconnection.
Mainly in standalone connector for now.
2015-05-06 22:15:51 +02:00
9d20e85c03 Improved the simple_file example with image, and not found message.
Use standalone connector in SCOOP concurrency mode.
2015-05-06 22:15:50 +02:00
48cb99498c Cleaned simple example, and made the standalone target with SCOOP concurrency. 2015-05-06 22:15:48 +02:00
8246bc1444 Updated various indexing notes.
Removed a few obsolete classes.
Cosmetics
2015-05-06 22:15:46 +02:00
9e1083eba8 Added migration note. 2015-05-06 22:15:44 +02:00
4907bc3085 Migrated most of the example and library to new design. 2015-05-06 22:15:43 +02:00
7d2ce8a77f Implemented support for base url in httpd connector. 2015-05-06 22:15:38 +02:00
b4a9c92ffc Migrated simple, simple_file and upload_image example.
Adapted EWF accordingly.
2015-05-06 22:14:48 +02:00
bf0eb9a02d Added SCOOP support for WSF.
WSF_SERVICE is deeply changed, and addition of WSF_EXECUTION.
Todo: code cleaning, removing useless things.
2015-05-06 22:13:22 +02:00
ddf73077b3 Support for concurrencies: none, thread and SCOOP 2015-05-06 22:13:19 +02:00
3da80fce0d Finally SCOOP supported. 2015-05-06 22:13:17 +02:00
0970de5dc6 Experiment to avoid pseudo sequential execution 2015-05-06 22:13:15 +02:00
557b11f4e6 First attempt to use `{NETWORK_STREAM_SOCKET}.accept_to' 2015-05-06 22:13:13 +02:00
7f27a6c797 First steps to provide a concurrent compliant EWF connector. 2015-05-06 22:13:11 +02:00
c778e454cd Renamed a few index.md as README.md 2015-05-05 11:13:12 +02:00
44757b73eb Renamed Home.md as README.md 2015-05-05 11:10:36 +02:00
525978db1d Update doc structure, and fixed a few links. 2015-05-05 10:57:58 +02:00
71c90a2f39 Updated mediawiki and markdown link to local pages,
in order to use those files as browseable documentation, and close the github wiki.
2015-05-05 10:22:21 +02:00
8057dca032 Merge remote-tracking branch 'ewf_wiki/master' 2015-05-05 10:06:12 +02:00
91d7b956b9 update README to add google groups info. 2015-05-05 09:58:36 +02:00
881625a0f6 Updated code to remove obsolete call on recent version of json library.
Updated upload_image example to use PATH instead of DIRECTORY_NAME or similar.
Removed unused local variables.
2015-04-07 19:27:30 +02:00
b7a12eddaf Merge branch 'master' of https://github.com/eiffelhub/json 2015-04-07 18:36:38 +02:00
jvelilla
44b1ccbc3c Merge branch 'jvelilla-ewf_cookie' 2015-03-20 09:35:51 -03:00
jvelilla
30261632f6 Updated HTTP_COOKIE, enable to add a cookie with empty value.
Added feature to check if a date is valid rcf1123 is_valid_rfc1123_date.
Added test cases related to valid cookie dates.
Updated wsf_response add_cookie basedo on review comments.
2015-03-19 15:23:06 -03:00
jvelilla
08db0748f4 Updated is_valid_character, using NATURAL_32 as an argument to avoid multiple conversions.
Updated add_cookie, added features has_cookie_name and is_cookie line to avoid the use of
STRING.split and STRING.start_with.
2015-03-19 09:39:41 -03:00
jvelilla
9dc22bee24 Updated HTTP_COOKIE class based on comments.
Added missing descriptions in test classes
2015-03-17 17:00:07 -03:00
jvelilla
c4d362ff31 Added the add_cookie feature
Added test cases to check cookies in WSF_RESPONSE-
Added mock classes use for test cases.
2015-03-17 14:27:53 -03:00
jvelilla
4a35ff7b77 Updated code based on Jocelyn's comments. 2015-03-13 17:41:48 -03:00
jvelilla
871e9792a5 Added HTTP_COOKIE and test cases.
Added WSF_COOKIE class, inherit from HTTP_COOKIE.
2015-03-13 15:28:38 -03:00
5f4ab50bf9 Completed configuration setting to be compilable with recent changes in EiffelNet / NETWORK_STREAM_SOCKET interface. 2015-03-12 22:16:28 +01:00
f0a49aaf0a fixed location of before_15_01 folder. 2015-03-11 14:52:14 +01:00
1aae58e00b Removed the -safe since now new project should be void-safe 2015-03-05 20:37:28 +01:00
f81e5251e8 moved wizard under tools/estudio_wizard 2015-03-05 16:01:45 +01:00
b26504b4a1 moved wizard from tools to helpers 2015-03-05 16:00:43 +01:00
4eddad0bcb Updated script to install wizard in current EiffelStudio installation. 2015-03-05 15:27:29 +01:00
1b9aa0c598 Updated the ewf estudio wizard to have a console and a graphical wizard.
Usage:  wizard -callback file.cb path-to-rootdir folder.
2015-03-05 15:23:13 +01:00
6e52774507 Prepare nino ecf to be compilable with upcoming changes in EiffelNet / NETWORK_STREAM_SOCKET interface.
As EiffelNet release is related to EiffelStudio release,
   the condition "compiler version <= 15.02) is used,
   which means that before for release 15.01 and previous EiffelStudio
   releases, the project uses a specific TCP_STREAM_SOCKET, and for
   upcoming releases, it will use another version of that class).
  (see rev#96640 from eiffelstudio subversion repository)
2015-02-18 10:14:08 +01:00
e5403462bc Prepare nino ecf to be compilable with upcoming changes in EiffelNet / NETWORK_STREAM_SOCKET interface.
(see rev#96640 from eiffelstudio subversion repository)
2015-02-18 10:08:36 +01:00
33b555ff27 Fixed implementation of JSON_PARSER.is_valid_number (STRING): BOOLEAN 2015-01-08 18:57:31 +01:00
4c552671c1 Updated install_ewf.bat to use the new "ecf_tool" from https://svn.eiffel.com/eiffelstudio/trunk/Src/tools/ecf_tool . 2014-12-02 10:51:08 +01:00
25a362d043 Added more test cases for cookies. 2014-12-02 10:50:29 +01:00
023e03bb8f Completed change on debug handler and filter, to use WSF_DEBUG_INFORMATION. 2014-12-02 10:45:33 +01:00
0caad2105f Merge branch 'fix_cgi_value' of github.com:jocelyn/EWF 2014-12-01 15:53:45 +01:00
f14fdc2a69 Added assertions on router helpers, and also agent handler.
Closes issue #159
2014-12-01 15:44:49 +01:00
440d3f9c91 Fixing issues related to status code. 2014-11-28 16:10:50 +01:00
975ef90bab Better code for restbucks ORDER_HANDLER related to allowed_cross_origins and last_modified. 2014-11-28 16:06:30 +01:00
8c63e74b81 Fixed compilation of restbucks example using the policy driven framework. 2014-11-25 22:19:46 +01:00
6b9d248542 WSF_TRACE_RESPONSE should include "Content-Type: message/http" header
Close issue #145
2014-11-25 15:55:48 +01:00
6d2318ac9b Fixed issue#157 (WSF_REQUEST.cookies_table does not terminate on cookies without a value, or ending with semi-colon)
Added related autotest.
2014-11-24 22:22:12 +01:00
Colin Adams
0f76518b63 Added {WSF_REQUEST}.http_content_encoding 2014-11-19 14:41:50 +00:00
Colin Adams
bb5faec3c6 Issue #154 (documentation error in {WSF_SKELETON_HANDLER}.check_request) 2014-11-19 10:35:06 +00:00
Colin Adams
22301fc15d issue #149 (Simple CORS support for GET requests in policy-driven framework) 2014-11-18 16:02:10 +00:00
Colin Adams
f482ef06d5 Issue #150 (VARY header set to header contents rather than heqader name) 2014-11-18 13:48:38 +00:00
Colin Adams
4f62da8f90 Issue #144 (Add last_modified to WSF_SKELETON_HANDLER) 2014-11-18 10:37:36 +00:00
Jocelyn Fiat
eaa3dd435a Merge pull request #148 from colin-adams/response-code-411
Policy-driven framework should reject PUT requests that contain a Content-Range header

Close Issue #143
2014-11-17 17:37:06 +01:00
Colin Adams
e1d1d52260 Issue #143 2014-11-17 16:20:28 +00:00
0cc0ba047f Reintroduced parse_object as obsolete, to avoid breaking existing code. 2014-11-17 16:05:33 +01:00
641e114fed Converted ecf file to complete void-safe.
Improved JSON_PRETTY_STRING_VISITOR to support STRING_8 or STRING_32 output.
Added examples.
Added doc in the folder "doc".
Updated Readme and other files.
Added package.iron file.
2014-11-17 11:22:33 +01:00
73d45c9817 Updated WSF_FILE_UTILITIES with class comment,
and avoid having expanded generic class.
2014-10-28 12:52:23 +01:00
519b959073 Fixed compilation issue for wsf_js_widget package. 2014-10-10 16:06:03 +02:00
2cc751f326 Fixed compilation for wsf tests. 2014-10-10 14:26:50 +02:00
99588faf40 fixed compilation of filter example. 2014-10-10 13:51:20 +02:00
Jocelyn Fiat
9c6b6b978a Merge pull request #11 from jocelyn/improved_sept_2014
Fixed various issue with parsing string (such as \t and related),
    Implemented escaping of slash '/' only in case of '</' to avoid potential issue with javascript and </script>
    Many feature renaming to match Eiffel style and naming convention, kept previous feature as obsolete.
    Restructured the library to make easy extraction of "converter" classes if needed in the future.
    Marked converters classes as obsolete.
    Updated part of the code to use new feature names.
    Updated license and copyright.
    Updated classes with bottom indexing notes related to copyright and license.
2014-10-03 18:46:00 +02:00
0647a74875 Ensure backward compatibility for parse' / is_parsed'. 2014-10-03 18:44:09 +02:00
Jocelyn Fiat
de9d99e6bc Merge pull request #140 from jvelilla/ewf_router
Updated WSF_ROUTER, to import an existing router definition.
2014-10-01 19:41:38 +02:00
ae9f67391c Marked converters classes as obsolete. 2014-09-30 10:46:28 +02:00
82f832a556 Updated license and copyright.
Updated classes with bottom indexing notes related to copyright and license.
2014-09-30 10:46:12 +02:00
19dbbf89e7 Fixed various issue with parsing string (such as \t and related),
Implemented escaping of slash '/' only in case of '</' to avoid potential issue with javascript and </script>
Many feature renaming to match Eiffel style and naming convention, kept previous feature as obsolete.
Restructured the library to make easy extraction of "converter" classes if needed in the future.
Updated part of the code to use new feature names.
2014-09-24 20:08:12 +02:00
Olivier Ligot
5d6e3c69ee Fix filter example: logging filter must be the last one 2014-09-18 13:29:24 +02:00
Olivier Ligot
984d04e972 Filter example: add fcgi target 2014-09-17 17:11:37 +02:00
Olivier Ligot
83486ae0cc Fix authentication filter: use {HTTP_AUTHORIZATION}.is_basic 2014-09-17 15:40:43 +02:00
jvelilla
4fe5c5da7e Updated WSF_ROUTER.import feature. 2014-09-12 10:54:22 -03:00
jvelilla
ec1d8ca52f Updated WSF_ROUTER, to import an existing router definition. 2014-09-10 12:57:34 -03:00
Olivier Ligot
0404627153 Merge remote-tracking branch 'upstream/master' 2014-07-11 15:00:20 +02:00
jvelilla
de282948e6 Merge pull request #9 from Conaclos/working
Apply pretty tool.
2014-07-08 17:25:35 +02:00
Jocelyn Fiat
93f1fed997 Merge pull request #139 from jocelyn/widget_integration
Added custom-template in examples, as a base template to integrate easily other JS widgets.
2014-07-07 12:30:10 +02:00
f6ebd414d6 Added custom-template in examples, as a base template to integrate easily other JS widgets.
Added custom example (based on custom-template project) that demonstrates how to integrate a thirdparty JS component such as d3 within the application using wsf_js_widget.

Removed various unecessary ecf dependencies.
2014-07-07 12:15:18 +02:00
ff19adc6c8 Improved comment related to PATH_INFO and stripping multiple slashes sequence to single slash. 2014-07-07 11:27:31 +02:00
Jocelyn Fiat
41d24c91b4 Merge pull request #138 from jocelyn/widget_integration
Integrated WSF_JS_Widget library provided by Yassin Nasir Hassan and Severin Munger as an ETH student project.
It was updated to better support Unicode, and other minor changes, this is still under "draft" folder, as it may need various modifications on the interface and implementation.
2014-07-07 11:19:43 +02:00
0427f7a8d3 Fixed compilation issue related to old usage of modified JSON library. 2014-07-07 11:14:36 +02:00
985a5e5ce7 Merge branch 'master' of github.com:EiffelWebFramework/EWF into widget_integration 2014-07-07 10:30:42 +02:00
fe4c283336 Move wsf_js_widget library under draft/library/server/wsf_js_widget 2014-07-07 10:26:10 +02:00
Conaclos
20e704604a Apply pretty print tool.
Apply on each class in test suite and library.
2014-07-04 17:59:05 +02:00
jvelilla
0db02a8c52 Merge pull request #8 from Conaclos/working
Tests - Update syntax and improve implementation
2014-07-04 14:07:41 +02:00
1b4b50ee80 Replace any multiple slash sequence by a single slash character for PATH_INFO. 2014-07-02 11:36:43 +02:00
446c692f97 Various changes related to new WSF_DEBUG_INFORMATION and WSF_DEBUG_HANDLER. 2014-07-01 19:59:08 +02:00
7dfc6ea67a Fixed various issues related to unicode and CGI variables (assuming that CGI variables are utf-8 encoded, and sometime percent encoded).
Delayed computation of `value' and `name' from WSF_STRING.
Fixed computation of REQUEST_URI when the server does not provide it (this is rare, but possible).
   compute it as SERVER_NAME + encoded-PATH_INFO + {? + QUERY_STRING}
2014-07-01 19:57:14 +02:00
jvelilla
a5a257f452 Update format 2014-07-01 04:47:23 -07:00
jvelilla
bde0e2900b Created Deployment (markdown) 2014-07-01 04:42:56 -07:00
Conaclos
361773101e Add documentation and contracts for domain types. 2014-06-30 18:32:14 +02:00
Conaclos
052860b62c Improve converters.
Replace old syntax with new one and improve
implementation.
2014-06-30 18:31:42 +02:00
Conaclos
c5e1b1ee69 Syntax update.
Replace assigment attempt with object test.
2014-06-30 18:28:13 +02:00
0b1697f20d Verbose mode for the WSF_DEBUG_HANDLER. 2014-06-30 15:45:54 +02:00
add71543a4 Fixed error introduced during refactorying on WSF_DEBUG_FILTER 2014-06-30 15:21:03 +02:00
66a1e0629c Improved the debug example, so that it outputs more information. 2014-06-30 15:16:31 +02:00
425c976032 Ensure that PATH_INFO and REQUEST_URI are following the CGI specifications:
- PATH_INFO is percent decoded but still utf-8 encoded,
  this is available via WGI.path_info and WSF_REQUEST.utf_8_path_info.
- Added WSF_REQUEST.percent_encoded_path_info
- and WSF_REQUEST.path_info remains the unicode value for PATH_INFO

Added cgi_variables: WGI_REQUEST_CGI_VARIABLES to have a simple and quick view on CGI variables
Added execution_variables to be able to iterate on execution variables.
Added PERCENT_ENCODER.percent_decoded_utf_8_string
Improved the WSF_DEBUG_HANDLER to provide more information thanks to WSF_DEBUG_INFORMATION object.
2014-06-30 15:13:47 +02:00
Jocelyn Fiat
397dcc6128 Merge pull request #133 from jocelyn/better_uploading_file
Improved the uploading of file in regard to temporary filename.
2014-06-23 16:06:29 +02:00
a3c403323d Raised the void-safety level to "complete"
Added comments.
2014-06-23 16:05:20 +02:00
942896aa0c Fixed library location for http 2014-06-12 20:02:57 +02:00
93c92c0e38 Avoid decoding PATH_INFO and PATH_TRANSLATED to follow CGI spec. 2014-06-12 19:54:30 +02:00
394ca46f03 Added example to help debugging EWF
This is mainly a kind of echo server .. that return the request information.
2014-06-12 19:52:41 +02:00
67641da44d Improved the uploading of file in regard to temporary filename.
Avoid to overwrite the same file for concurrent requests uploading the same filename.
2014-06-11 16:52:22 +02:00
Olivier Ligot
a826051979 Merge remote-tracking branch 'upstream/master' 2014-05-22 22:09:00 +02:00
3c8dc0a9e1 Fixed various Unicode text handling.
Moved example folder inside the library, and renamed it "demo"
Improved example code.
2014-04-22 16:36:29 +02:00
cc7d268610 Code improvement
Cosmetic (comments, names, formatting)
2014-03-26 10:18:02 +01:00
hassany
acc8cda04f Fix STRING_32 issues 2014-03-19 23:13:16 +01:00
hassany
7c5637c063 Add javascript function 2014-03-19 21:37:07 +01:00
severin
b87392906b Updated readme 2014-03-19 16:58:08 +01:00
severin
4e7e1e9c45 Added more comments and assertions to all classes; clean up 2014-03-19 16:49:24 +01:00
hassany
c5363c948c Extend documentation 2014-03-12 21:51:15 +01:00
severin
4f7086a6de Updated comments and added contracts for core controls in webcontrol 2014-03-12 17:21:39 +01:00
severin
3c4e15b386 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-03-12 13:54:45 +01:00
hassany
6685b3679b Add file definition 2014-03-12 13:54:20 +01:00
severin
d6a27c26aa Added assets to library 2014-03-05 15:58:10 +01:00
severin
e7c4b949f5 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-03-05 15:57:24 +01:00
severin
f89e0abe69 Simplified WSF_EMAIL_VALIDATOR regexp 2014-03-05 15:57:16 +01:00
YNH Webdev
cbcf9550f8 Rename WSF_FILE to WSF_FILE_DEFINITION 2014-03-05 15:07:21 +01:00
YNH Webdev
d4b877f18e Add Basepath 2014-03-05 15:05:26 +01:00
YNH Webdev
605a094910 Change STRING TO STRING_32 2014-03-05 14:54:45 +01:00
Olivier Ligot
655c95158f json: comment '* text=auto' in .gitattributes 2014-03-03 14:18:07 +01:00
YNH Webdev
7ca62463b7 Rename progress_source 2014-02-26 10:55:33 +01:00
YNH Webdev
2cc26f98c6 Add class description to validators
Rename Wsf_progresssource
2014-02-23 19:10:23 +01:00
YNH Webdev
47b4357a72 Extend upload demo 2014-02-23 13:36:55 +01:00
YNH Webdev
a60bd19e58 Fix state transition 2014-02-23 13:14:09 +01:00
severin
439e43fad9 Began with class documentation 2014-02-21 00:23:35 +01:00
YNH Webdev
45ddc47b0e Finalize WSF_DYNAMIC_MULTI_CONTROL 2014-01-26 22:07:15 +01:00
YNH Webdev
8f148f2a5e Add dynamic multicontrol 2014-01-26 15:02:06 +01:00
YNH Webdev
5c9edeeae8 Image preview 2014-01-25 23:43:18 +01:00
YNH Webdev
13349d07a8 Fix upload state 2014-01-25 18:00:31 +01:00
severin
d82cacc18f Merge branch 'widget' of github.com:ynh/EWF into widget 2014-01-11 12:53:59 +01:00
YNH Webdev
564248284a Add set value to value controls 2014-01-11 01:10:24 +01:00
severin
ee473d8844 Included time library to set current date in date picker 2014-01-11 00:19:04 +01:00
severin
2fb0d73439 Added ability to form element to get value (for convenience/completion) 2014-01-10 15:32:05 +01:00
severin
5dd8a83081 Added ability to show/hide border of form elements 2014-01-08 22:12:02 +01:00
severin
f83a8db25c Small change on date picker control, removed date input 2014-01-08 20:29:09 +01:00
severin
320584a693 Modified datepicker control 2014-01-06 01:36:32 +01:00
severin
514a44e022 Removed country chooser widget 2014-01-05 15:01:14 +01:00
severin
191a00649f fixed js 2014-01-05 02:00:46 +01:00
severin
ecfd5738ce modified country and date/time chooser 2014-01-05 01:26:11 +01:00
severin
25fe7c8725 Included bootstrap datetimepicker 2014-01-04 16:33:08 +01:00
severin
dbcb1def29 Added date chooser widget 2014-01-04 16:14:30 +01:00
severin
c4acbf563f Added precondition in layout control 2014-01-04 14:15:05 +01:00
severin
c9599f449f Removed add_dropdown methods from navbar, some cleanup in different controls 2014-01-04 13:43:51 +01:00
severin
e675e8aad9 ATTENTION: ugly append_attributes added to stateless control, replaces set_attributes -> maybe improve 2014-01-04 10:51:07 +01:00
severin
37aac7053a Moved set_attributes from BASIC_CONTROL to STATELESS_CONTROL 2014-01-04 10:30:34 +01:00
severin
9c9a132329 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-01-03 12:06:53 +01:00
YNH Webdev
ce305d4e54 Add disable option 2014-01-02 18:19:59 +01:00
YNH Webdev
d3c66cd7fe Allow remove 2014-01-02 03:20:57 +01:00
YNH Webdev
7bf95cd927 Add serverside file id to file structure 2014-01-01 23:50:12 +01:00
YNH Webdev
05d4f24f6f Allow detached values 2014-01-01 23:48:56 +01:00
YNH Webdev
d9c837918b Demo upload 2014-01-01 20:41:28 +01:00
severin
5adee83350 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-01-01 14:44:30 +01:00
severin
720e26d19d Small page control change 2014-01-01 14:44:22 +01:00
YNH Webdev
29356c0b61 Workin file upload 2014-01-01 01:35:43 +01:00
YNH Webdev
b39dd5c40d Change parameter type 2013-12-31 21:25:01 +01:00
YNH Webdev
1ae44e74e7 File upload implementation part1 2013-12-31 16:03:24 +01:00
YNH Webdev
7a5d1e378d Fix dropdown list, clean up actions 2013-12-31 12:10:05 +01:00
YNH Webdev
51c4e8ab9e Rename files 2013-11-11 08:28:08 +01:00
YNH Webdev
f369b26d88 Rename validators, Make forms resizable 2013-11-10 17:22:28 +01:00
YNH Webdev
40bb88a55f Validate all fields and make regexp stricter 2013-11-10 16:53:21 +01:00
YNH Webdev
72e7493842 Fix event handler 2013-11-10 16:39:04 +01:00
YNH Webdev
6213021f45 Fix form element control 2013-11-10 15:10:00 +01:00
YNH Webdev
eb3fb7e5f7 Update sample app 2013-11-10 13:58:44 +01:00
YNH Webdev
1ec14ec397 Fix email validation and min and max validator 2013-11-10 13:53:20 +01:00
YNH Webdev
38f422896d Fix slider 2013-11-09 17:14:58 +01:00
YNH Webdev
3895cf4399 Fix assert path 2013-11-09 14:42:17 +01:00
YNH Webdev
7e69fddac9 Fix rendering issue. Add active class 2013-11-08 23:03:30 +01:00
YNH Webdev
0721384b60 Adjust layout control and fix navlist 2013-11-08 09:27:56 +01:00
YNH Webdev
0d79799a5d Fix autocomplete 2013-11-08 00:09:09 +01:00
YNH Webdev
86339d8163 Redesign states and implement generated control_name 2013-11-08 00:03:02 +01:00
YNH Webdev
c9102af0aa Add stateless widgets 2013-11-06 15:44:31 +01:00
severin
6838089570 Fix Layout Control 2013-11-05 16:14:15 +01:00
severin
aba60a473a Added navlist widget 2013-11-05 16:05:24 +01:00
YNH Webdev
9a392ba292 Fix project 2013-11-05 15:50:28 +01:00
severin
85369d5247 Added WSF_LAYOUT_CONTROL 2013-11-05 15:39:42 +01:00
YNH Webdev
7c11de3073 Fix navbar state problem 2013-11-04 00:22:42 +01:00
YNH Webdev
4d07a6330d Add item alias 2013-11-03 12:51:35 +01:00
severin
dad4191c40 Fixed js 2013-11-02 23:02:07 +01:00
severin
b70450cfe9 Added dropdown control 2013-11-02 22:36:21 +01:00
severin
10b950a7e7 Fixed creation procedures (make) 2013-11-02 18:34:48 +01:00
YNH Webdev
1b831375ef Fix image sizes 2013-10-30 13:35:53 +01:00
YNH Webdev
a979bf24d4 Fix slider code 2013-10-30 13:14:48 +01:00
severin
4b11bbb73d Slider fix 2013-10-30 13:02:49 +01:00
YNH Webdev
f1cefd6173 Fix path 2013-10-29 23:14:45 +01:00
severin
ac31e1c29e Merge branch 'widget_slider' into widget
Conflicts:
	draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e
	examples/widgetapp/base_page.e
2013-10-29 15:39:32 +01:00
severin
61f032a819 Fixed WSF_MULTI_CONTROL (wrong order of subcontrols), completed navbar, improved slider 2013-10-29 15:32:57 +01:00
Severin
26e6a62e6b Test 2013-09-29 02:24:33 +02:00
YNH Webdev
01327a4b06 Add codeview 2013-09-28 16:24:51 +02:00
YNH Webdev
d3299f8e06 Fix news datasource 2013-09-28 09:49:53 +02:00
YNH Webdev
1100328fee Fix load state error 2013-09-28 09:44:39 +02:00
YNH Webdev
cb1a4825d2 Implement lazy js load wraper 2013-09-28 00:45:27 +02:00
YNH Webdev
aa9f4c4ed8 Load needed libraries dynamically 2013-09-28 00:30:29 +02:00
Severin Münger
c6d59d3366 Fixed slider 2013-09-27 18:13:55 +02:00
YNH Webdev
8353f34c45 Adjust widgetapp 2013-09-27 11:02:10 +02:00
YNH Webdev
b6c082e1fe Create new JSON_OBJECT 2013-09-27 10:57:40 +02:00
YNH Webdev
113df6efe1 Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-24 15:20:43 +02:00
Severin Münger
83329ca4b7 Moved to draft 2013-09-24 15:18:14 +02:00
Severin Münger
f51201eae1 Removed WSF_STATELESS_MULTI_CONTROL 2013-09-24 15:02:33 +02:00
Severin Münger
c52a513378 Changed slider 2013-09-24 14:38:01 +02:00
Severin Münger
6908bfe7bf Added slider demo 2013-09-24 02:38:36 +02:00
Severin Münger
a5fa428e98 Added simple image slider widget 2013-09-24 01:28:29 +02:00
YNH Webdev
24f760c043 Add table title 2013-09-24 00:22:56 +02:00
YNH Webdev
3f089d6811 Implement remove 2013-09-24 00:18:38 +02:00
YNH Webdev
7e673b4628 Stop interval if deleted 2013-09-23 00:40:40 +02:00
YNH Webdev
ca633d3524 Introduce actions
First working modal
2013-09-23 00:15:43 +02:00
YNH Webdev
7dd726ca42 Set url within page class 2013-09-22 22:47:29 +02:00
YNH Webdev
3f6caa76dc Fix confict 2013-09-22 19:14:19 +02:00
YNH Webdev
5a18cb4246 Merge branch 'widget' of github.com:souvarin/EWF into widget_state_redesign
Conflicts:
	examples/widgetapp/base_page.e
2013-09-22 19:11:46 +02:00
YNH Webdev
b33de9985f Implement control isolation 2013-09-22 19:11:07 +02:00
YNH Webdev
3a9ede6e8c Restructure callbacks 2013-09-22 18:30:48 +02:00
Severin Münger
87569ccee9 Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-22 18:20:53 +02:00
Severin Münger
16b79ef193 Improved Navbar, changed attribute handling 2013-09-22 18:20:17 +02:00
YNH Webdev
f360e8a867 Add comments to grid controls 2013-09-22 14:35:26 +02:00
Severin Münger
57dd4ce259 Added comments to autocompletion, input, navbar, progressbar, validator, webcontrol. Some more little changes. 2013-09-21 23:01:36 +02:00
YNH Webdev
252b5ff758 Use append 2013-09-20 20:53:51 +02:00
YNH Webdev
b19598d902 Fix tuple 2013-09-20 20:51:19 +02:00
YNH Webdev
b5ef1fbbb5 Make recommended changes
- Implicit casting
- Use same_string
2013-09-20 20:49:03 +02:00
YNH Webdev
0a2883e040 Rename clusters to singular names 2013-09-20 19:22:46 +02:00
YNH Webdev
24474e6b31 Move project to wsf_js_widget 2013-09-20 19:19:34 +02:00
ynh
6c0eeebf27 Merge pull request #2 from jocelyn/widget_first_review
Minor changes
2013-09-20 03:34:36 -07:00
48f5cb78d5 Minor changes
- using http_client library instead of libcurl directly
 - using implicit conversion to JSON_STRING to improve code readability
 - use ARRAYED_LIST instead of LINKED_LIST .. for performance.
 - cosmetic .. but still a lot of feature clauses are missing, comments, assertions ...
2013-09-20 10:27:00 +02:00
YNH Webdev
1da678f726 Slow down fetching 2013-09-16 00:01:31 +02:00
Severin Münger
fccb6776b0 Fixed progressbar 2013-09-15 23:47:04 +02:00
Severin Münger
f2e85aca42 Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-15 22:14:07 +02:00
Severin Münger
2fbffb8c9e Added progress callback 2013-09-15 22:13:51 +02:00
YNH Webdev
dd8bddd45c Make js files local 2013-09-15 18:33:39 +02:00
YNH Webdev
358fe04699 Add all countries to flag list
Set encoding (Must be changed to UTF-8 in future)
2013-09-15 17:32:23 +02:00
YNH Webdev
647beea245 Rearrange demo
Add contact autocompletion
2013-09-15 15:25:13 +02:00
YNH Webdev
251974fd2f Create basepage 2013-09-15 14:16:18 +02:00
YNH Webdev
81952e7898 Merge branch 'widget_grid' into widget
Conflicts:
	examples/widgetapp/widget.coffee
	examples/widgetapp/widget.js
2013-09-15 14:04:45 +02:00
YNH Webdev
1ba9792547 Fix suggestions 2013-09-15 13:33:43 +02:00
Severin Münger
45e3a6d7cc Small changes 2013-09-15 13:25:01 +02:00
Severin Münger
be05edac7d Added Progress Control 2013-09-15 01:57:03 +02:00
Severin Münger
6761d22fa8 Added Progress Control 2013-09-15 01:55:17 +02:00
Severin Münger
9db93cf4c9 Included navbar example 2013-09-15 00:44:20 +02:00
YNH Webdev
15dd993b95 Fix change event 2013-09-14 22:45:58 +02:00
YNH Webdev
0f8444a585 Remove column from grid 2013-09-14 20:39:07 +02:00
YNH Webdev
6230d643c8 Style demo pages 2013-09-14 19:39:08 +02:00
YNH Webdev
cfe452543a Implement repeater 2013-09-14 18:41:49 +02:00
YNH Webdev
26ec7d94c6 Google news example 2013-09-14 17:46:57 +02:00
YNH Webdev
95f823e7a1 - Add event paramenter
- Implement Paging control
2013-09-14 14:27:11 +02:00
Severin Münger
09544ba6d2 Fixed rendering, added navbar 2013-09-13 23:24:49 +02:00
YNH Webdev
15676a7c9e Fix path in project 2013-09-13 19:42:24 +02:00
Severin Münger
efc1550ab9 Merge branch 'widget' of github.com:ynh/EWF into widget
Conflicts:
	library/server/wsf_html/webcontrol/wsf_control.e
2013-09-13 01:12:26 +02:00
Severin Münger
f53974b138 Small changes/fixes 2013-09-13 01:08:18 +02:00
YNH Webdev
6860860161 Fix render function 2013-09-13 01:05:35 +02:00
Severin Münger
9c65194d91 Small fix removed DOCTYPE 2013-09-13 00:41:31 +02:00
Severin Münger
b1cf630443 New Control structure 2013-09-13 00:28:37 +02:00
YNH Webdev
b3e383ea82 Merge branch 'widget' of github.com:souvarin/EWF into widget
Conflicts:
	library/server/wsf_html/wsf_html-safe.ecf
2013-09-13 00:21:58 +02:00
YNH Webdev
36368aff0b Add Grid Widget 2013-09-13 00:20:27 +02:00
Severin Münger
162735b328 Extended autocompletion with customized templates 2013-09-12 17:15:05 +02:00
Severin Münger
27023283e7 Autocompletion 2013-09-12 14:58:35 +02:00
Severin Münger
8fc405fef1 Changed structure 2013-09-12 11:38:31 +02:00
Severin Münger
55e91bff7f Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-06 23:34:50 +02:00
YNH Webdev
8b179fd98d Min/Max validator 2013-09-06 21:47:02 +02:00
Severin Münger
e5841f2dad Merge branch 'widget' of github.com:ynh/EWF into widget
Conflicts:
	examples/widgetapp/sample_page.e
2013-09-06 20:40:43 +02:00
Severin Münger
d45405f261 Some small changes 2013-09-06 20:36:04 +02:00
YNH Webdev
133ed9a0be Show server side error in validation box 2013-09-06 18:52:59 +02:00
YNH Webdev
33220b2b8e Add HTML control 2013-09-06 18:45:14 +02:00
YNH Webdev
f542975872 Small render fix 2013-09-06 18:13:23 +02:00
YNH Webdev
4dd4678b65 Comment js code 2013-09-06 18:09:39 +02:00
YNH Webdev
bbd48d24e4 Implement serverside and client side validatation 2013-09-06 18:06:43 +02:00
YNH Webdev
9f40c6355c First working checkbox list 2013-09-06 14:22:23 +02:00
YNH Webdev
0fcb80aa29 Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-06 12:29:14 +02:00
Severin Münger
59a12dcac1 Added checkbox list, modified form validation 2013-09-06 01:20:41 +02:00
YNH Webdev
eb47c101ca Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-05 23:37:19 +02:00
Severin Münger
c67a7f4982 Added validators for decimals and mails 2013-09-05 22:57:56 +02:00
Severin Münger
aba394502c Added Regexp validation (later used for mail, numbers...) 2013-09-05 22:09:08 +02:00
YNH Webdev
0c265f4f78 Fix form and textarea bug 2013-09-05 17:43:46 +02:00
YNH Webdev
32518cfb41 Merge branch 'widget' of github.com:souvarin/EWF into widget
Conflicts:
	library/server/wsf_html/webcontrol/wsf_control.e
2013-09-05 17:20:40 +02:00
YNH Webdev
225f821206 Test the new controls 2013-09-05 17:18:46 +02:00
Severin Münger
f506d9e925 Implemented WSF_CHECKBOX_CONTROL, added id attribute to rendering of WSF_CONTROL 2013-09-05 17:16:56 +02:00
YNH Webdev
edce18fb1f Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-05 16:53:29 +02:00
YNH Webdev
ad15ab13c5 Fix render function 2013-09-05 16:53:05 +02:00
Severin Münger
f52f6512a0 Restructured validators, fixed form element rendering 2013-09-05 16:51:51 +02:00
YNH Webdev
7bdafbd21e Fix render function 2013-09-05 16:51:37 +02:00
YNH Webdev
6486c8c472 Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-05 16:28:21 +02:00
YNH Webdev
fb345c5f0c Add bootstrap 2013-09-05 16:27:55 +02:00
Severin Münger
deaeaa434d Implemented WSF_FORM_ELEMENT_CONTROL 2013-09-05 16:25:44 +02:00
Severin Münger
f9cc0afb9e Merge branch 'widget' of github.com:ynh/EWF into widget
Conflicts:
	library/server/wsf_html/webcontrol/wsf_control.e
	library/server/wsf_html/webcontrol/wsf_text_control.e
2013-09-05 15:40:11 +02:00
Severin Münger
ee0400463f Began with implementation of form handling 2013-09-05 15:37:59 +02:00
YNH Webdev
fa35c22d2d Use render tag 2013-09-05 15:33:56 +02:00
Severin Münger
422b73058c Adapted rendering of multi control 2013-09-05 15:12:22 +02:00
Severin Münger
c50a46206d Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-05 15:08:24 +02:00
Severin Münger
f866c067cb Changed creation procedures 2013-09-05 15:08:02 +02:00
YNH Webdev
811d087d74 Generate tag 2013-09-05 14:55:52 +02:00
YNH Webdev
633243311d Change wsf control 2013-09-05 14:48:19 +02:00
Severin Münger
ae9952a941 Added class for TextArea 2013-09-03 03:54:33 +02:00
Severin Münger
3b2ad80dc3 Added TextArea 2013-09-03 03:53:01 +02:00
Severin Münger
1c08439c1a forgot to add new files 2013-09-02 20:25:59 +02:00
Severin Münger
16c89180d2 Added generalized input control similiar to text 2013-09-02 03:44:30 +02:00
YNH Webdev
bc6b4f90c3 Only send changes back to client 2013-08-29 18:31:57 +02:00
YNH Webdev
275cc7aa21 Add comments
Use Precursor
2013-08-28 22:59:24 +02:00
YNH Webdev
e186475a81 Clean up code
Simplify event
2013-08-28 19:43:44 +02:00
YNH Webdev
595d0c501a Only callback if there is an event attached 2013-08-28 15:57:16 +02:00
YNH Webdev
4e09a15454 Remove ugly do nothing hack 2013-08-28 15:30:13 +02:00
YNH Webdev
b7ab840d71 Communication in both directions (Text control)
Code regrouping
2013-08-28 12:52:09 +02:00
YNH Webdev
b72e6871e8 Fix multi control
Use multi control in example
2013-08-28 11:04:54 +02:00
YNH Webdev
f14ea29636 Comment and reformat coffee script file 2013-08-28 00:34:25 +02:00
YNH Webdev
cb7f1f0ee3 First working callback 2013-08-28 00:04:42 +02:00
Severin Münger
ef34217a6d Added WSF_MULTI_CONTROL to support controls that consist of multiple separate controls. 2013-08-27 22:06:08 +02:00
Severin Münger
ab7ee8e4c3 Created first working sample page application. 2013-08-27 16:48:20 +02:00
YNH Webdev
1a1df35ff1 Remove content length 2013-08-27 16:45:50 +02:00
YNH Webdev
0c0fb5c9c8 Add html body 2013-08-27 16:44:58 +02:00
YNH Webdev
c29a6ad195 Add assigner 2013-08-27 16:33:54 +02:00
YNH Webdev
6fdffb7418 Add post condition 2013-08-27 16:18:51 +02:00
YNH Webdev
8db642cf3b Move initalize controls 2013-08-27 16:07:06 +02:00
YNH Webdev
850a05d6bb Pretty Print 2013-08-27 16:00:24 +02:00
YNH Webdev
74995101d1 Add a json state to each control 2013-08-27 15:58:56 +02:00
YNH Webdev
fa5d13e19d Fix path 2013-08-27 15:01:57 +02:00
YNH Webdev
9f7e72f0a4 Page structure 2013-08-27 14:47:43 +02:00
YNH Webdev
c224bf1bb1 Test 2013-08-27 13:53:34 +02:00
Severin Münger
b5b71a3db0 Created widget-project testapp project. 2013-08-27 13:48:44 +02:00
1306 changed files with 297829 additions and 16595 deletions

1
.gitignore vendored
View File

@@ -3,4 +3,5 @@ tests/temp/
.svn/
*.swp
*~
*.scm
*#

18
.travis.yml Normal file
View File

@@ -0,0 +1,18 @@
language: eiffel
before_script:
- export current_dir=$PWD ; echo current_dir=$current_dir ; cd ..
- curl -sSL https://www.eiffel.org/setup/install.sh | bash > eiffel.rc
- source ./eiffel.rc
- echo `ec -version`
- cd $current_dir
- echo Check projects compilation status...
branches:
only:
- master
- v1
- develop
script: compile_all -ecb -melt -list_failures -log_verbose -clean -options dotnet=false
group: stable
os: linux

6158
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
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

1534
ChangeLog

File diff suppressed because it is too large Load Diff

121
MIGRATION.md Normal file
View File

@@ -0,0 +1,121 @@
Date: 2015-june
# Goal:
=======
- support safe concurrency with EWF
- provide a concurrent standalone connector
# Status:
=========
- The version v0 of EWF has mainly 3 connectors: CGI, libFCGI, and nino.
- CGI and libFCGI connectors does not need any concurrency support.
- But the nino connector had a pseudo concurrency support with Thread, however one could do write code that result in hasardeous concurrency execution.
So, it was decided to provide an improved Eiffel web nino connector, and update EWF design to make it concurrency compliant.
# Decisions:
============
- instead of updating current nino library, we now have a new "standalone" connector which is inspired by nino, but have support for the 3 concurrency modes: none, thread and SCOOP.
# Overview
==========
Adding support for SCOOP concurrency mode add constraints to the design, but also helps ensuring the concurrency design of EWF is correct.
As a consequence, we had to introduce a new interface WSF_EXECUTION which is instantiated for each incoming request. See its simplified interface :
<code lang="eiffel">
deferred class WSF_EXECUTION
feature -- Initialization
make (req: WGI_REQUEST; res: WGI_RESPONSE)
do
...
īnitialize
end
initialize
-- Initialize Current object.
--| To be redefined if needed.
do
end
feature -- Access
request: WSF_REQUEST
-- Access to request data.
-- Header, Query, Post, Input data..
response: WSF_RESPONSE
-- Access to output stream, back to the client.
feature -- Execution
execute
-- Execute Current `request',
-- getting data from `request'
-- and response to client via `response'.
deferred
ensure
is_valid_end_of_execution: is_valid_end_of_execution
end
end
</code>
And the related request execution routines are extracted from WSF_SERVICE which becomes almost useless. The "service" part is not mostly responsible of launching the expected connector and set optional options, and declare the type of "execution" interface.
As a result, the well known WSF_DEFAULT_SERVICE has now a formal generic that should conform to WSF_EXECUTION with a `make' creation procedure. See update code:
<code lang="eiffel">
class
APPLICATION
inherit
WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION]
redefine
initialize
end
create
make_and_launch
feature {NONE} -- Initialization
initialize
-- Initialize current service.
do
set_service_option ("port", 9090)
end
end
</code>
Where APPLICATION_EXECUTION is an implementation of the WSF_EXECUTION interface (with the `make' creation procedure).
In addition to add better and safer concurrency support, there are other advantages:
- we now have a clear separation between the service launcher, and the request execution itself.
- the WSF_EXECUTION is created per request, with two main attributes <code>request: WSF_REQUEST</code> and <code>response: WSF_RESPONSE</code>.
# How to migrate to new design
- you can check the various example from the EWF repository, there should all be migrated to new design and comparing previous and new code, this will show you how the migration was done.
- a frequent process:
- identify the root class of your service, (the class implementing the WSF_SERVICE), let us name it APPLICATION_SERVICE
- copy the APPLICATION_SERVICE file to APPLICATION_EXECUTION file.
- change the class name to be APPLICATION_EXECUTION, and replace _SERVICE occurences by _EXECUTION (note the new WSF_ROUTED_EXECUTION and so on, which are mainly migration from previous WSF_ROUTED_SERVICE .., and also WSF_FILTERED_ROUTED_EXECUTION which is new.
- replace "make_and_launch" by "make", remove the initialize redefinition if any.
- in the APPLICATION_SERVICE class, remove most of the ROUTED, FILTERED ... inheritance, and keep WSF_DEFAULT_SERVICE, with a new formal generic i.e WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION].
- in the eventual redefined initialize, remove code related to routers, filters, ...
- remove all the execution related code.
- And you should be done.
- To be short, this is mostly creating a new _EXECUTION class, and move the execution related code into this class from the _SERVICE class.
- Then, you can replace the usage of nino connector by using the new "Standalone" connector, and switch to SCOOP concurrency mode, to ensure you are not messing up with concurrency. Your own code/libraris may not be SCOOP compliant, we recommend to migrate to SCOOP, but as an intermediate solutioņ, you can use the other concurrency mode (none or thread).
Note: the new design impacts the _SERVICE classes, connectors, but WSF_REQUEST, WSF_RESPONSE , WSF_ROUTER are compatible, so the migration is really easy.
We may take the opportunity to update the design deeper according to user feedback, and eventually "wsf" library will be renamed "wsf2".
This is work in progress, all comments , feedback, suggestions, bug report are welcome.
Hopefully before the final version of the new design is out.

View File

@@ -1,5 +1,7 @@
# Eiffel Web Framework
[![Build Status](https://api.travis-ci.org/EiffelWebFramework/EWF.svg?branch=master)](https://travis-ci.org/EiffelWebFramework/EWF/)
## Overview
@@ -11,14 +13,14 @@ Currently EWF offers a collection of Eiffel libraries designed to be integrated
There is a growing ecosystem around EWF, that provides useful components:
* OpenID and OAuth consumer library
* Various hypermedia format such as HAL, Collection+json,
* Various hypermedia format such as HAL, Collection+json, ...
* Websocket server and client
* Template engine
* API Auto-documentation with swagger
* A simple experimental CMS.
* ...
So if you want to build a website, a web api, RESTful service, or even if you want to consume other web api, EWF is a solution.
So if you want to build a website, a web api, RESTful service, ... or even if you want to consume other web api, EWF is a solution.
EWF brings with it all the advantages of the Eiffel technology and tools with its powerful features such as Design by Contract, debugging, testing tools which enable to build efficient systems expected to be repeatedly refined, extended, and improved in a predictable and controllable way so as to become with time bugfree systems. Enjoy the full power of debugging your web server application from the IDE.
@@ -38,21 +40,22 @@ For download, check
Tasks and issues are managed with github issue system
* See https://github.com/EiffelWebFramework/EWF/issues
* And visual dashboard: https://waffle.io/eiffelwebframework/ewf
* Forum/group post: https://groups.google.com/forum/#!forum/eiffel-web-framework
## Requirements
* Compiling from EiffelStudio 7.2 to 13.11 and more recent version of the compiler.
* Developped using EiffelStudio 13.11 (on Windows, Linux)
* Tested using EiffelStudio 13.11 with "jenkins" CI server (not anymore compatible with 6.8 due to use of `TABLE_ITERABLE')
* 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) )
* Compiling from EiffelStudio 16.05 to 17.05 and more recent version of the compiler.
* Currently being developped using EiffelStudio 17.01 (on Windows, Linux)
* Tested using EiffelStudio 17.01 with "jenkins" CI server.
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](https://www.eiffel.org/doc/eiffel/Void-safe%20programming%20in%20Eiffel)
## How to get the source code?
Using git
* git clone https://github.com/EiffelWebFramework/EWF.git
* `git clone https://github.com/EiffelWebFramework/EWF.git`
* And to build the required and related Clibs
* cd contrib/ise_library/cURL
* geant compile
* `cd contrib/ise_library/cURL`
* `geant compile`
## Libraries under 'library'
@@ -61,15 +64,15 @@ Using git
* 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)
* __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__: Content negotiation library (Content-type Negociation) [read more](library/protocol/content_negotiation)
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/network/protocol/http)
* __uri_template__: URI Template library (parsing and expander) [read more](library/network/protocol/uri_template)
* __CONNEG__: Content negotiation library (Content-type Negociation) [read more](library/network/protocol/content_negotiation)
### client
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
* __http_client__: simple HTTP client based on cURL [read more](library/network/http_client)
### text
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
@@ -77,10 +80,6 @@ Using git
### 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 ##
## Examples
@@ -100,9 +99,9 @@ review the [guidelines for contributing](CONTRIBUTING.md).
Keep track of development and community news.
* Follow [@EiffelWeb](https://twitter.com/EiffelWeb) on Twitter
* [Forum](https://groups.google.com/forum/#!forum/eiffel-web-framework) on Google groups.
* Follow our [page](https://plus.google.com/u/0/110650349519032194479) and [community](https://plus.google.com/communities/110457383244374256721) on Google+
* Have a question that's not a feature request or bug report? [Ask on the mailing list](http://groups.google.com/group/eiffel-web-framework)
For more information please have a look at the related wiki:
* https://github.com/EiffelWebFramework/EWF/wiki
For more information please have a look at the related [workbook documentation](docs/workbook)

View File

@@ -29,7 +29,9 @@
<target name="_build_tpl_" >
<argument name="_target_name" />
<geant target="${_target_name}" dir="ise_library" file="build.eant" reuse_variables="true" />
<!--
<geant target="${_target_name}" dir="library" file="build.eant" reuse_variables="true" />
-->
</target>
</project>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0"?>
<project name="build_library" default="help">
<description>
description: "Compile Eiffel Web Framework / Contrib / ISE library"
</description>
<target name="help">
<echo message="usage:"/>
<echo message=" geant compile"/>
<echo message=" geant clean"/>
<echo message=" geant clobber"/>
</target>
<target name="compile" >
<echo message="- Compile ise_library" />
<geant target="_build_tpl_" arguments="compile" />
</target>
<target name="clean" >
<echo message="- Clean ise_library" />
<geant target="_build_tpl_" arguments="clean" />
</target>
<target name="clobber" >
<echo message="- Clobber ise_library" />
<geant target="_build_tpl_" arguments="clobber" />
</target>
<target name="_build_tpl_" >
<argument name="_target_name" />
</target>
</project>

View File

@@ -1,22 +1,3 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-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 debug="true" warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
<debug name="nino" enabled="true"/>
<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="nino" location="..\..\nino-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<cluster name="src" location=".\" recursive="true"/>
</target>
</system>
<?xml version="1.0" encoding="ISO-8859-1"?>
<redirection xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" uuid="B1D3254D-A58E-4259-9796-8A2843A511A9" message="Obsolete: use web_server.ecf !" location="web_server.ecf">
</redirection>

View File

@@ -1,21 +1,23 @@
<?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>
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="nino_web_server" uuid="B1D3254D-A58E-4259-9796-8A2843A511A9">
<target name="nino_web_server">
<root class="APPLICATION" feature="make"/>
<file_rule>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<option warning="true" >
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<capability>
<concurrency support="thread" use="thread"/>
</capability>
<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>

View File

@@ -0,0 +1,83 @@
note
description: "Summary description for {TCP_STREAM_SOCKET}."
date: "$Date: 2015-02-16 19:53:13 +0100 (lun., 16 févr. 2015) $"
revision: "$Revision: 96642 $"
class
TCP_STREAM_SOCKET
inherit
NETWORK_STREAM_SOCKET
redefine
make
end
create
make_server_by_address_and_port,
make_server_by_port
create {NETWORK_STREAM_SOCKET}
make_from_descriptor_and_address,
make_empty
feature {NONE} -- Initialization
make_server_by_address_and_port (a_address: INET_ADDRESS; a_port: INTEGER)
-- Create server socket on `a_address' and `a_port'.
require
valid_port: a_port >= 0
do
make
create address.make_from_address_and_port (a_address, a_port)
bind
end
make
-- Create a network stream socket.
do
Precursor
set_reuse_address
end
feature -- Basic operation
send_message (a_msg: STRING)
local
a_package : PACKET
a_data : MANAGED_POINTER
c_string : C_STRING
do
create c_string.make (a_msg)
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
create a_package.make_from_managed_pointer (a_data)
send (a_package, 1)
end
feature -- Output
put_readable_string_8 (s: READABLE_STRING_8)
-- Write readable string `s' to socket.
local
ext: C_STRING
do
create ext.make (s)
put_managed_pointer (ext.managed_data, 0, s.count)
end
feature -- Status report
try_ready_for_reading: BOOLEAN
-- Is data available for reading from the socket right now?
require
socket_exists: exists
local
retval: INTEGER
do
retval := c_select_poll_with_timeout (descriptor, True, 0)
Result := (retval > 0)
end
note
copyright: "2011-2015, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -17,7 +17,8 @@ create
make_server_by_port
create {NETWORK_STREAM_SOCKET}
make_from_descriptor_and_address
make_from_descriptor_and_address,
make_empty
feature {NONE} -- Initialization
@@ -28,16 +29,6 @@ feature {NONE} -- Initialization
set_reuse_address
end
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
-- Create server socket on `an_address' and `a_port'.
require
valid_port: a_port >= 0
do
make
create address.make_from_address_and_port (an_address, a_port)
bind
end
feature -- Basic operation
send_message (a_msg: STRING)
@@ -75,8 +66,8 @@ feature -- Status report
retval := c_select_poll_with_timeout (descriptor, True, 0)
Result := (retval > 0)
end
note
copyright: "2011-2011, Javier Velilla and others"
copyright: "2011-2015, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,20 +1,3 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
<target name="nino">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
<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"/>
<cluster name="nino" location=".\library\" recursive="true"/>
</target>
</system>
<redirection xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" message="Obsolete: use nino.ecf !" location="nino.ecf">
</redirection>

View File

@@ -1,20 +1,34 @@
<?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="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
<target name="nino">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="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="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<cluster name="nino" location=".\library\" recursive="true"/>
</target>
</system>
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
<target name="nino">
<root all_classes="true"/>
<file_rule>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<capability>
<concurrency support="none" use="thread"/>
</capability>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<cluster name="nino" location=".\library\" recursive="true">
<file_rule>
<exclude>spec</exclude>
</file_rule>
<file_rule>
<exclude>tcp_stream_socket.e</exclude>
<condition>
<version type="compiler" max="16.11.0.0"/>
</condition>
</file_rule>
</cluster>
<cluster name="spec_until_16_05" location=".\library\spec\until_16_05\" recursive="true">
<condition>
<version type="compiler" max="16.11.0.0"/>
</condition>
</cluster>
</target>
</system>

View File

@@ -0,0 +1,14 @@
package nino
project
nino = "nino.ecf"
note
title: Eiffel Nino Web Server
description: Simple HTTPd server written in Eiffel
tags: web, httpd, server
copyright: Javier Velilla, Jocelyn Fiat and Eiffel Software.
license: Eiffel Forum v2
link[license]: http://www.eiffel.com/licensing/forum.txt
end

View File

@@ -1,9 +0,0 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.e text
*.ecf text
*.bat text
*.json text

View File

@@ -1,2 +0,0 @@
*.swp
EIFGENs

View File

@@ -1,26 +0,0 @@
History file for EJSON
======================
team: ""
date: "2011-07-06"
revision: "0.3.0"
+++++++++++++++++++++Important Changes since 0.2.0 version++++++++++++++++++++++++++++++++++++++++++++++
*Updated skip_white_spaces, now check %U and %T codes
*Undo changes to is_a_valid_number, because it's doesn't follow the
JSON spec. Tests : fail13.json, fail29.json and fail30.json are valid
with this implementation, so we go back to the previous
implementation.
*Added autotest test suite
*Added getest based test program
*Updated Eiffel configuration file, updated to the new clusters
*Added converters and factory classes
*Added new top level directories; library, test, build and example

View File

@@ -1,20 +0,0 @@
Copyright (c) 2010 Javier Velilla and others, http://ejson.origo.ethz.ch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,99 +0,0 @@
Readme file for eJSON
=====================
team: "Javier Velilla,Jocelyn Fiat, Paul Cohen"
date: "$Date$"
revision: "$Revision$"
1. Introduction
---------------
eJSON stands for Eiffel JSON library and is a small Eiffel library for dealing
with the JSON format. The objective of the library is to provide two basic
features Eiffel2JSON and JSON2Eiffel.
2. Legal stuff
--------------
eJSON is copyrighted by the author Javier Velilla and others. It is licensed
under the MIT License. See the file license.txt in the same directory as this
readme file.
3. Versioning scheme
--------------------
eJSON version numbers has the form:
«major number».«minor number».«patch level»
eJSON will retain the major number 0 as long as it has beta status. A change in
major number indicates that a release is not backward compatible. A change in
minor number indicates that a release is backward compatible (within that major
number) but that new useful features may have been added. A change in patch
level simply indicates that the release contains bug fixes for the previous
release. Note that as long as eJSON is in beta status (0.Y.Z) backward
compatibility is not guranteed for changes in minor numbers!
4. Documentation
---------------
Currently the only documentation on eJSON is available at:
https://github.com/eiffelhub/json/wiki/User-guide
5. Requirements and installation
--------------------------------
EJSON requires that you have:
1. Gobo 3.9 installed or later
2. One of the following compiler combinations installed:
* ISE Eiffel 6.5 or later.
* gec [try to test]
* tecomp [try to test]
eJSON probably works fine with other versions of the above compilers.
There are no known platform dependencies (Windows, Linux).
To install eJSON simply extract the ejson-X.Y.Z.zip file to some appropriate
place on your hard disk. There are no requirements on environment variables or
registry variables.
To verify that everything works you should compile the example programs and/or
the test program.
6. Contents of eJSON
--------------------
All directory names below are relative to the root directory of your ejson
installation.
Directory Description
--------- -----------
doc Contains the eJSON.pdf documentation file.
examples Contains the two example programs.
ejson Contains the actual eJSON library classes.
test Contains a test program for eJSON.
7. Contacting the Team
----------------------
Contact the team:
Javier Velilla «javier.hector@gmail.com»
Paul Cohen «paco@seibostudios.se»
Jocelyn Fiat «jfiat@eiffel.com»
8. Releases
-----------
For more information on what was changed in each release look in the file
history.txt.
Version Date Description
------- ---- -----------
0.5.0 2013-11-dd Added JSON_ITERATOR, simplified JSON_OBJECT
0.4.0 2012-12-12 Updated documentation URI
0.3.0 2011-07-06 JSON Factory Converters
0.2.0 2010-02-07 Adapted to EiffelStudio 6.4 or later, supports void-safety
0.1.0 2010-02-07 First release, Adapted to SmartEiffel 1.2r7 and EiffelStudio 6.2 or previous

View File

@@ -1,37 +0,0 @@
note
description: "Objects that ..."
date: "$Date$"
revision: "$Revision$"
class
JSON_FILE_READER
feature -- Access
read_json_from (a_path: STRING): detachable STRING
local
l_file: PLAIN_TEXT_FILE
template_content: STRING
l_last_string: detachable STRING
do
create l_file.make_with_name (a_path)
-- We perform several checks until we make a real attempt to open the file.
if not l_file.exists then
print ("error: '" + a_path + "' does not exist%N")
else
if not l_file.is_readable then
print ("error: '" + a_path + "' is not readable.%N")
else
l_file.open_read
create template_content.make_empty
l_file.read_stream (l_file.count)
l_last_string := l_file.last_string
check l_last_string /= Void end -- implied by postcondition of `l_file.read_stream'
template_content.append (l_last_string.string)
Result := template_content
l_file.close
end
end
end
end

View File

@@ -1,60 +0,0 @@
note
description:
"JSON Iterator"
pattern: "Iterator visitor"
author: "Jocelyn Fiat"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
date: "2013/08/01"
revision: "Revision 0.1"
deferred class
JSON_ITERATOR
inherit
JSON_VISITOR
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
do
across
a_json_array as c
loop
c.item.accept (Current)
end
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
do
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
do
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
do
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
do
across
a_json_object as c
loop
c.item.accept (Current)
end
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
do
end
end

View File

@@ -1,175 +0,0 @@
note
description: "JSON_PRETTY_STRING_VISITOR Generates the JSON-String for a JSON_VALUE"
revision: "0.1"
class
JSON_PRETTY_STRING_VISITOR
inherit
JSON_VISITOR
create
make,
make_custom
feature -- Initialization
make (a_output: like output)
-- Create a new instance
do
make_custom (a_output, 1, 1)
end
make_custom (a_output: like output; a_object_count_inlining, a_array_count_inlining: INTEGER)
-- Create a new instance
do
output := a_output
create indentation.make_empty
indentation_step := "%T"
object_count_inlining := a_object_count_inlining
array_count_inlining := a_array_count_inlining
end
feature -- Access
output: STRING_32
-- JSON representation
indentation: like output
indentation_step: like indentation
line_number: INTEGER
indent
do
indentation.append (indentation_step)
end
exdent
do
indentation.remove_tail (indentation_step.count)
end
new_line
do
output.append ("%N")
output.append (indentation)
line_number := line_number + 1
end
object_count_inlining: INTEGER
array_count_inlining: INTEGER
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
local
value: JSON_VALUE
l_json_array: ARRAYED_LIST [JSON_VALUE]
l_line: like line_number
l_multiple_lines: BOOLEAN
do
l_json_array := a_json_array.array_representation
l_multiple_lines := l_json_array.count >= array_count_inlining or across l_json_array as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
output.append ("[")
l_line := line_number
indent
from
l_json_array.start
until
l_json_array.off
loop
if
line_number > l_line or
l_multiple_lines
then
new_line
end
value := l_json_array.item
value.accept (Current)
l_json_array.forth
if not l_json_array.after then
output.append (", ")
end
end
exdent
if
line_number > l_line or
l_json_array.count >= array_count_inlining
then
new_line
end
output.append ("]")
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
do
output.append (a_json_boolean.item.out)
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
do
output.append ("null")
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
do
output.append (a_json_number.item)
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
local
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
l_line: like line_number
l_multiple_lines: BOOLEAN
do
l_pairs := a_json_object.map_representation
l_multiple_lines := l_pairs.count >= object_count_inlining or across l_pairs as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
output.append ("{")
l_line := line_number
indent
from
l_pairs.start
until
l_pairs.off
loop
if
line_number > l_line or
l_multiple_lines
then
new_line
end
l_pairs.key_for_iteration.accept (Current)
output.append (": ")
l_pairs.item_for_iteration.accept (Current)
l_pairs.forth
if not l_pairs.after then
output.append (", ")
end
end
exdent
if
line_number > l_line or
l_pairs.count >= object_count_inlining
then
new_line
end
output.append ("}")
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
do
output.append ("%"")
output.append (a_json_string.item)
output.append ("%"")
end
end

View File

@@ -1,59 +0,0 @@
note
description:
"JSON Visitor"
pattern: "Visitor"
author: "Javier Velilla"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
date: "2008/08/24"
revision: "Revision 0.1"
deferred class
JSON_VISITOR
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
require
a_json_array_not_void: a_json_array /= Void
deferred
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
require
a_json_boolean_not_void: a_json_boolean /= Void
deferred
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
require
a_json_null_not_void: a_json_null /= Void
deferred
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
require
a_json_number_not_void: a_json_number /= Void
deferred
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
require
a_json_object_not_void: a_json_object /= Void
deferred
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
require
a_json_string_not_void: a_json_string /= Void
deferred
end
end

View File

@@ -1,102 +0,0 @@
note
description: "PRINT_JSON_VISITOR Generates the JSON-String for a JSON_VALUE"
author: "jvelilla"
date: "2008/08/24"
revision: "0.1"
class
PRINT_JSON_VISITOR
inherit
JSON_VISITOR
create make
feature -- Initialization
make
-- Create a new instance
do
create to_json.make_empty
end
feature -- Access
to_json: STRING
-- JSON representation
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
local
value: JSON_VALUE
l_json_array: ARRAYED_LIST [JSON_VALUE]
do
l_json_array:=a_json_array.array_representation
to_json.append ("[")
from
l_json_array.start
until
l_json_array.off
loop
value := l_json_array.item
value.accept (Current)
l_json_array.forth
if not l_json_array.after then
to_json.append(",")
end
end
to_json.append ("]")
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
do
to_json.append (a_json_boolean.item.out)
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
do
to_json.append ("null")
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
do
to_json.append (a_json_number.item)
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
local
l_pairs: HASH_TABLE[JSON_VALUE,JSON_STRING]
do
l_pairs := a_json_object.map_representation
to_json.append ("{")
from
l_pairs.start
until
l_pairs.off
loop
l_pairs.key_for_iteration.accept (Current)
to_json.append (":")
l_pairs.item_for_iteration.accept (Current)
l_pairs.forth
if not l_pairs.after then
to_json.append (",")
end
end
to_json.append ("}")
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
do
to_json.append ("%"")
to_json.append (a_json_string.item)
to_json.append ("%"")
end
end

View File

@@ -1,85 +0,0 @@
note
description: "A JSON converter for DS_HASH_TABLE [ANY, HASHABLE]"
author: "Paul Cohen"
date: "$Date: $"
revision: "$Revision: $"
file: "$HeadURL: $"
class JSON_DS_HASH_TABLE_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
do
create object.make (0)
end
feature -- Access
value: JSON_OBJECT
object: DS_HASH_TABLE [ANY, HASHABLE]
feature -- Conversion
from_json (j: like value): detachable like object
local
keys: ARRAY [JSON_STRING]
i: INTEGER
h: HASHABLE
a: ANY
do
keys := j.current_keys
create Result.make (keys.count)
from
i := 1
until
i > keys.count
loop
h ?= json.object (keys [i], void)
check h /= Void end
a := json.object (j.item (keys [i]), Void)
Result.put (a, h)
i := i + 1
end
end
to_json (o: like object): like value
local
c: DS_HASH_TABLE_CURSOR [ANY, HASHABLE]
js: JSON_STRING
jv: JSON_VALUE
failed: BOOLEAN
do
create Result.make
from
c := o.new_cursor
c.start
until
c.after
loop
if attached {JSON_STRING} json.value (c.key) as l_key then
js := l_key
else
create js.make_json (c.key.out)
end
jv := json.value (c.item)
if jv /= Void then
Result.put (jv, js)
else
failed := True
end
c.forth
end
if failed then
Result := Void
end
end
end -- class JSON_DS_HASH_TABLE_CONVERTER

View File

@@ -1,62 +0,0 @@
note
description: "A JSON converter for DS_LINKED_LIST [ANY]"
author: "Paul Cohen"
date: "$Date: $"
revision: "$Revision: $"
file: "$HeadURL: $"
class JSON_DS_LINKED_LIST_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
do
create object.make
end
feature -- Access
value: JSON_ARRAY
object: DS_LINKED_LIST [ANY]
feature -- Conversion
from_json (j: like value): detachable like object
local
i: INTEGER
do
create Result.make
from
i := 1
until
i > j.count
loop
Result.put_last (json.object (j [i], Void))
i := i + 1
end
end
to_json (o: like object): like value
local
c: DS_LIST_CURSOR [ANY]
do
create Result.make_array
from
c := o.new_cursor
c.start
until
c.after
loop
Result.add (json.value (c.item))
c.forth
end
end
end -- class JSON_DS_LINKED_LIST_CONVERTER

View File

@@ -1,32 +0,0 @@
note
description: "[
Shared factory class for creating JSON objects. Maps JSON
objects to Gobo DS_HASH_TABLEs and JSON arrays to Gobo
DS_LINKED_LISTs. Use non-conforming inheritance from this
class to ensure that your classes share the same
JSON_FACTORY instance.
]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class SHARED_GOBO_EJSON
feature
json: EJSON
-- A shared EJSON instance with default converters for
-- DS_LINKED_LIST [ANY] and DS_HASH_TABLE [ANY, HASHABLE]
local
jllc: JSON_DS_LINKED_LIST_CONVERTER
jhtc: JSON_DS_HASH_TABLE_CONVERTER
once
create Result
create jllc.make
Result.add_converter (jllc)
create jhtc.make
Result.add_converter (jhtc)
end
end -- class SHARED_GOBO_EJSON

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
<target name="json">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard" namespace="EJSON.Library">
<assertions/>
<warning name="export_class_missing" enabled="false"/>
<warning name="old_verbatim_strings" enabled="false"/>
<warning name="syntax" enabled="false"/>
<warning name="vjrv" enabled="false"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf" readonly="true"/>
<cluster name="json" location=".\" recursive="true">
<file_rule>
<exclude>^/gobo$</exclude>
<exclude>^/kernel$</exclude>
<exclude>^/extras$</exclude>
</file_rule>
<cluster name="kernel" location=".\kernel\" recursive="true"/>
<cluster name="extras" location=".\extras\" recursive="true"/>
</cluster>
</target>
</system>

View File

@@ -1,28 +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="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
<target name="json">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" void_safety="none" syntax="standard" namespace="EJSON.Library">
<assertions/>
<warning name="export_class_missing" enabled="false"/>
<warning name="old_verbatim_strings" enabled="false"/>
<warning name="syntax" enabled="false"/>
<warning name="vjrv" enabled="false"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
<cluster name="json" location=".\" recursive="true">
<file_rule>
<exclude>^/gobo$</exclude>
<exclude>^/kernel$</exclude>
<exclude>^/extras$</exclude>
</file_rule>
<cluster name="kernel" location=".\kernel\" recursive="true"/>
<cluster name="extras" location=".\extras\" recursive="true"/>
</cluster>
</target>
</system>

View File

@@ -1,17 +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="json_gobo" uuid="437195AB-8B3C-4238-8998-A932A1423449" library_target="json_gobo">
<target name="json_gobo">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" void_safety="none" syntax="standard" namespace="EJSON.Library">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
<library name="json" location="json.ecf" readonly="true"/>
<library name="gobo_structure" location="$ISE_LIBRARY\library\gobo\gobo_structure.ecf"/>
<cluster name="json_gobo" location=".\gobo" recursive="true" />
</target>
</system>

View File

@@ -1,30 +0,0 @@
note
description: "A JSON converter for ARRAYED_LIST [ANY]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class JSON_ARRAYED_LIST_CONVERTER
inherit
JSON_LIST_CONVERTER
redefine
object
end
create
make
feature -- Access
object: ARRAYED_LIST [detachable ANY]
feature {NONE} -- Factory
new_object (nb: INTEGER): like object
do
create Result.make (nb)
end
end -- class JSON_ARRAYED_LIST_CONVERTER

View File

@@ -1,36 +0,0 @@
note
description: "A JSON converter"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
deferred class JSON_CONVERTER
inherit
SHARED_EJSON
feature -- Access
object: ANY
-- Eiffel object
deferred
end
feature -- Conversion
from_json (j: attached like to_json): detachable like object
-- Convert from JSON value.
-- Returns Void if unable to convert
deferred
end
to_json (o: like object): detachable JSON_VALUE
-- Convert to JSON value
deferred
end
invariant
has_eiffel_object: object /= Void -- An empty object must be created at creation time!
end

View File

@@ -1,76 +0,0 @@
note
description: "A JSON converter for HASH_TABLE [ANY, HASHABLE]"
author: "Paul Cohen"
date: "$Date: 2014-01-30 15:27:41 +0100 (jeu., 30 janv. 2014) $"
revision: "$Revision: 94128 $"
file: "$HeadURL: $"
class JSON_HASH_TABLE_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
do
create object.make (0)
end
feature -- Access
object: HASH_TABLE [ANY, HASHABLE]
feature -- Conversion
from_json (j: attached like to_json): like object
do
create Result.make (j.count)
across
j as ic
loop
if attached json.object (ic.item, Void) as l_object then
if attached {HASHABLE} json.object (ic.key, Void) as h then
Result.put (l_object, h)
else
check key_is_hashable: False end
end
else
check object_attached: False end
end
end
end
to_json (o: like object): detachable JSON_OBJECT
local
c: HASH_TABLE_ITERATION_CURSOR [ANY, HASHABLE]
js: JSON_STRING
failed: BOOLEAN
do
create Result.make
from
c := o.new_cursor
until
c.after
loop
if attached {JSON_STRING} json.value (c.key) as l_key then
js := l_key
else
create js.make_json (c.key.out)
end
if attached json.value (c.item) as jv then
Result.put (jv, js)
else
failed := True
end
c.forth
end
if failed then
Result := Void
end
end
end -- class JSON_HASH_TABLE_CONVERTER

View File

@@ -1,30 +0,0 @@
note
description: "A JSON converter for LINKED_LIST [ANY]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class JSON_LINKED_LIST_CONVERTER
inherit
JSON_LIST_CONVERTER
redefine
object
end
create
make
feature -- Access
object: LINKED_LIST [detachable ANY]
feature {NONE} -- Factory
new_object (nb: INTEGER): like object
do
create Result.make
end
end -- class JSON_LINKED_LIST_CONVERTER

View File

@@ -1,74 +0,0 @@
note
description: "A JSON converter for LIST [ANY]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
deferred class JSON_LIST_CONVERTER
inherit
JSON_CONVERTER
feature {NONE} -- Initialization
make
do
object := new_object (0)
end
feature -- Access
object: LIST [detachable ANY]
feature {NONE} -- Factory
new_object (nb: INTEGER): like object
deferred
ensure
Result /= Void
end
feature -- Conversion
from_json (j: attached like to_json): detachable like object
local
i: INTEGER
do
Result := new_object (j.count)
from
i := 1
until
i > j.count
loop
Result.extend (json.object (j [i], Void))
i := i + 1
end
end
to_json (o: like object): detachable JSON_ARRAY
local
c: ITERATION_CURSOR [detachable ANY]
jv: detachable JSON_VALUE
failed: BOOLEAN
do
create Result.make_array
from
c := o.new_cursor
until
c.after
loop
jv := json.value (c.item)
if jv /= Void then
Result.add (jv)
else
failed := True
end
c.forth
end
if failed then
Result := Void
end
end
end -- class JSON_ARRAYED_LIST_CONVERTER

View File

@@ -1,268 +0,0 @@
note
description: "Core factory class for creating JSON objects and corresponding Eiffel objects."
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class EJSON
inherit
EXCEPTIONS
feature -- Access
value (an_object: detachable ANY): detachable JSON_VALUE
-- JSON value from Eiffel object. Raises an "eJSON exception" if
-- unable to convert value.
local
i: INTEGER
ja: JSON_ARRAY
do
-- Try to convert from basic Eiffel types. Note that we check with
-- `conforms_to' since the client may have subclassed the base class
-- that these basic types are derived from.
if an_object = Void then
create {JSON_NULL} Result
elseif attached {BOOLEAN} an_object as b then
create {JSON_BOOLEAN} Result.make_boolean (b)
elseif attached {INTEGER_8} an_object as i8 then
create {JSON_NUMBER} Result.make_integer (i8)
elseif attached {INTEGER_16} an_object as i16 then
create {JSON_NUMBER} Result.make_integer (i16)
elseif attached {INTEGER_32} an_object as i32 then
create {JSON_NUMBER} Result.make_integer (i32)
elseif attached {INTEGER_64} an_object as i64 then
create {JSON_NUMBER} Result.make_integer (i64)
elseif attached {NATURAL_8} an_object as n8 then
create {JSON_NUMBER} Result.make_natural (n8)
elseif attached {NATURAL_16} an_object as n16 then
create {JSON_NUMBER} Result.make_natural (n16)
elseif attached {NATURAL_32} an_object as n32 then
create {JSON_NUMBER} Result.make_natural (n32)
elseif attached {NATURAL_64} an_object as n64 then
create {JSON_NUMBER} Result.make_natural (n64)
elseif attached {REAL_32} an_object as r32 then
create {JSON_NUMBER} Result.make_real (r32)
elseif attached {REAL_64} an_object as r64 then
create {JSON_NUMBER} Result.make_real (r64)
elseif attached {ARRAY [detachable ANY]} an_object as a then
create ja.make_array
from
i := a.lower
until
i > a.upper
loop
if attached value (a @ i) as v then
ja.add (v)
else
check value_attached: False end
end
i := i + 1
end
Result := ja
elseif attached {CHARACTER_8} an_object as c8 then
create {JSON_STRING} Result.make_json (c8.out)
elseif attached {CHARACTER_32} an_object as c32 then
create {JSON_STRING} Result.make_json (c32.out)
elseif attached {STRING_8} an_object as s8 then
create {JSON_STRING} Result.make_json (s8)
elseif attached {STRING_32} an_object as s32 then
create {JSON_STRING} Result.make_json_from_string_32 (s32)
end
if Result = Void then
-- Now check the converters
if an_object /= Void and then attached converter_for (an_object) as jc then
Result := jc.to_json (an_object)
else
raise (exception_failed_to_convert_to_json (an_object))
end
end
end
object (a_value: detachable JSON_VALUE; base_class: detachable STRING): detachable ANY
-- Eiffel object from JSON value. If `base_class' /= Void an eiffel
-- object based on `base_class' will be returned. Raises an "eJSON
-- exception" if unable to convert value.
local
i: INTEGER
ll: LINKED_LIST [detachable ANY]
t: HASH_TABLE [detachable ANY, STRING_GENERAL]
keys: ARRAY [JSON_STRING]
do
if a_value = Void then
Result := Void
else
if base_class = Void then
if a_value = Void then
Result := Void
elseif attached {JSON_NULL} a_value then
Result := Void
elseif attached {JSON_BOOLEAN} a_value as jb then
Result := jb.item
elseif attached {JSON_NUMBER} a_value as jn then
if jn.item.is_integer_8 then
Result := jn.item.to_integer_8
elseif jn.item.is_integer_16 then
Result := jn.item.to_integer_16
elseif jn.item.is_integer_32 then
Result := jn.item.to_integer_32
elseif jn.item.is_integer_64 then
Result := jn.item.to_integer_64
elseif jn.item.is_natural_64 then
Result := jn.item.to_natural_64
elseif jn.item.is_double then
Result := jn.item.to_double
end
elseif attached {JSON_STRING} a_value as js then
create {STRING_32} Result.make_from_string (js.unescaped_string_32)
elseif attached {JSON_ARRAY} a_value as ja then
from
create ll.make
i := 1
until
i > ja.count
loop
ll.extend (object (ja [i], Void))
i := i + 1
end
Result := ll
elseif attached {JSON_OBJECT} a_value as jo then
keys := jo.current_keys
create t.make (keys.count)
from
i := keys.lower
until
i > keys.upper
loop
if attached {STRING_GENERAL} object (keys [i], Void) as s then
t.put (object (jo.item (keys [i]), Void), s)
end
i := i + 1
end
Result := t
end
else
if converters.has_key (base_class) and then attached converters.found_item as jc then
Result := jc.from_json (a_value)
else
raise (exception_failed_to_convert_to_eiffel (a_value, base_class))
end
end
end
end
object_from_json (json: STRING; base_class: detachable STRING): detachable ANY
-- Eiffel object from JSON representation. If `base_class' /= Void an
-- Eiffel object based on `base_class' will be returned. Raises an
-- "eJSON exception" if unable to convert value.
require
json_not_void: json /= Void
local
jv: detachable JSON_VALUE
do
json_parser.set_representation (json)
jv := json_parser.parse
if jv /= Void then
Result := object (jv, base_class)
end
end
converter_for (an_object: ANY): detachable JSON_CONVERTER
-- Converter for objects. Returns Void if none found.
require
an_object_not_void: an_object /= Void
do
if converters.has_key (an_object.generator) then
Result := converters.found_item
end
end
json_reference (s: STRING): JSON_OBJECT
-- A JSON (Dojo style) reference object using `s' as the
-- reference value. The caller is responsable for ensuring
-- the validity of `s' as a json reference.
require
s_not_void: s /= Void
local
js_key, js_value: JSON_STRING
do
create Result.make
create js_key.make_json ("$ref")
create js_value.make_json (s)
Result.put (js_value, js_key)
end
json_references (l: LIST [STRING]): JSON_ARRAY
-- A JSON array of JSON (Dojo style) reference objects using the
-- strings in `l' as reference values. The caller is responsable
-- for ensuring the validity of all strings in `l' as json
-- references.
require
l_not_void: l /= Void
local
c: ITERATION_CURSOR [STRING]
do
create Result.make_array
from
c := l.new_cursor
until
c.after
loop
Result.add (json_reference (c.item))
c.forth
end
end
feature -- Change
add_converter (jc: JSON_CONVERTER)
-- Add the converter `jc'.
require
jc_not_void: jc /= Void
do
converters.force (jc, jc.object.generator)
ensure
has_converter: converter_for (jc.object) /= Void
end
feature {NONE} -- Implementation
converters: HASH_TABLE [JSON_CONVERTER, STRING]
-- Converters hashed by generator (base class)
once
create Result.make (10)
end
feature {NONE} -- Implementation (Exceptions)
exception_prefix: STRING = "eJSON exception: "
exception_failed_to_convert_to_eiffel (a_value: JSON_VALUE; base_class: detachable STRING): STRING
-- Exception message for failing to convert a JSON_VALUE to an instance of `a'.
do
Result := exception_prefix + "Failed to convert JSON_VALUE to an Eiffel object: " + a_value.generator
if base_class /= Void then
Result.append (" -> {" + base_class + "}")
end
end
exception_failed_to_convert_to_json (an_object: detachable ANY): STRING
-- Exception message for failing to convert `a' to a JSON_VALUE.
do
Result := exception_prefix + "Failed to convert Eiffel object to a JSON_VALUE"
if an_object /= Void then
Result.append (" : {" + an_object.generator + "}")
end
end
feature {NONE} -- Implementation (JSON parser)
json_parser: JSON_PARSER
once
create Result.make_parser ("")
end
end -- class EJSON

View File

@@ -1,178 +0,0 @@
note
description: "[
JSON_ARRAY represent an array in JSON.
An array in JSON is an ordered set of names.
Examples
array
[]
[elements]
]"
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
class
JSON_ARRAY
inherit
JSON_VALUE
ITERABLE [JSON_VALUE]
DEBUG_OUTPUT
create
make_array
feature {NONE} -- Initialization
make_array
-- Initialize JSON Array
do
create values.make (10)
end
feature -- Access
i_th alias "[]" (i: INTEGER): JSON_VALUE
-- Item at `i'-th position
require
is_valid_index: valid_index (i)
do
Result := values.i_th (i)
end
representation: STRING
local
i: INTEGER
do
Result := "["
from
i := 1
until
i > count
loop
Result.append (i_th (i).representation)
i := i + 1
if i <= count then
Result.append_character (',')
end
end
Result.append_character (']')
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_json_array' procedure on `a_visitor'.)
do
a_visitor.visit_json_array (Current)
end
feature -- Access
new_cursor: ITERATION_CURSOR [JSON_VALUE]
-- Fresh cursor associated with current structure
do
Result := values.new_cursor
end
feature -- Mesurement
count: INTEGER
-- Number of items.
do
Result := values.count
end
feature -- Status report
valid_index (i: INTEGER): BOOLEAN
-- Is `i' a valid index?
do
Result := (1 <= i) and (i <= count)
end
feature -- Change Element
put_front (v: JSON_VALUE)
require
v_not_void: v /= Void
do
values.put_front (v)
ensure
has_new_value: old values.count + 1 = values.count and
values.first = v
end
add, extend (v: JSON_VALUE)
require
v_not_void: v /= Void
do
values.extend (v)
ensure
has_new_value: old values.count + 1 = values.count and
values.has (v)
end
prune_all (v: JSON_VALUE)
-- Remove all occurrences of `v'.
require
v_not_void: v /= Void
do
values.prune_all (v)
ensure
not_has_new_value: not values.has (v)
end
wipe_out
-- Remove all items.
do
values.wipe_out
end
feature -- Report
hash_code: INTEGER
-- Hash code value
do
from
values.start
Result := values.item.hash_code
until
values.off
loop
Result:= ((Result \\ 8388593) |<< 8) + values.item.hash_code
values.forth
end
Result := Result \\ values.count
end
feature -- Conversion
array_representation: ARRAYED_LIST [JSON_VALUE]
-- Representation as a sequences of values
-- be careful, modifying the return object may have impact on the original JSON_ARRAY object
do
Result := values
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := count.out + " item(s)"
end
feature {NONE} -- Implementation
values: ARRAYED_LIST [JSON_VALUE]
-- Value container
invariant
value_not_void: values /= Void
end

View File

@@ -1,61 +0,0 @@
note
description: "JSON Truth values"
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
class
JSON_BOOLEAN
inherit
JSON_VALUE
create
make_boolean
feature {NONE} -- Initialization
make_boolean (an_item: BOOLEAN)
--Initialize.
do
item := an_item
end
feature -- Access
item: BOOLEAN
-- Content
hash_code: INTEGER
-- Hash code value
do
Result := item.hash_code
end
representation: STRING
do
if item then
Result := "true"
else
Result := "false"
end
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_json_boolean' procedure on `a_visitor'.)
do
a_visitor.visit_json_boolean (Current)
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := item.out
end
end

View File

@@ -1,47 +0,0 @@
note
description: "JSON Null Values"
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
class
JSON_NULL
inherit
JSON_VALUE
feature --Access
hash_code: INTEGER
-- Hash code value
do
Result := null_value.hash_code
end
representation: STRING
do
Result := "null"
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_element_a' procedure on `a_visitor'.)
do
a_visitor.visit_json_null (Current)
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := null_value
end
feature {NONE}-- Implementation
null_value: STRING = "null"
end

View File

@@ -1,99 +0,0 @@
note
description: "JSON Numbers, octal and hexadecimal formats are not used."
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
class
JSON_NUMBER
inherit
JSON_VALUE
redefine
is_equal
end
create
make_integer,
make_natural,
make_real
feature {NONE} -- initialization
make_integer (an_argument: INTEGER_64)
-- Initialize an instance of JSON_NUMBER from the integer value of `an_argument'.
do
item := an_argument.out
numeric_type := INTEGER_TYPE
end
make_natural (an_argument: NATURAL_64)
-- Initialize an instance of JSON_NUMBER from the unsigned integer value of `an_argument'.
do
item := an_argument.out
numeric_type := NATURAL_TYPE
end
make_real (an_argument: DOUBLE)
-- Initialize an instance of JSON_NUMBER from the floating point value of `an_argument'.
do
item := an_argument.out
numeric_type := DOUBLE_TYPE
end
feature -- Access
item: STRING
-- Content
hash_code: INTEGER
--Hash code value
do
Result := item.hash_code
end
representation: STRING
do
Result := item
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_json_number' procedure on `a_visitor'.)
do
a_visitor.visit_json_number (Current)
end
feature -- Status
is_equal (other: like Current): BOOLEAN
-- Is `other' attached to an object of the same type
-- as current object and identical to it?
do
Result := item.is_equal (other.item)
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := item
end
feature -- Implementation
INTEGER_TYPE: INTEGER = 1
DOUBLE_TYPE: INTEGER = 2
NATURAL_TYPE: INTEGER = 3
numeric_type: INTEGER
invariant
item_not_void: item /= Void
end

View File

@@ -1,317 +0,0 @@
note
description: "[
An JSON_OBJECT represent an object in JSON.
An object is an unordered set of name/value pairs
Examples:
object
{}
{"key": "value"}
]"
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
class
JSON_OBJECT
inherit
JSON_VALUE
TABLE_ITERABLE [JSON_VALUE, JSON_STRING]
DEBUG_OUTPUT
create
make
feature {NONE} -- Initialization
make
-- Initialize
do
create object.make (10)
end
feature -- Change Element
put (value: detachable JSON_VALUE; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: like value
do
l_value := value
if l_value = Void then
create {JSON_NULL} l_value
end
object.extend (l_value, key)
end
put_string (value: READABLE_STRING_GENERAL; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_STRING
do
create l_value.make_json_from_string_32 (value.as_string_32)
put (l_value, key)
end
put_integer (value: INTEGER_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_NUMBER
do
create l_value.make_integer (value)
put (l_value, key)
end
put_natural (value: NATURAL_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_NUMBER
do
create l_value.make_natural (value)
put (l_value, key)
end
put_real (value: DOUBLE; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_NUMBER
do
create l_value.make_real (value)
put (l_value, key)
end
put_boolean (value: BOOLEAN; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_BOOLEAN
do
create l_value.make_boolean (value)
put (l_value, key)
end
replace (value: detachable JSON_VALUE; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: like value
do
l_value := value
if l_value = Void then
create {JSON_NULL} l_value
end
object.force (l_value, key)
end
replace_with_string (value: READABLE_STRING_GENERAL; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_STRING
do
create l_value.make_json_from_string_32 (value.as_string_32)
replace (l_value, key)
end
replace_with_integer (value: INTEGER_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_NUMBER
do
create l_value.make_integer (value)
replace (l_value, key)
end
replace_with_with_natural (value: NATURAL_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_NUMBER
do
create l_value.make_natural (value)
replace (l_value, key)
end
replace_with_real (value: DOUBLE; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_NUMBER
do
create l_value.make_real (value)
replace (l_value, key)
end
replace_with_boolean (value: BOOLEAN; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_BOOLEAN
do
create l_value.make_boolean (value)
replace (l_value, key)
end
remove (key: JSON_STRING)
-- Remove item indexed by `key' if any.
do
object.remove (key)
end
wipe_out
-- Reset all items to default values; reset status.
do
object.wipe_out
end
feature -- Access
has_key (key: JSON_STRING): BOOLEAN
-- has the JSON_OBJECT contains a specific key 'key'.
do
Result := object.has (key)
end
has_item (value: JSON_VALUE): BOOLEAN
-- has the JSON_OBJECT contain a specfic item 'value'
do
Result := object.has_item (value)
end
item (key: JSON_STRING): detachable JSON_VALUE
-- the json_value associated with a key.
do
Result := object.item (key)
end
current_keys: ARRAY [JSON_STRING]
-- array containing actually used keys
do
Result := object.current_keys
end
representation: STRING
local
t: HASH_TABLE [JSON_VALUE, JSON_STRING]
do
create Result.make (2)
Result.append_character ('{')
from
t := map_representation
t.start
until
t.after
loop
Result.append (t.key_for_iteration.representation)
Result.append_character (':')
Result.append (t.item_for_iteration.representation)
t.forth
if not t.after then
Result.append_character (',')
end
end
Result.append_character ('}')
end
feature -- Mesurement
count: INTEGER
-- Number of field
do
Result := object.count
end
feature -- Access
new_cursor: TABLE_ITERATION_CURSOR [JSON_VALUE, JSON_STRING]
-- Fresh cursor associated with current structure
do
Result := object.new_cursor
end
feature -- Status report
is_empty: BOOLEAN
-- Is empty object?
do
Result := object.is_empty
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_json_object' procedure on `a_visitor'.)
do
a_visitor.visit_json_object (Current)
end
feature -- Conversion
map_representation: HASH_TABLE [JSON_VALUE, JSON_STRING]
--A representation that maps keys to values
do
Result := object
end
feature -- Report
hash_code: INTEGER
-- Hash code value
do
from
object.start
Result := object.out.hash_code
until
object.off
loop
Result := ((Result \\ 8388593) |<< 8) + object.item_for_iteration.hash_code
object.forth
end
-- Ensure it is a positive value.
Result := Result.hash_code
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := count.out + " item(s)"
end
feature {NONE} -- Implementation
object: HASH_TABLE [JSON_VALUE, JSON_STRING]
-- Value container
invariant
object_not_void: object /= Void
end

View File

@@ -1,425 +0,0 @@
note
description: "[
A JSON_STRING represent a string in JSON.
A string is a collection of zero or more Unicodes characters, wrapped in double
quotes, using blackslash espaces.
]"
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
class
JSON_STRING
inherit
JSON_VALUE
redefine
is_equal
end
create
make_json,
make_json_from_string_32,
make_with_escaped_json
convert
make_json ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8}),
make_json_from_string_32 ({READABLE_STRING_32, STRING_32, IMMUTABLE_STRING_32})
feature {NONE} -- Initialization
make_json (s: READABLE_STRING_8)
-- Initialize.
require
item_not_void: s /= Void
do
make_with_escaped_json (escaped_json_string (s))
end
make_json_from_string_32 (s: READABLE_STRING_32)
-- Initialize from STRING_32 `s'.
require
item_not_void: s /= Void
do
make_with_escaped_json (escaped_json_string_32 (s))
end
make_with_escaped_json (s: READABLE_STRING_8)
-- Initialize with an_item already escaped
require
item_not_void: s /= Void
do
item := s
end
feature -- Access
item: STRING
-- Contents with escaped entities if any
feature -- Conversion
unescaped_string_8: STRING_8
-- Unescaped string from `item'.
--| note: valid only if `item' does not encode any unicode character.
local
s: like item
do
s := item
create Result.make (s.count)
unescape_to_string_8 (Result)
end
unescaped_string_32: STRING_32
-- Unescaped string 32 from `item'
--| some encoders uses UTF-8 , and not the recommended pure json encoding
--| thus, let's support the UTF-8 encoding during decoding.
local
s: READABLE_STRING_8
do
s := item
create Result.make (s.count)
unescape_to_string_32 (Result)
end
representation: STRING
-- String representation of `item' with escaped entities if any
do
create Result.make (item.count + 2)
Result.append_character ('%"')
Result.append (item)
Result.append_character ('%"')
end
unescape_to_string_8 (a_output: STRING_8)
-- Unescape string `item' into `a_output'.
--| note: valid only if `item' does not encode any unicode character.
local
s: like item
i, n: INTEGER
c: CHARACTER
do
s := item
n := s.count
from i := 1 until i > n loop
c := s[i]
if c = '\' then
if i < n then
inspect s[i+1]
when '\' then
a_output.append_character ('\')
i := i + 2
when '%"' then
a_output.append_character ('%"')
i := i + 2
when 'b' then
a_output.append_character ('%B')
i := i + 2
when 'f' then
a_output.append_character ('%F')
i := i + 2
when 'n' then
a_output.append_character ('%N')
i := i + 2
when 'r' then
a_output.append_character ('%R')
i := i + 2
when 't' then
a_output.append_character ('%T')
i := i + 2
when 'u' then
--| Leave Unicode \uXXXX unescaped
a_output.append_character ('\')
i := i + 1
else
a_output.append_character ('\')
i := i + 1
end
else
a_output.append_character ('\')
i := i + 1
end
else
a_output.append_character (c)
i := i + 1
end
end
end
unescape_to_string_32 (a_output: STRING_32)
-- Unescape string `item' into `a_output' string 32.
--| some encoders uses UTF-8 , and not the recommended pure json encoding
--| thus, let's support the UTF-8 encoding during decoding.
local
s: READABLE_STRING_8
i, n: INTEGER
c: NATURAL_32
ch: CHARACTER_8
hex: READABLE_STRING_8
do
s := item
n := s.count
from i := 1 until i > n loop
ch := s.item (i)
if ch = '\' then
if i < n then
inspect s[i+1]
when '\' then
a_output.append_character ('\')
i := i + 2
when '%"' then
a_output.append_character ('%"')
i := i + 2
when 'b' then
a_output.append_character ('%B')
i := i + 2
when 'f' then
a_output.append_character ('%F')
i := i + 2
when 'n' then
a_output.append_character ('%N')
i := i + 2
when 'r' then
a_output.append_character ('%R')
i := i + 2
when 't' then
a_output.append_character ('%T')
i := i + 2
when 'u' then
hex := s.substring (i + 2, i + 5) -- i+2 , i+2+4-1
if hex.count = 4 then
a_output.append_code (hexadecimal_to_natural_32 (hex))
end
i := i + 6 -- i +2 +4
else
a_output.append_character ('\')
i := i + 1
end
else
a_output.append_character ('\')
i := i + 1
end
else
c := ch.natural_32_code
if c <= 0x7F then
-- 0xxxxxxx
check ch = c.to_character_32 end
a_output.append_character (ch)
elseif c <= 0xDF then
-- 110xxxxx 10xxxxxx
i := i + 1
if i <= n then
a_output.append_code (
((c & 0x1F) |<< 6) |
(s.code (i) & 0x3F)
)
end
elseif c <= 0xEF then
-- 1110xxxx 10xxxxxx 10xxxxxx
i := i + 2
if i <= n then
a_output.append_code (
((c & 0xF) |<< 12) |
((s.code (i - 1) & 0x3F) |<< 6) |
(s.code (i) & 0x3F)
)
end
elseif c <= 0xF7 then
-- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
i := i + 3
if i <= n then
a_output.append_code (
((c & 0x7) |<< 18) |
((s.code (i - 2) & 0x3F) |<< 12) |
((s.code (i - 1) & 0x3F) |<< 6) |
(s.code (i) & 0x3F)
)
end
end
i := i + 1
end
end
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_json_string' procedure on `a_visitor'.)
do
a_visitor.visit_json_string (Current)
end
feature -- Comparison
is_equal (other: like Current): BOOLEAN
-- Is JSON_STRING made of same character sequence as `other'
-- (possibly with a different capacity)?
do
Result := item.same_string (other.item)
end
feature -- Change Element
append (a_string: STRING)
-- Add a_string
require
a_string_not_void: a_string /= Void
do
item.append_string (a_string)
end
feature -- Status report
hash_code: INTEGER
-- Hash code value
do
Result := item.hash_code
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := item
end
feature {NONE} -- Implementation
is_hexadecimal (s: READABLE_STRING_8): BOOLEAN
-- Is `s' an hexadecimal value?
local
i: INTEGER
do
from
Result := True
i := 1
until
i > s.count or not Result
loop
Result := s[i].is_hexa_digit
i := i + 1
end
end
hexadecimal_to_natural_32 (s: READABLE_STRING_8): NATURAL_32
-- Hexadecimal string `s' converted to NATURAL_32 value
require
s_not_void: s /= Void
is_hexadecimal: is_hexadecimal (s)
local
i, nb: INTEGER
char: CHARACTER
do
nb := s.count
if nb >= 2 and then s.item (2) = 'x' then
i := 3
else
i := 1
end
from
until
i > nb
loop
Result := Result * 16
char := s.item (i)
if char >= '0' and then char <= '9' then
Result := Result + (char |-| '0').to_natural_32
else
Result := Result + (char.lower |-| 'a' + 10).to_natural_32
end
i := i + 1
end
end
escaped_json_string (s: READABLE_STRING_8): STRING_8
-- JSON string with '"' and '\' characters escaped
require
s_not_void: s /= Void
local
i, n: INTEGER
c: CHARACTER_8
do
n := s.count
create Result.make (n + n // 10)
from i := 1 until i > n loop
c := s.item (i)
inspect c
when '%"' then Result.append_string ("\%"")
when '\' then Result.append_string ("\\")
when '%B' then Result.append_string ("\b")
when '%F' then Result.append_string ("\f")
when '%N' then Result.append_string ("\n")
when '%R' then Result.append_string ("\r")
when '%T' then Result.append_string ("\t")
else
Result.extend (c)
end
i := i + 1
end
end
escaped_json_string_32 (s: READABLE_STRING_32): STRING_8
-- JSON string with '"' and '\' characters and Unicode escaped
require
s_not_void: s /= Void
local
i, j, n: INTEGER
uc: CHARACTER_32
c: CHARACTER_8
h: STRING_8
do
n := s.count
create Result.make (n + n // 10)
from i := 1 until i > n loop
uc := s.item (i)
if uc.is_character_8 then
c := uc.to_character_8
inspect c
when '%"' then Result.append_string ("\%"")
when '\' then Result.append_string ("\\")
when '%B' then Result.append_string ("\b")
when '%F' then Result.append_string ("\f")
when '%N' then Result.append_string ("\n")
when '%R' then Result.append_string ("\r")
when '%T' then Result.append_string ("\t")
else
Result.extend (c)
end
else
Result.append ("\u")
h := uc.code.to_hex_string
-- Remove first 0 and keep 4 hexa digit
from
j := 1
until
h.count = 4 or (j <= h.count and then h.item (j) /= '0')
loop
j := j + 1
end
h := h.substring (j, h.count)
from
until
h.count >= 4
loop
h.prepend_integer (0)
end
check h.count = 4 end
Result.append (h)
end
i := i + 1
end
end
invariant
item_not_void: item /= Void
end

View File

@@ -1,43 +0,0 @@
note
description:"[
JSON_VALUE represent a value in JSON.
A value can be
* a string in double quotes
* a number
* boolean value(true, false )
* null
* an object
* an array
]"
author: "Javier Velilla"
date: "2008/05/19"
revision: "Revision 0.1"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
deferred class
JSON_VALUE
inherit
HASHABLE
DEBUG_OUTPUT
feature -- Access
representation: STRING
-- UTF-8 encoded Unicode string representation of Current
deferred
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_*' procedure on `a_visitor'.)
require
a_visitor_not_void: a_visitor /= Void
deferred
end
end

View File

@@ -1,513 +0,0 @@
note
description: "Parse serialized JSON data"
author: "jvelilla"
date: "2008/08/24"
revision: "Revision 0.1"
class
JSON_PARSER
inherit
JSON_READER
JSON_TOKENS
create
make_parser
feature {NONE} -- Initialize
make_parser (a_json: STRING)
-- Initialize.
require
json_not_empty: a_json /= Void and then not a_json.is_empty
do
make (a_json)
is_parsed := True
create errors.make
end
feature -- Status report
is_parsed: BOOLEAN
-- Is parsed?
errors: LINKED_LIST [STRING]
-- Current errors
current_errors: STRING
-- Current errors as string
do
create Result.make_empty
from
errors.start
until
errors.after
loop
Result.append_string (errors.item + "%N")
errors.forth
end
end
feature -- Element change
report_error (e: STRING)
-- Report error `e'
require
e_not_void: e /= Void
do
errors.force (e)
end
feature -- Commands
parse_json: detachable JSON_VALUE
-- Parse JSON data `representation'
-- start ::= object | array
do
if is_valid_start_symbol then
Result := parse
if extra_elements then
is_parsed := False
end
else
is_parsed := False
report_error ("Syntax error unexpected token, expecting `{' or `['")
end
end
parse: detachable JSON_VALUE
-- Parse JSON data `representation'
local
c: CHARACTER
do
if is_parsed then
skip_white_spaces
c := actual
inspect c
when j_OBJECT_OPEN then
Result := parse_object
when j_STRING then
Result := parse_string
when j_ARRAY_OPEN then
Result := parse_array
else
if c.is_digit or c = j_MINUS then
Result := parse_number
elseif is_null then
Result := create {JSON_NULL}
next
next
next
elseif is_true then
Result := create {JSON_BOOLEAN}.make_boolean (True)
next
next
next
elseif is_false then
Result := create {JSON_BOOLEAN}.make_boolean (False)
next
next
next
next
else
is_parsed := False
report_error ("JSON is not well formed in parse")
Result := Void
end
end
end
ensure
is_parsed_implies_result_not_void: is_parsed implies Result /= Void
end
parse_object: JSON_OBJECT
-- object
-- {}
-- {"key" : "value" [,]}
local
has_more: BOOLEAN
l_json_string: detachable JSON_STRING
l_value: detachable JSON_VALUE
do
create Result.make
-- check if is an empty object {}
next
skip_white_spaces
if actual = j_OBJECT_CLOSE then
--is an empty object
else
-- a complex object {"key" : "value"}
previous
from has_more := True until not has_more loop
next
skip_white_spaces
l_json_string := parse_string
next
skip_white_spaces
if actual = ':' then
next
skip_white_spaces
else
is_parsed := False
report_error ("%N Input string is a not well formed JSON, expected: : found: " + actual.out)
has_more := False
end
l_value := parse
if is_parsed and then (l_value /= Void and l_json_string /= Void) then
Result.put (l_value, l_json_string)
next
skip_white_spaces
if actual = j_OBJECT_CLOSE then
has_more := False
elseif actual /= ',' then
has_more := False
is_parsed := False
report_error ("JSON Object syntactically malformed expected , found: [" + actual.out + "]")
end
else
has_more := False
-- explain the error
end
end
end
end
parse_string: detachable JSON_STRING
-- Parsed string
local
has_more: BOOLEAN
l_json_string: STRING
l_unicode: STRING
c: like actual
do
create l_json_string.make_empty
if actual = j_STRING then
from
has_more := True
until
not has_more
loop
next
c := actual
if c = j_STRING then
has_more := False
elseif c = '%H' then
next
c := actual
if c = 'u' then
create l_unicode.make_from_string ("\u")
l_unicode.append (read_unicode)
c := actual
if is_valid_unicode (l_unicode) then
l_json_string.append (l_unicode)
else
has_more := False
is_parsed := False
report_error ("Input String is not well formed JSON, expected a Unicode value, found [" + c.out + " ]")
end
elseif (not is_special_character (c) and not is_special_control (c)) or c = '%N' then
has_more := False
is_parsed := False
report_error ("Input String is not well formed JSON, found [" + c.out + " ]")
else
l_json_string.append_character ('\')
l_json_string.append_character (c)
end
else
if is_special_character (c) and c /= '/' then
has_more := False
is_parsed := False
report_error ("Input String is not well formed JSON, found [" + c.out + " ]")
else
l_json_string.append_character (c)
end
end
end
create Result.make_with_escaped_json (l_json_string)
else
Result := Void
end
end
parse_array: JSON_ARRAY
-- array
-- []
-- [elements [,]]
local
flag: BOOLEAN
l_value: detachable JSON_VALUE
c: like actual
do
create Result.make_array
--check if is an empty array []
next
skip_white_spaces
if actual = j_array_close then
--is an empty array
else
previous
from
flag := True
until
not flag
loop
next
skip_white_spaces
l_value := parse
if is_parsed and then l_value /= Void then
Result.add (l_value)
next
skip_white_spaces
c := actual
if c = j_ARRAY_CLOSE then
flag := False
elseif c /= ',' then
flag := False
is_parsed := False
report_error ("Array is not well formed JSON, found [" + c.out + " ]")
end
else
flag := False
report_error ("Array is not well formed JSON, found [" + actual.out + " ]")
end
end
end
end
parse_number: detachable JSON_NUMBER
-- Parsed number
local
sb: STRING
flag: BOOLEAN
is_integer: BOOLEAN
c: like actual
do
create sb.make_empty
sb.append_character (actual)
from
flag := True
until
not flag
loop
next
c := actual
if not has_next or is_close_token (c)
or c = ',' or c = '%N' or c = '%R'
then
flag := False
previous
else
sb.append_character (c)
end
end
if is_valid_number (sb) then
if sb.is_integer then
create Result.make_integer (sb.to_integer)
is_integer := True
elseif sb.is_double and not is_integer then
create Result.make_real (sb.to_double)
end
else
is_parsed := False
report_error ("Expected a number, found: [ " + sb + " ]")
end
end
is_null: BOOLEAN
-- Word at index represents null?
local
l_null: STRING
l_string: STRING
do
l_null := null_id
l_string := json_substring (index,index + l_null.count - 1)
if l_string.is_equal (l_null) then
Result := True
end
end
is_false: BOOLEAN
-- Word at index represents false?
local
l_false: STRING
l_string: STRING
do
l_false := false_id
l_string := json_substring (index, index + l_false.count - 1)
if l_string.is_equal (l_false) then
Result := True
end
end
is_true: BOOLEAN
-- Word at index represents true?
local
l_true: STRING
l_string: STRING
do
l_true := true_id
l_string := json_substring (index,index + l_true.count - 1)
if l_string.is_equal (l_true) then
Result := True
end
end
read_unicode: STRING
-- Read Unicode and return value
local
i: INTEGER
do
create Result.make_empty
from
i := 1
until
i > 4 or not has_next
loop
next
Result.append_character (actual)
i := i + 1
end
end
feature {NONE} -- Implementation
is_valid_number (a_number: STRING): BOOLEAN
-- is 'a_number' a valid number based on this regular expression
-- "-?(?: 0|[1-9]\d+)(?: \.\d+)?(?: [eE][+-]?\d+)?\b"?
local
s: detachable STRING
c: CHARACTER
i,n: INTEGER
do
create s.make_empty
n := a_number.count
if n = 0 then
Result := False
else
Result := True
i := 1
--| "-?"
c := a_number[i]
if c = '-' then
s.extend (c); i := i + 1; c := a_number[i]
end
--| "0|[1-9]\d*
if c.is_digit then
if c = '0' then
--| "0"
s.extend (c); i := i + 1; c := a_number[i]
else
--| "[1-9]"
s.extend (c); i := i + 1; c := a_number[i]
--| "\d*"
from until i > n or not c.is_digit loop
s.extend (c); i := i + 1; c := a_number[i]
end
end
end
end
if Result then
--| "(\.\d+)?"
if c = '.' then
--| "\.\d+" = "\.\d\d*"
s.extend (c); i := i + 1; c := a_number[i]
if c.is_digit then
from until i > n or not c.is_digit loop
s.extend (c); i := i + 1; c := a_number[i]
end
else
Result := False --| expecting digit
end
end
end
if Result then --| "(?:[eE][+-]?\d+)?\b"
if c = 'e' or c = 'E' then
--| "[eE][+-]?\d+"
s.extend (c); i := i + 1; c := a_number[i]
if c = '+' or c = '-' then
s.extend (c); i := i + 1; c := a_number[i]
end
if c.is_digit then
from until i > n or not c.is_digit loop
s.extend (c); i := i + 1; c := a_number[i]
end
else
Result := False --| expecting digit
end
end
end
if Result then --| "\b"
from until i > n or not c.is_space loop
s.extend (c); i := i + 1; c := a_number[i]
end
Result := i > n and then s.same_string (a_number)
end
end
is_valid_unicode (a_unicode: STRING): BOOLEAN
-- is 'a_unicode' a valid Unicode based on this regular expression
-- "\\u[0-9a-fA-F]{4}"
local
i: INTEGER
do
if
a_unicode.count = 6 and then
a_unicode[1] = '\' and then
a_unicode[2] = 'u'
then
from
Result := True
i := 3
until
i > 6 or Result = False
loop
inspect a_unicode[i]
when '0'..'9', 'a'..'f', 'A'..'F' then
else
Result := False
end
i := i + 1
end
end
end
extra_elements: BOOLEAN
-- has more elements?
local
c: like actual
do
if has_next then
next
end
from
c := actual
until
c /= ' ' or c /= '%R' or c /= '%U' or c /= '%T' or c /= '%N' or not has_next
loop
next
end
Result := has_next
end
is_valid_start_symbol : BOOLEAN
-- expecting `{' or `[' as start symbol
do
if attached representation as s and then s.count > 0 then
Result := s[1] = '{' or s[1] = '['
end
end
feature {NONE} -- Constants
false_id: STRING = "false"
true_id: STRING = "true"
null_id: STRING = "null"
end

View File

@@ -1,118 +0,0 @@
note
description: "Objects that ..."
author: "jvelilla"
date: "2008/08/24"
revision: "0.1"
class
JSON_READER
create
make
feature {NONE} -- Initialization
make (a_json: STRING)
-- Initialize Reader
do
set_representation (a_json)
end
feature -- Commands
set_representation (a_json: STRING)
-- Set `representation'.
do
a_json.left_adjust
a_json.right_adjust
representation := a_json
index := 1
end
read: CHARACTER
-- Read character
do
if not representation.is_empty then
Result := representation.item (index)
end
end
next
-- Move to next index
require
has_more_elements: has_next
do
index := index + 1
ensure
incremented: old index + 1 = index
end
previous
-- Move to previous index
require
not_is_first: has_previous
do
index := index - 1
ensure
incremented: old index - 1 = index
end
skip_white_spaces
-- Remove white spaces
local
c: like actual
do
from
c := actual
until
(c /= ' ' and c /= '%N' and c /= '%R' and c /= '%U' and c /= '%T' ) or not has_next
loop
next
c := actual
end
end
json_substring (start_index, end_index: INTEGER_32): STRING
-- JSON representation between `start_index' and `end_index'
do
Result := representation.substring (start_index, end_index)
end
feature -- Status report
has_next: BOOLEAN
-- Has a next character?
do
Result := index <= representation.count
end
has_previous: BOOLEAN
-- Has a previous character?
do
Result := index >= 1
end
feature -- Access
representation: STRING
-- Serialized representation of the original JSON string
feature {NONE} -- Implementation
actual: CHARACTER
-- Current character or '%U' if none
do
if index > representation.count then
Result := '%U'
else
Result := representation.item (index)
end
end
index: INTEGER
-- Actual index
invariant
representation_not_void: representation /= Void
end

View File

@@ -1,77 +0,0 @@
note
description: ""
author: "jvelilla"
date: "2008/08/24"
revision: "0.1"
class
JSON_TOKENS
feature -- Access
j_OBJECT_OPEN: CHARACTER = '{'
j_ARRAY_OPEN: CHARACTER = '['
j_OBJECT_CLOSE: CHARACTER = '}'
j_ARRAY_CLOSE: CHARACTER = ']'
j_STRING: CHARACTER = '"'
j_PLUS: CHARACTER = '+'
j_MINUS: CHARACTER = '-'
j_DOT: CHARACTER = '.'
feature -- Status report
is_open_token (c: CHARACTER): BOOLEAN
-- Characters which open a type
do
inspect c
when j_OBJECT_OPEN, j_ARRAY_OPEN, j_STRING, j_PLUS, j_MINUS, j_DOT then
Result := True
else
end
end
is_close_token (c: CHARACTER): BOOLEAN
-- Characters which close a type
do
inspect c
when j_OBJECT_CLOSE, j_ARRAY_CLOSE, j_STRING then
Result := True
else
end
end
is_special_character (c: CHARACTER): BOOLEAN
-- Control Characters
-- %F Form feed
-- %H backslasH
-- %N Newline
-- %R carriage Return
-- %T horizontal Tab
-- %B Backspace
-- / Solidus
-- " Quotation
do
inspect c
when '%F', '%H', '%N', '%R', '%T', '%B', '/', '"' then
Result := True
else
end
end
is_special_control (c: CHARACTER): BOOLEAN
--Control Characters
-- \b\f\n\r\t
do
inspect c
when 'b', 'f', 'n', 'r', 't' then
Result := True
else
end
end
end

View File

@@ -1,38 +0,0 @@
note
description: "[
Shared factory class for creating JSON objects. Maps JSON
objects to ELKS HASH_TABLEs and JSON arrays to ELKS
LINKED_LISTs. Use non-conforming inheritance from this
class to ensure that your classes share the same
JSON_FACTORY instance.
]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision: 89185 $"
file: "$HeadURL: $"
class SHARED_EJSON
feature
json: EJSON
-- A shared EJSON instance with default converters for
--LINKED_LIST [ANY] and HASH_TABLE [ANY, HASHABLE]
local
jalc: JSON_ARRAYED_LIST_CONVERTER
jllc: JSON_LINKED_LIST_CONVERTER
jhtc: JSON_HASH_TABLE_CONVERTER
once
create Result
create jalc.make
Result.add_converter (jalc)
create jllc.make
Result.add_converter (jllc)
create jhtc.make
Result.add_converter (jhtc)
end
end -- class SHARED_EJSON

View File

@@ -1,24 +0,0 @@
note
description : "test_suite application root class"
date : "$Date$"
revision : "$Revision$"
class
APPLICATION
inherit
ARGUMENTS
create
make
feature {NONE} -- Initialization
make
-- Run application.
do
--| Add your code here
print ("Hello Eiffel World!%N")
end
end

View File

@@ -1,24 +0,0 @@
class AUTHOR
create
make
feature {NONE} -- Initialization
make (a_name: STRING_32)
do
set_name (a_name)
end
feature -- Access
name: STRING_32
feature -- Status setting
set_name (a_name: STRING_32)
do
name := a_name
end
end -- class AUTHOR

View File

@@ -1,40 +0,0 @@
class BOOK
create
make
feature {NONE} -- Initialization
make (a_title: STRING_32; an_author: AUTHOR; an_isbn: STRING_32)
do
set_title (a_title)
set_author (an_author)
set_isbn (an_isbn)
end
feature -- Access
title: STRING_32
isbn: STRING_32
author: AUTHOR
feature -- Status setting
set_title (a_title: STRING_32)
do
title := a_title
end
set_author (an_author: AUTHOR)
do
author := an_author
end
set_isbn (an_isbn: STRING_32)
do
isbn := an_isbn
end
end -- class BOOK

View File

@@ -1,80 +0,0 @@
class BOOK_COLLECTION
create
make
feature {NONE} -- Initialization
make (a_name: STRING_32)
do
set_name (a_name)
create book_index.make (10)
end
feature -- Access
name: STRING_32
books: LIST [BOOK]
do
from
create {LINKED_LIST [BOOK]} Result.make
book_index.start
until
book_index.after
loop
Result.append (book_index.item_for_iteration)
book_index.forth
end
end
books_by_author (an_author: STRING_32): detachable LIST [BOOK]
do
if book_index.has (an_author) then
Result := book_index @ an_author
else
create {LINKED_LIST [BOOK]} Result.make
end
end
feature -- Status setting
set_name (a_name: STRING_32)
do
name := a_name
end
add_book (a_book: BOOK)
local
l: detachable LIST [BOOK]
do
if book_index.has (a_book.author.name) then
l := book_index.at ( a_book.author.name )
else
create {LINKED_LIST [BOOK]} l.make
book_index.put (l, a_book.author.name)
end
if attached l as la then
la.force (a_book)
end
end
add_books (book_list: like books)
do
from
book_list.start
until
book_list.after
loop
add_book (book_list.item)
book_list.forth
end
end
feature {NONE} -- Implementation
book_index: HASH_TABLE [LIST [BOOK], STRING_32]
end -- class BOOK_COLLECTION

View File

@@ -1 +0,0 @@
"A JSON payload should be an object or array, not a string."

View File

@@ -1 +0,0 @@
{"Extra value after close": true} "misplaced quoted value"

View File

@@ -1 +0,0 @@
{"Illegal expression": 1 + 2}

View File

@@ -1 +0,0 @@
{"Illegal invocation": alert()}

View File

@@ -1 +0,0 @@
{"Numbers cannot have leading zeroes": 013}

View File

@@ -1 +0,0 @@
{"Numbers cannot be hex": 0x14}

View File

@@ -1 +0,0 @@
["Illegal backslash escape: \x15"]

View File

@@ -1 +0,0 @@
["Illegal backslash escape: \017"]

View File

@@ -1 +0,0 @@
[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]

View File

@@ -1 +0,0 @@
{"Missing colon" null}

View File

@@ -1 +0,0 @@
["Unclosed array"

View File

@@ -1 +0,0 @@
{"Double colon":: null}

View File

@@ -1 +0,0 @@
{"Comma instead of colon", null}

View File

@@ -1 +0,0 @@
["Colon instead of comma": false]

View File

@@ -1 +0,0 @@
["Bad value", truth]

View File

@@ -1 +0,0 @@
['single quote']

View File

@@ -1 +0,0 @@
[" tab character in string "]

View File

@@ -1 +0,0 @@
["tab\ character\ in\ string\ "]

View File

@@ -1,2 +0,0 @@
["line
break"]

View File

@@ -1,2 +0,0 @@
["line\
break"]

View File

@@ -1 +0,0 @@
{unquoted_key: "keys must be quoted"}

View File

@@ -1 +0,0 @@
{"Comma instead if closing brace": true,

View File

@@ -1 +0,0 @@
["extra comma",]

View File

@@ -1 +0,0 @@
["double extra comma",,]

View File

@@ -1 +0,0 @@
[ , "<-- missing value"]

View File

@@ -1 +0,0 @@
["Comma after the close"],

View File

@@ -1 +0,0 @@
["Extra close"]]

View File

@@ -1 +0,0 @@
{"Extra comma": true,}

View File

@@ -1,53 +0,0 @@
note
description: "A JSON converter for AUTHOR"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
class JSON_AUTHOR_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
local
ucs: STRING_32
do
create ucs.make_from_string ("")
create object.make (ucs)
end
feature -- Access
object: AUTHOR
feature -- Conversion
from_json (j: like to_json): detachable like object
local
ucs: detachable STRING_32
do
ucs ?= json.object (j.item (name_key), Void)
check ucs /= Void end
create Result.make (ucs)
end
to_json (o: like object): JSON_OBJECT
do
create Result.make
Result.put (json.value (o.name), name_key)
end
feature {NONE} -- Implementation
name_key: JSON_STRING
once
create Result.make_json ("name")
end
end -- class JSON_AUTHOR_CONVERTER

View File

@@ -1,78 +0,0 @@
note
description: "A JSON converter for BOOK_COLLECTION"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
class JSON_BOOK_COLLECTION_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
local
ucs: STRING_32
do
create ucs.make_from_string ("")
create object.make (ucs)
end
feature -- Access
object: BOOK_COLLECTION
feature -- Conversion
from_json (j: like to_json): detachable like object
local
ucs: detachable STRING_32
ll: LINKED_LIST [BOOK]
b: detachable BOOK
ja: detachable JSON_ARRAY
i: INTEGER
do
ucs ?= json.object (j.item (name_key), Void)
check ucs /= Void end
create Result.make (ucs)
ja ?= j.item (books_key)
check ja /= Void end
from
i := 1
create ll.make
until
i > ja.count
loop
b ?= json.object (ja [i], "BOOK")
check b /= Void end
ll.force (b)
i := i + 1
end
check ll /= Void end
Result.add_books (ll)
end
to_json (o: like object): JSON_OBJECT
do
create Result.make
Result.put (json.value (o.name), name_key)
Result.put (json.value (o.books), books_key)
end
feature {NONE} -- Implementation
name_key: JSON_STRING
once
create Result.make_json ("name")
end
books_key: JSON_STRING
once
create Result.make_json ("books")
end
end -- class JSON_BOOK_COLLECTION_CONVERTER

View File

@@ -1,72 +0,0 @@
note
description: "A JSON converter for BOOK"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
class JSON_BOOK_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
local
ucs: STRING_32
a: AUTHOR
do
create ucs.make_from_string ("")
create a.make (ucs)
create object.make (ucs, a, ucs)
end
feature -- Access
object: BOOK
feature -- Conversion
from_json (j: like to_json): detachable like object
local
ucs1, ucs2: detachable STRING_32
a: detachable AUTHOR
do
ucs1 ?= json.object (j.item (title_key), Void)
check ucs1 /= Void end
ucs2 ?= json.object (j.item (isbn_key), Void)
check ucs2 /= Void end
a ?= json.object (j.item (author_key), "AUTHOR")
check a /= Void end
create Result.make (ucs1, a, ucs2)
end
to_json (o: like object): JSON_OBJECT
do
create Result.make
Result.put (json.value (o.title), title_key)
Result.put (json.value (o.isbn), isbn_key)
Result.put (json.value (o.author), author_key)
end
feature {NONE} -- Implementation
title_key: JSON_STRING
once
create Result.make_json ("title")
end
isbn_key: JSON_STRING
once
create Result.make_json ("isbn")
end
author_key: JSON_STRING
once
create Result.make_json ("author")
end
end -- class JSON_BOOK_CONVERTER

View File

@@ -1,11 +0,0 @@
{ "menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

View File

@@ -1,58 +0,0 @@
[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},
[],
-42,
true,
false,
null,
{
"integer": 1234567890,
"real": -9876.543210,
"e": 0.123456789e-12,
"E": 1.234567890E+34,
"": 23456789012E66,
"zero": 0,
"one": 1,
"space": " ",
"quote": "\"",
"backslash": "\\",
"controls": "\b\f\n\r\t",
"slash": "/ & \/",
"alpha": "abcdefghijklmnopqrstuvwyz",
"ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
"digit": "0123456789",
"0123456789": "digit",
"special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
"hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
"true": true,
"false": false,
"null": null,
"array":[ ],
"object":{ },
"address": "50 St. James Street",
"url": "http://www.JSON.org/",
"comment": "// /* <!-- --",
"# -- --> */": " ",
" s p a c e d " :[1,2 , 3
,
4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
"jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
"quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
"\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
: "A key can be any string"
},
0.5 ,98.6
,
99.44
,
1066,
1e1,
0.1e1,
1e-1,
1e00,2e+00,2e-00
,"rosebud"]

View File

@@ -1 +0,0 @@
[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]

View File

@@ -1,6 +0,0 @@
{
"JSON Test Pattern pass3": {
"The outermost value": "must be an object or array.",
"In this test": "It is an object."
}
}

View File

@@ -1,74 +0,0 @@
class TEST_DS
inherit
SHARED_EJSON
rename default_create as shared_default_create end
EQA_TEST_SET
select default_create end
feature -- Test
test_linked_list_converter
local
jc: JSON_LINKED_LIST_CONVERTER
l: LINKED_LIST [STRING]
l2: detachable LINKED_LIST [detachable ANY]
s: STRING
jv: detachable JSON_VALUE
do
create jc.make
json.add_converter (jc)
create l.make
s := "foo"
l.force (s)
s := "bar"
l.force (s)
jv := json.value (l)
assert ("jv /= Void", jv /= Void)
if attached jv as l_jv then
s := jv.representation
l2 ?= json.object (jv, "LINKED_LIST")
assert ("l2 /= Void", l2 /= Void)
end
end
test_hash_table_converter
local
tc: JSON_HASH_TABLE_CONVERTER
t: HASH_TABLE [STRING, STRING]
t2: detachable HASH_TABLE [ANY, HASHABLE]
s: STRING
ucs_key, ucs_value: detachable STRING_32
jv: detachable JSON_VALUE
do
create tc.make
json.add_converter (tc)
create t.make (2)
t.put ("foo", "1")
t.put ("bar", "2")
jv := json.value (t)
assert ("jv /= Void", jv /= Void)
if attached jv as l_jv then
s := l_jv.representation
t2 ?= json.object (l_jv, "HASH_TABLE")
assert ("t2 /= Void", t2 /= Void)
end
create ucs_key.make_from_string ("1")
if attached t2 as l_t2 then
ucs_value ?= t2 @ ucs_key
assert ("ucs_value /= Void", ucs_value /= Void)
if attached ucs_value as l_ucs_value then
assert ("ucs_value.string.is_equal (%"foo%")", l_ucs_value.string.is_equal ("foo"))
end
create ucs_key.make_from_string ("2")
ucs_value ?= t2 @ ucs_key
assert ("ucs_value /= Void", ucs_value /= Void)
if attached ucs_value as l_ucs_value then
assert ("ucs_value.string.is_equal (%"bar%")", l_ucs_value.string.is_equal ("bar"))
end
end
end
end -- class TEST_DS

View File

@@ -1,833 +0,0 @@
class TEST_JSON_CORE
inherit
SHARED_EJSON
rename default_create as shared_default_create end
EQA_TEST_SET
select default_create end
feature -- Test
test_json_number_and_integer
local
i: INTEGER
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
i := 42
-- Eiffel value -> JSON value -> JSON representation
create jn.make_integer (i)
assert ("jn.representation.same_string (%"42%")", jn.representation.same_string ("42"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (i) as l_jn then
assert ("l_jn.representation.same_string (%"42%")", jn.representation.same_string ("42"))
else
assert ("json.value (i) is a JSON_NUMBER", False)
end
-- JSON representation-> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_8 since the value is 42
jrep := "42"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_8} json.object (jn, Void) as l_i8 then
assert ("l_i8 = 42", l_i8 = 42)
else
assert ("json.object (jn, Void) is a INTEGER_8", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_integer_8
local
i8: INTEGER_8
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
i8 := 42
-- Eiffel value -> JSON value -> JSON representation
create jn.make_integer (i8)
assert ("jn.representation.same_string (%"42%")", jn.representation.same_string ("42"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (i8) as l_jn then
assert ("l_jn.representation.same_string (%"42%")", jn.representation.same_string ("42"))
else
assert ("json.value (i8) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_8 since the value is 42
jrep := "42"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_8} json.object (jn, Void) as l_i8 then
assert ("l_i8 = 42", l_i8 = 42)
else
assert ("json.object (jn, Void) is a INTEGER_8", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_integer_16
local
i16: INTEGER_16
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
i16 := 300
-- Eiffel value -> JSON value -> JSON representation
create jn.make_integer (i16)
assert ("jn.representation.same_string (%"300%")", jn.representation.same_string ("300"))
-- Eiffel value -> JSON with factory
if attached {JSON_NUMBER} json.value (i16) as l_jn then
assert ("l_jn.representation.same_string (%"300%")", l_jn.representation.same_string ("300"))
else
assert ("json.value (i16) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_16 since the value is 300
jrep := "300"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_16} json.object (jn, Void) as l_i16 then
assert ("l_i16 = 300", l_i16 = 300)
else
assert ("json.object (jn, Void) is a INTEGER_16", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_integer_32
local
i32: INTEGER_32
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
i32 := 100000
-- Eiffel value -> JSON representation -> JSON value
create jn.make_integer (i32)
assert ("jn.representation.same_string (%"100000%")", jn.representation.same_string ("100000"))
-- Eiffel value -> JSON representation -> JSON value with factory
if attached {JSON_NUMBER} json.value (i32) as l_jn then
assert ("l_jn.representation.same_string (%"100000%")", l_jn.representation.same_string ("100000"))
else
assert ("json.value (i32) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_32 since the value is 100000
jrep := "100000"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_32} json.object (jn, Void) as l_i32 then
assert ("l_i32 = 100000", l_i32 = 100000)
else
assert ("json.object (jn, Void) is a INTEGER_32", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_integer_64
local
i64: INTEGER_64
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
i64 := 42949672960
-- Eiffel value -> JSON value -> JSON representation
create jn.make_integer (i64)
assert ("jn.representation.same_string (%"42949672960%")", jn.representation.same_string ("42949672960"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (i64) as l_jn then
assert ("l_jn.representation.same_string (%"42949672960%")", l_jn.representation.same_string ("42949672960"))
else
assert ("json.value (i64) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_32 since the value is 42949672960
jrep := "42949672960"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_64} json.object (jn, Void) as l_i64 then
assert ("l_i64 = 42949672960", l_i64 = 42949672960)
else
assert ("json.object (jn, Void) is a INTEGER_64", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_natural_8
local
n8: NATURAL_8
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
n8 := 200
-- Eiffel value -> JSON value -> JSON representation
create jn.make_natural (n8)
assert ("jn.representation.same_string (%"200%")", jn.representation.same_string ("200"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (n8) as l_jn then
assert ("l_jn.representation.same_string (%"200%")", l_jn.representation.same_string ("200"))
else
assert ("json.value (n8) is a JSON_NUMBER}", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_16 since the value is 200
jrep := "200"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_16} json.object (jn, Void) as i16 then
assert ("i16 = 200", i16 = 200)
else
assert ("json.object (jn, Void) is an INTEGER_16", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_natural_16
local
n16: NATURAL_16
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
n16 := 32768
-- Eiffel value -> JSON value -> JSON representation
create jn.make_natural (n16)
assert ("jn.representation.same_string (%"32768%")", jn.representation.same_string ("32768"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (n16) as l_jn then
assert ("l_jn.representation.same_string (%"32768%")", l_jn.representation.same_string ("32768"))
else
assert ("json.value (n16) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_32 since the value is 32768
jrep := "32768"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_32} json.object (jn, Void) as i32 then
assert ("i32 = 32768", i32 = 32768)
else
assert ("json.object (jn, Void) is a INTEGER_32", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_natural_32
local
n32: NATURAL_32
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
n32 := 2147483648
-- Eiffel value -> JSON value -> JSON representation
create jn.make_natural (n32)
assert ("jn.representation.same_string (%"2147483648%")", jn.representation.same_string ("2147483648"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached json.value (n32) as l_jn then
assert ("l_jn.representation.same_string (%"2147483648%")", l_jn.representation.same_string ("2147483648"))
else
assert ("json.value (n32) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_64 since the value is 2147483648
jrep := "2147483648"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {INTEGER_64} json.object (jn, Void) as i64 then
assert ("i64 = 2147483648", i64 = 2147483648)
else
assert ("json.object (jn, Void) is a INTEGER_64", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_large_integers
local
jrep: STRING
n64: NATURAL_64
jn: JSON_NUMBER
parser: JSON_PARSER
do
n64 := 9223372036854775808
-- Eiffel value -> JSON value -> JSON representation
create jn.make_natural (n64)
assert ("jn.representation.same_string (%"9223372036854775808%")", jn.representation.same_string ("9223372036854775808"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (n64) as l_jn then
assert ("l_jn.representation.same_string (%"9223372036854775808%")", l_jn.representation.same_string ("9223372036854775808"))
else
assert ("json.value (n64) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- we know it is INTEGER_32 since the value is 42949672960
jrep := "9223372036854775808" -- 1 higher than largest positive number that can be represented by INTEGER 64
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {NATURAL_64} json.object (jn, Void) as l_n64 then
assert ("l_n64 = 9223372036854775808", l_n64 = 9223372036854775808)
else
assert ("json.object (jn, Void) is a NATURAL_64", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_eiffel_real
local
r: REAL
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
r := 3.14
-- Eiffel value -> JSON value -> JSON representation
create jn.make_real (r)
assert ("jn.representation.same_string (%"3.1400001049041748%")", jn.representation.same_string ("3.1400001049041748"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (r) as l_jn then
assert ("l_jn.representation.same_string (%"3.1400001049041748%")", l_jn.representation.same_string ("3.1400001049041748"))
else
assert ("json.value (r) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will always return a REAL_64 if the value
-- of the JSON number is a floating point number
jrep := "3.14"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {REAL_64} json.object (jn, Void) as r64 then
assert ("3.14 <= r64 and r64 <= 3.141", 3.14 <= r64 and r64 <= 3.141)
else
assert ("json.object (jn, Void) is a REAL_64", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_eiffel_real_32
local
r32: REAL_32
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
r32 := 3.14
-- Eiffel value -> JSON value -> JSON representation
create jn.make_real (r32)
assert ("jn.representation.same_string (%"3.1400001049041748%")", jn.representation.same_string ("3.1400001049041748"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (r32) as l_jn then
assert ("l_jn.representation.same_string (%"3.1400001049041748%")", l_jn.representation.same_string ("3.1400001049041748"))
else
assert ("json.value (r32) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "3.1400001049041748"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {REAL_64} json.object (l_jn, Void) as r64 then
assert ("r64 = 3.1400001049041748", r64 = 3.1400001049041748)
else
assert ("json.object (l_jn, Void) is a REAL_64", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_number_and_eiffel_real_64
local
r64: REAL_64
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
r64 := 3.1415926535897931
-- Eiffel value -> JSON value -> JSON representation
create jn.make_real (r64)
assert ("jn.representation.same_string (%"3.1415926535897931%")", jn.representation.same_string ("3.1415926535897931"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_NUMBER} json.value (r64) as l_jn then
assert ("l_jn.representation.same_string (%"3.1415926535897931%")", l_jn.representation.same_string ("3.1415926535897931"))
else
assert ("json.value (r64) is a JSON_NUMBER", False)
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "3.1415926535897931"
create parser.make_parser (jrep)
if attached {JSON_NUMBER} parser.parse as l_jn then
if attached {REAL_64} json.object (jn, Void) as l_r64 then
assert ("l_r64 = 3.1415926535897931", l_r64 = 3.1415926535897931)
else
assert ("json.object (jn, Void) is a REAL_64", False)
end
else
assert ("parser.parse is a JSON_NUMBER", False)
end
end
test_json_boolean
local
parser: JSON_PARSER
jb: JSON_BOOLEAN
b: BOOLEAN
do
-- Eiffel value -> JSON value -> JSON representation
b := True
create jb.make_boolean (b)
assert ("jb.representation.is_equal (%"true%")", jb.representation.is_equal ("true"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_BOOLEAN} json.value (b) as l_jb then
assert ("l_jb.representation.same_string (%"true%")", l_jb.representation.same_string ("true"))
else
assert ("l_jb /= Void", False)
end
-- JSON representation -> JSON value -> Eiffel value
create parser.make_parser ("true")
if attached {JSON_BOOLEAN} parser.parse as l_jb then
if attached {BOOLEAN} json.object (l_jb, Void) as l_b then
assert ("l_b = True", l_b = True)
else
assert ("json.object (l_jb, Void) is BOOLEAN", False)
end
else
assert ("parser.parse is a JSON_BOOLEAN", False)
end
-- Eiffel value -> JSON value -> JSON representation
b := False
create jb.make_boolean (b)
assert ("jb.representation.same_string (%"false%")", jb.representation.same_string ("false"))
-- Eiffel value -> JSON value -> JSON representation with factory
if attached {JSON_BOOLEAN} json.value (b) as l_jb then
assert ("l_jb.representation.same_string (%"false%")", l_jb.representation.same_string ("false"))
else
assert ("json.value (b) is a JSON_BOOLEAN", False)
end
-- JSON representation -> JSON value -> Eiffel value
create parser.make_parser ("false")
if attached {JSON_BOOLEAN} parser.parse as l_jb then
if attached {BOOLEAN} json.object (l_jb, Void) as l_b then
assert ("l_b = False", l_b = False)
else
assert ("json.object (l_jb, Void) is a BOOLEAN", False)
end
else
assert ("parser.parse is a JSON_BOOLEAN", False)
end
end
test_json_null
local
a: detachable ANY
dummy_object: STRING
jn: detachable JSON_NULL
jrep: STRING
parser: JSON_PARSER
do
-- Eiffel value -> JSON value -> JSON representation
create jn
assert ("jn /= Void", jn /= Void)
assert ("jn.representation.is_equal (%"%"null%"%")", jn.representation.is_equal ("null"))
-- Eiffel value -> JSON value -> JSON representation with factory
jn ?= json.value (Void)
assert ("jn /= Void", jn /= Void)
if attached jn as l_jn then
assert ("jn.representation.is_equal (%"null%")", l_jn.representation.is_equal ("null"))
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "null"
create parser.make_parser (jrep)
jn := Void
jn ?= parser.parse
assert ("jn /= Void", jn /= Void)
create dummy_object.make_empty
a := dummy_object
a ?= json.object (jn, Void)
assert ("a = Void", a = Void)
end
test_json_string_and_character
local
c: CHARACTER
js: detachable JSON_STRING
jrep: STRING
parser: JSON_PARSER
do
c := 'a'
-- Eiffel value -> JSON value -> JSON representation
create js.make_json (c.out)
assert ("js /= Void", js /= Void)
assert ("js.representation.is_equal (%"%"a%"%")", js.representation.is_equal ("%"a%""))
-- Eiffel value -> JSON value -> JSON representation with factory
js ?= json.value (c)
assert ("js /= Void", js /= Void)
if attached js as l_js then
assert ("js.representation.is_equal (%"%"a%"%")", l_js.representation.is_equal ("%"a%""))
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "%"a%""
create parser.make_parser (jrep)
js := Void
js ?= parser.parse
assert ("js /= Void", js /= Void)
if attached {STRING_32} json.object (js, Void) as ucs then
assert ("ucs.string.is_equal (%"a%")", ucs.string.is_equal ("a"))
end
end
test_json_string_and_string
local
s: STRING
js: detachable JSON_STRING
jrep: STRING
parser: JSON_PARSER
do
s := "foobar"
-- Eiffel value -> JSON value -> JSON representation
create js.make_json (s)
assert ("js /= Void", js /= Void)
assert ("js.representation.is_equal (%"%"foobar%"%")", js.representation.is_equal ("%"foobar%""))
-- Eiffel value -> JSON value -> JSON representation with factory
js ?= json.value (s)
assert ("js /= Void", js /= Void)
if attached js as l_js then
assert ("js.representation.is_equal (%"%"foobar%"%")", js.representation.is_equal ("%"foobar%""))
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "%"foobar%""
create parser.make_parser (jrep)
js := Void
js ?= parser.parse
assert ("js /= Void", js /= Void)
if attached {STRING_32} json.object (js, Void) as l_ucs then
assert ("ucs.string.is_equal (%"foobar%")", l_ucs.string.is_equal ("foobar"))
end
end
test_json_string_and_uc_string
local
js: detachable JSON_STRING
ucs: detachable STRING_32
jrep: STRING
parser: JSON_PARSER
do
create ucs.make_from_string ("foobar")
-- Eiffel value -> JSON value -> JSON representation
create js.make_json (ucs)
assert ("js /= Void", js /= Void)
assert ("js.representation.is_equal (%"%"foobar%"%")", js.representation.is_equal ("%"foobar%""))
-- Eiffel value -> JSON value -> JSON representation with factory
js ?= json.value (ucs)
assert ("js /= Void", js /= Void)
if attached js as l_js then
assert ("js.representation.is_equal (%"%"foobar%"%")", l_js.representation.is_equal ("%"foobar%""))
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "%"foobar%""
create parser.make_parser (jrep)
js := Void
js ?= parser.parse
assert ("js /= Void", js /= Void)
ucs := Void
ucs ?= json.object (js, Void)
if attached ucs as l_ucs then
assert ("ucs.string.is_equal (%"foobar%")", l_ucs.string.is_equal ("foobar"))
end
end
test_json_string_and_special_characters
local
js: detachable JSON_STRING
s: detachable STRING_8
ucs: detachable STRING_32
jrep: STRING
parser: JSON_PARSER
do
create s.make_from_string ("foo\bar")
create js.make_json (s)
assert ("js.representation.same_string (%"%"foo\\bar%"%")", js.representation.same_string ("%"foo\\bar%""))
-- Eiffel value -> JSON value -> JSON representation with factory
js ?= json.value (s)
assert ("js /= Void", js /= Void)
if js /= Void then
assert ("js.representation.is_equal (%"%"foobar%"%")", js.representation.same_string ("%"foo\\bar%""))
end
-- JSON representation -> JSON value -> Eiffel value
jrep := "%"foo\\bar%""
create parser.make_parser (jrep)
js ?= parser.parse
assert ("js /= Void", js /= Void)
ucs ?= json.object (js, Void)
if ucs /= Void then
assert ("ucs.same_string (%"foo\bar%")", ucs.same_string ("foo\bar"))
end
jrep := "%"foo\\bar%""
create parser.make_parser (jrep)
if attached {JSON_STRING} parser.parse as jstring then
assert ("unescaped string %"foo\\bar%" to %"foo\bar%"", jstring.unescaped_string_8.same_string ("foo\bar"))
end
create js.make_json_from_string_32 ({STRING_32}"%/20320/%/22909/")
assert ("escaping unicode string32 %"%%/20320/%%/22909/%" %"\u4F60\u597D%"", js.item.same_string ("\u4F60\u597D"))
jrep := "%"\u4F60\u597D%"" --| Ni hao
create parser.make_parser (jrep)
if attached {JSON_STRING} parser.parse as jstring then
assert ("same unicode string32 %"%%/20320/%%/22909/%"", jstring.unescaped_string_32.same_string ({STRING_32}"%/20320/%/22909/"))
end
end
test_json_array
local
ll: LINKED_LIST [INTEGER_8]
ll2: detachable LINKED_LIST [detachable ANY]
ja: detachable JSON_ARRAY
jn: JSON_NUMBER
jrep: STRING
parser: JSON_PARSER
do
-- Eiffel value -> JSON value -> JSON representation
create ll.make
ll.extend (0)
ll.extend (1)
ll.extend (1)
ll.extend (2)
ll.extend (3)
ll.extend (5)
-- Note: Currently there is no simple way of creating a JSON_ARRAY
-- from an LINKED_LIST.
create ja.make_array
from
ll.start
until
ll.after
loop
create jn.make_integer (ll.item)
ja.add (jn)
ll.forth
end
assert ("ja /= Void", ja /= Void)
assert ("ja.representation.is_equal (%"[0,1,1,2,3,5]%")", ja.representation.is_equal ("[0,1,1,2,3,5]"))
-- Eiffel value -> JSON value -> JSON representation with factory
ja := Void
ja ?= json.value (ll)
assert ("ja /= Void", ja /= Void)
if attached ja as l_ja then
assert ("ja.representation.is_equal (%"[0,1,1,2,3,5]%")", l_ja.representation.is_equal ("[0,1,1,2,3,5]"))
end
-- JSON representation -> JSON value -> Eiffel value
-- Note: The JSON_FACTORY will return the smallest INTEGER_* object
-- that can represent the value of the JSON number, in this case
-- it means we will get an LINKED_LIST [ANY] containing the INTEGER_8
-- values 0, 1, 1, 2, 3, 5
jrep := "[0,1,1,2,3,5]"
create parser.make_parser (jrep)
ja := Void
ja ?= parser.parse
assert ("ja /= Void", ja /= Void)
ll2 ?= json.object (ja, Void)
assert ("ll2 /= Void", ll2 /= Void)
--ll.compare_objects
--ll2.compare_objects
if attached ll2 as l_ll2 then
assert ("ll2.is_equal (ll)", l_ll2.is_equal (ll))
end
end
test_json_object
local
t, t2: detachable HASH_TABLE [detachable ANY, STRING_GENERAL]
i: INTEGER
ucs_key, ucs: STRING_32
a: ARRAY [INTEGER]
jo: detachable JSON_OBJECT
jn: JSON_NUMBER
js_key, js: JSON_STRING
ja: JSON_ARRAY
jrep: STRING
parser: JSON_PARSER
do
-- Eiffel value -> JSON value -> JSON representation
-- Note: Currently there is now way of creating a JSON_OBJECT from
-- a HASH_TABLE, so we do it manually.
-- t = {"name": "foobar", "size": 42, "contents", [0, 1, 1, 2, 3, 5]}
create jo.make
create js_key.make_json ("name")
create js.make_json ("foobar")
jo.put (js, js_key)
create js_key.make_json ("size")
create jn.make_integer (42)
jo.put (jn, js_key)
create js_key.make_json ("contents")
create ja.make_array
create jn.make_integer (0)
ja.add (jn)
create jn.make_integer (1)
ja.add (jn)
create jn.make_integer (1)
ja.add (jn)
create jn.make_integer (2)
ja.add (jn)
create jn.make_integer (3)
ja.add (jn)
create jn.make_integer (5)
ja.add (jn)
jo.put (ja, js_key)
assert ("jo /= Void", jo /= Void)
assert ("jo.representation.is_equal (%"{%"name%":%"foobar%",%"size%":42,%"contents%":[0,1,1,2,3,5]}%")", jo.representation.is_equal ("{%"name%":%"foobar%",%"size%":42,%"contents%":[0,1,1,2,3,5]}"))
-- Eiffel value -> JSON value -> JSON representation with factory
create t.make (3)
create ucs_key.make_from_string ("name")
create ucs.make_from_string ("foobar")
t.put (ucs, ucs_key)
create ucs_key.make_from_string ("size")
i := 42
t.put (i, ucs_key)
create ucs_key.make_from_string ("contents")
a := <<0, 1, 1, 2, 3, 5>>
t.put (a, ucs_key)
jo := Void
jo ?= json.value (t)
assert ("jo /= Void", jo /= Void)
if attached jo as l_jo then
assert ("jo.representation.is_equal (%"{%"name%":%"foobar%",%"size%":42,%"contents%":[0,1,1,2,3,5]}%")", l_jo.representation.is_equal ("{%"name%":%"foobar%",%"size%":42,%"contents%":[0,1,1,2,3,5]}"))
end
-- JSON representation -> JSON value -> Eiffel value -> JSON value -> JSON representation
jrep := "{%"name%":%"foobar%",%"size%":42,%"contents%":[0,1,1,2,3,5]}"
create parser.make_parser (jrep)
jo := Void
jo ?= parser.parse
assert ("jo /= Void", jo /= Void)
t2 ?= json.object (jo, Void)
assert ("t2 /= Void", t2 /= Void)
jo ?= json.value (t2)
assert ("jo /= Void", jo /= Void)
if attached jo as l_jo then
assert ("jrep.is_equal (jo.representation)", jrep.is_equal (jo.representation))
end
end
test_json_object_hash_code
local
ht: HASH_TABLE [ANY, JSON_VALUE]
jo: JSON_OBJECT
do
create ht.make (1)
create jo.make
ht.force ("", jo)
assert ("ht.has_key (jo)", ht.has_key (jo))
end
test_json_failed_json_conversion
-- Test converting an Eiffel object to JSON that is based on a class
-- for which no JSON converter has been registered.
local
gv: OPERATING_ENVIRONMENT
jv: detachable JSON_VALUE
exception: BOOLEAN
do
if not exception then
create gv
jv := json.value (gv)
else
assert ("exceptions.is_developer_exception", json.is_developer_exception)
-- assert ("exceptions.is_developer_exception_of_name", json.is_developer_exception_of_name ("eJSON exception: Failed to convert Eiffel object to a JSON_VALUE: OPERATING_ENVIRONMENT"))
end
rescue
exception := True
retry
end
test_json_failed_eiffel_conversion
-- Test converting from a JSON value to an Eiffel object based on a
-- class for which no JSON converter has been registered.
local
gv : detachable OPERATING_ENVIRONMENT
jo: JSON_OBJECT
exception: BOOLEAN
do
if not exception then
create jo.make
gv ?= json.object (jo, "OPERATING_ENVIRONMENT")
else
assert ("exceptions.is_developer_exception", json.is_developer_exception)
-- assert ("exceptions.is_developer_exception_of_name", json.is_developer_exception_of_name ("eJSON exception: Failed to convert JSON_VALUE to an Eiffel object: JSON_OBJECT -> OPERATING_ENVIRONMENT"))
end
rescue
exception := True
retry
end
end -- class TEST_JSON_CORE

View File

@@ -1,42 +0,0 @@
class TEST_JSON_CUSTOM_CLASSES
inherit
SHARED_EJSON
rename default_create as shared_default_create end
EQA_TEST_SET
select default_create end
feature -- Test
test_custom_classes
local
bc: detachable BOOK_COLLECTION
jbc: JSON_BOOK_CONVERTER
jbcc: JSON_BOOK_COLLECTION_CONVERTER
jac: JSON_AUTHOR_CONVERTER
jo: detachable JSON_OBJECT
parser: JSON_PARSER
jrep: STRING
do
create jbc.make
json.add_converter (jbc)
create jbcc.make
json.add_converter (jbcc)
create jac.make
json.add_converter (jac)
jrep := "{%"name%":%"Test collection%",%"books%":[{%"title%":%"eJSON: The Definitive Guide%",%"isbn%":%"123123-413243%",%"author%":{%"name%":%"Foo Bar%"}}]}"
create parser.make_parser (jrep)
jo := Void
jo ?= parser.parse
assert ("jo /= Void", jo /= Void)
bc := Void
bc ?= json.object (jo, "BOOK_COLLECTION")
assert ("bc /= Void", bc /= Void)
jo ?= json.value (bc)
assert ("jo /= Void", jo /= Void)
if attached jo as l_jo then
assert ("JSON representation is correct", l_jo.representation.same_string ("{%"name%":%"Test collection%",%"books%":[{%"title%":%"eJSON: The Definitive Guide%",%"isbn%":%"123123-413243%",%"author%":{%"name%":%"Foo Bar%"}}]}"))
end
end
end -- class TEST_JSON_CUSTOM_CLASS

View File

@@ -1,544 +0,0 @@
note
description: "[
Eiffel tests that can be executed by testing tool.
]"
author: "EiffelStudio test wizard"
date: "$Date$"
revision: "$Revision$"
testing: "type/manual"
class
TEST_JSON_SUITE
inherit
EQA_TEST_SET
redefine
on_prepare
end
feature {NONE} -- Events
on_prepare
-- <Precursor>
do
create file_reader
end
feature -- Tests Pass
test_json_pass1
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("pass1.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("pass1.json",parse_json.is_parsed = True)
end
end
test_json_pass2
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("pass2.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("pass2.json",parse_json.is_parsed = True)
end
end
test_json_pass3
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("pass3.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("pass3.json",parse_json.is_parsed = True)
end
end
test_json_utf_8_pass1
local
parse_json: like new_json_parser
utf: UTF_CONVERTER
s: READABLE_STRING_32
do
s := {STRING_32} "{ %"nihaoma%": %"你好吗\t?%" }"
parse_json := new_json_parser (utf.string_32_to_utf_8_string_8 (s))
json_value := parse_json.parse_json
assert ("utf8.pass1.json", parse_json.is_parsed = True)
if
attached {JSON_OBJECT} json_value as jo and then
attached {JSON_STRING} jo.item ("nihaoma") as js
then
assert ("utf8.nihaoma", js.unescaped_string_32.same_string ({STRING_32} "你好吗%T?"))
else
assert ("utf8.nihaoma", False)
end
end
feature -- Tests Failures
test_json_fail1
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail1.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail1.json",parse_json.is_parsed = False)
end
end
test_json_fail2
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail2.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail2.json",parse_json.is_parsed = False)
end
end
test_json_fail3
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail3.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail3.json",parse_json.is_parsed = False)
end
end
test_json_fail4
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail4.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail4.json",parse_json.is_parsed = False)
end
end
test_json_fail5
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail5.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail5.json",parse_json.is_parsed = False)
end
end
test_json_fail6
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail6.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail6.json",parse_json.is_parsed = False )
end
end
test_json_fail7
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail7.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail7.json",parse_json.is_parsed = False)
end
end
test_json_fail8
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail8.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail8.json",parse_json.is_parsed = False )
end
end
test_json_fail9
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail9.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail9.json",parse_json.is_parsed = False)
end
end
test_json_fail10
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail10.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail10.json",parse_json.is_parsed = False)
end
end
test_json_fail11
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail11.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail11.json",parse_json.is_parsed = False)
end
end
test_json_fail12
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail12.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail12.json",parse_json.is_parsed = False)
end
end
test_json_fail13
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail13.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail13.json",parse_json.is_parsed = False)
end
end
test_json_fail14
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail14.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail14.json",parse_json.is_parsed = False)
end
end
test_json_fail15
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail15.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail15.json",parse_json.is_parsed = False)
end
end
test_json_fail16
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail16.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail16.json",parse_json.is_parsed = False)
end
end
test_json_fail17
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail17.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail17.json",parse_json.is_parsed = False)
end
end
test_json_fail18
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail18.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail18.json",parse_json.is_parsed = True)
end
end
test_json_fail19
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail19.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail19.json",parse_json.is_parsed = False)
end
end
test_json_fail20
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail20.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail20.json",parse_json.is_parsed = False)
end
end
test_json_fail21
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail21.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail21.json",parse_json.is_parsed = False)
end
end
test_json_fail22
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail22.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail22.json",parse_json.is_parsed = False)
end
end
test_json_fail23
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail23.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail23.json",parse_json.is_parsed = False)
end
end
test_json_fail24
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail24.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail24.json",parse_json.is_parsed = False)
end
end
test_json_fail25
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail25.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail25.json",parse_json.is_parsed = False)
end
end
test_json_fail26
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail26.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail26.json",parse_json.is_parsed = False)
end
end
test_json_fail27
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail27.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail27.json",parse_json.is_parsed = False)
end
end
test_json_fail28
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail28.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail28.json",parse_json.is_parsed = False)
end
end
test_json_fail29
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail29.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail29.json",parse_json.is_parsed = False )
end
end
test_json_fail30
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail30.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail30.json",parse_json.is_parsed = False)
end
end
test_json_fail31
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail31.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail31.json",parse_json.is_parsed = False)
end
end
test_json_fail32
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail32.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail32.json",parse_json.is_parsed = False)
end
end
test_json_fail33
--
local
parse_json: like new_json_parser
do
if attached json_file_from ("fail33.json") as json_file then
parse_json := new_json_parser (json_file)
json_value := parse_json.parse_json
assert ("fail33.json",parse_json.is_parsed = False)
end
end
feature -- JSON_FROM_FILE
file_reader: JSON_FILE_READER
json_value: detachable JSON_VALUE
json_file_from (fn: STRING): detachable STRING
local
f: RAW_FILE
l_path: STRING
test_dir: STRING
i: INTEGER
do
test_dir := (create {EXECUTION_ENVIRONMENT}).current_working_directory
test_dir.append_character ((create {OPERATING_ENVIRONMENT}).directory_separator)
l_path := test_dir + fn
create f.make_with_name (l_path)
if f.exists then
-- Found json file
else
-- before EiffelStudio 7.3 , the current dir of autotest execution was not the parent dir of ecf but something like
-- ..json\test\autotest\test_suite\EIFGENs\test_suite\Testing\execution\TEST_JSON_SUITE.test_json_fail1\..\..\..\..\..\fail1.json
from
i := 5
until
i = 0
loop
test_dir.append_character ('.')
test_dir.append_character ('.')
test_dir.append_character ((create {OPERATING_ENVIRONMENT}).directory_separator)
i := i - 1
end
l_path := test_dir + fn
end
create f.make_with_name (l_path)
if f.exists then
Result := file_reader.read_json_from (l_path)
end
assert ("File contains json data", Result /= Void)
end
new_json_parser (a_string: STRING): JSON_PARSER
do
create Result.make_parser (a_string)
end
invariant
file_reader /= Void
end

View File

@@ -1,18 +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="test_suite" uuid="EA141B17-6A21-4781-8B5F-E9939BAE968A">
<target name="test_suite">
<root cluster="test_suite" class="APPLICATION" feature="make"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="standard">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="json" location="..\..\..\library\json-safe.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
<cluster name="test_suite" location=".\" recursive="true"/>
</target>
</system>

View File

@@ -1,19 +0,0 @@
<?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="test_suite" uuid="EA141B17-6A21-4781-8B5F-E9939BAE968A">
<target name="test_suite">
<root cluster="test_suite" class="APPLICATION" feature="make"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<precompile name="base_pre" location="$ISE_PRECOMP\base.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="json" location="..\..\..\library\json.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing.ecf"/>
<cluster name="test_suite" location=".\" recursive="true"/>
</target>
</system>

Some files were not shown because too many files have changed in this diff Show More