Compare commits

...

440 Commits

Author SHA1 Message Date
Jocelyn Fiat
34c6288032 Fixed a last minute regression due to removal REQUEST.chunked_input 2012-04-13 17:19:14 +02:00
Jocelyn Fiat
21b03a05fd Added WSF_ROUTER.pre_route_execution_actions: ACTION_SEQUENCE [like route]
This way, one can add logger hook to router, to see which "route" was taken by the request.
2012-04-13 16:40:19 +02:00
Jocelyn Fiat
0bd2d16c12 Made WGI_CHUNKED_INPUT_STREAM inherits from WGI_INPUT_STREAM
Merged REQUEST.input and REQUEST.chunked_input
  Now REQUEST.input handles directly the chunked transfer encoding, or the non chunked.
Kept REQUEST.is_chunked_input since it matters that Content-Length is 0 even if there are input (chunked) data.
2012-04-13 16:33:49 +02:00
Jocelyn Fiat
e6a727ee42 Fixed compilation of samples 2012-04-12 12:51:52 +02:00
Jocelyn Fiat
1403cc5c09 Fixed compilation 2012-04-12 12:25:34 +02:00
Jocelyn Fiat
3bbf356f19 Missing commit related to changes on WSF_ROUTER 2012-04-12 11:59:14 +02:00
Jocelyn Fiat
b541efcc8f Now WGI_RESPONSE.set_status_code (..) has a new argument to pass optional custom reason phrase.
This is a minor breaking change (but prior to the first release, so acceptable)
   And then it is now possible to precise a custom reason phrase (useful for 4xx and 5xx response)

At the WSF_RESPONSE level, the status code is now sent only when the header are sent.
thus, it is possible to change the status code as long as no header is sent.
(in the future, we should also try to delay the sending of headers)

Removed WGI_RESPONSE.put_header_lines (..) which was not used, and WGI is not meant to provide such user friendly features
Now this is available directly on WSF_RESPONSE
2012-04-12 11:19:41 +02:00
Jocelyn Fiat
082def2b70 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-04-06 15:52:03 +02:00
Jocelyn Fiat
79607600e6 updated to EiffelWebFramework/EWF 2012-04-06 16:27:22 +03:00
Jocelyn Fiat
0b6b7f793c sync with json lib. 2012-04-06 11:31:57 +02:00
Jocelyn Fiat
badc2458c4 Sync with wiki 2012-04-06 11:29:07 +02:00
Jocelyn Fiat
d4208c59f3 Use https://github.com/EiffelWebFramework/EWF.git as master 2012-04-06 11:21:50 +02:00
Jocelyn Fiat
4bafa5b3c0 Added `transfered_content_length' to WSF_RESPONSE to provide the information to application
This can be used to build logs for instance.
2012-04-05 21:15:12 +02:00
Jocelyn Fiat
c89b19371e Relaxed WSF_REDIRECTION_RESPONSE.set_content (.., ..) to allow Void for content type
in order to use the one set in header or the default one.
2012-04-05 21:14:10 +02:00
Jocelyn Fiat
10ebc12852 Removed default handler for WSF_ROUTER
Added 	WSF_ROUTE to replace a TUPLE [H, C]
	WSF_ROUTER.route (req): detachable WSF_ROUTE
	WSF_ROUTER.execute_route (a_route, req, res)
	To help usage of Routers
Remove WSF_HANDLER_CONTEXT obsolete features.
Added comments
2012-04-05 21:13:04 +02:00
Jocelyn Fiat
593e48ec5b Merge remote-tracking branch 'remotes/eiffelworld/master' 2012-04-02 09:29:53 +02:00
Jocelyn Fiat
11b15ec5b7 Merge pull request #10 from oligot/unneeded_precondition
Unneeded precondition
2012-04-02 00:28:23 -07:00
Olivier Ligot
ff713a42ab [REM] Remove unneeded precondition 2012-04-02 09:28:22 +02:00
Olivier Ligot
155c45be6c [IMP] Ignore *.swp files 2012-04-02 09:28:10 +02:00
Jocelyn Fiat
09fa1adaab removed obsolete message. 2012-04-02 09:27:59 +02:00
Olivier Ligot
425c276051 [REM] Remove unneeded precondition 2012-03-27 11:30:42 +02:00
Olivier Ligot
0040e4b0d0 [IMP] Ignore *.swp files 2012-03-27 11:29:33 +02:00
Olivier Ligot
b862065c04 Merge branch 'master', remote branch 'upstream/master' 2012-03-26 17:19:02 +02:00
Jocelyn Fiat
874677ab7a Renamed same_media_type as same_simple_type
Added comments
2012-03-23 19:00:49 +01:00
Jocelyn Fiat
ed200b93dd updated tests.ecf 2012-03-23 18:40:29 +01:00
Jocelyn Fiat
bcccfb22ed Added HTTP_MEDIA_TYPE (maybe it will just replace the HTTP_CONTENT_TYPE later)
renamed .media_type as .simple_type for now
  allow more than one parameters
2012-03-23 18:39:19 +01:00
Jocelyn Fiat
5c98d7ba4e Use media_type as replacement for type_and_subtype_string in HTTP_CONTENT_TYPE 2012-03-23 16:49:13 +01:00
Jocelyn Fiat
40c6aff423 Added class HTTP_CONTENT_TYPE to help manipulation of Content-Type value
Now WSF_REQUEST return a HTTP_CONTENT_TYPE if available
Adapted WSF_MIME_HANDLER to use this new class
Added one manual autotest to test MIME handler
2012-03-23 16:40:13 +01:00
Jocelyn Fiat
ac9cbb0bd2 in WSF_RESPONSE, put_header' now call put_header_text'
Removed unused local variable
2012-03-21 14:49:09 +01:00
Jocelyn Fiat
95c3bbf6e5 Fixed very bad mistake where no Result was ever set for WSF_REQUEST.item (..) 2012-03-21 14:43:32 +01:00
Jocelyn Fiat
b955912dc2 fixed compilation issue (typo) 2012-03-20 16:17:43 +01:00
Jocelyn Fiat
50223b12f7 Do not try to compile_all in "dev" folder 2012-03-20 16:15:16 +01:00
Jocelyn Fiat
6c7ba93062 Reverted a previous change, we should not truncated Content-Type after ;
In the case of multipart/form-data  the parameter "boundary=" is essential
2012-03-20 14:35:04 +01:00
Jocelyn Fiat
743f26c376 Use WSF_DEFAULT_SERVICE for the test echo server 2012-03-20 12:18:44 +01:00
Jocelyn Fiat
d256ec3944 Fixing compilation of specific example using the WGI connector directly 2012-03-20 12:15:45 +01:00
Jocelyn Fiat
482f8e41e7 Added WSF_SERVICE.to_wgi_service to ease direct integration with existing WGI components 2012-03-20 11:40:13 +01:00
Jocelyn Fiat
9eef812795 Relaxed access to `send_to', now it is exported again to avoid breaking existing code. 2012-03-20 11:38:44 +01:00
Jocelyn Fiat
86fcaa2835 remove unused local variable 2012-03-20 11:15:14 +01:00
Jocelyn Fiat
897aeb3132 WSF_REQUEST.content_type should keep only the relevant part of the content type
and forget about the eventual parameters (charset, name) ...

  note: it is possible to query meta_string_variable ("CONTENT_TYPE")
        to get the complete Content-Type header
2012-03-20 11:12:18 +01:00
Jocelyn Fiat
48acdea73c Added HTTP_HEADER.(put|add)_content_type_with_parameters (...) 2012-03-20 11:08:52 +01:00
Jocelyn Fiat
cbaae12156 removed obsolete 2012-03-20 10:30:04 +01:00
Jocelyn Fiat
8344607eb6 Implemented WSF_RESPONSE.put_error (...) and related
Added WSF_RESPONSE.put_character
Renamed  WGI_OUTPUT_STREAM.put_character_8 as put_character  to follow style of put_string  (and not put_string_8)
Refactored the WSF_DEFAULT_SERVICE_LAUNCHER
Added WSF_DEFAULT_SERVICE to be more user friendly
Splitted the wsf/default/ libraries to have wsf/connector/... and being able to handle more than one connector in the same application
2012-03-20 10:29:55 +01:00
Jocelyn Fiat
71d5dc4795 Moved mime handler classes under wsf/src/mime/ 2012-03-20 08:38:38 +01:00
Jocelyn Fiat
3f0b745ecc removed unwanted rescue clause 2012-03-19 15:20:29 +01:00
Jocelyn Fiat
3432e2d8b2 Updating EWSGI specification classes 2012-03-19 15:06:50 +01:00
Jocelyn Fiat
fea0f115a0 Removed WGI_RESPONSE.write (..)
Replaced any internal call to WGI_RESPONSE.write () by the associated implementation (i.e  output.put_string (...)  )
Added WGI_OUTPUT_STREAM.put_crlf

Renamed WSF_RESPONSE.put_response (a_message) as  `send (a_message)'
WSF_RESPONSE_MESSAGE.send_to (res)  is now exported only to WSF_RESPONSE
2012-03-19 14:52:12 +01:00
Berend de Boer
84a12447db Avoid another indirection. 2012-03-19 14:02:13 +01:00
Berend de Boer
876f9e02b7 status must be set, else WGI_SERVICE.execute will report the
postcondition violation.

Conflicts:

	library/server/wsf/router/wsf_handler.e
2012-03-19 13:58:17 +01:00
Berend de Boer
e5323dd208 Minor code cleanup/typo fix. 2012-03-19 13:54:48 +01:00
Berend de Boer
77834a3dd8 Move wgi_service spec to its own directory else I get a class
conflicts with compile_ise.ecf generated by gexace.
2012-03-19 13:54:34 +01:00
Jocelyn Fiat
4906345a62 Improved comment in WSF_RESPONSE.put_response (..)
Added WSF_REDIRECTION_RESPONSE class
2012-03-19 12:32:12 +01:00
Jocelyn Fiat
487487ad44 Added WSF_RESPONSE_HANDLER based on WSF_RESPONSE_MESSAGE
The descendant has to implement the function

    response (ctx: C; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE

Added related features and class in WSF_ROUTER to be able to use agent easily.
2012-03-19 12:04:46 +01:00
Jocelyn Fiat
ef5ba19c46 Refactored WSF_HANDLER_CONTEXT
- removed path_parameter
  - added `item' to include WSF_REQUEST.item
  - marked obsolete `parameter'

The goal is to remove confusion, remove URI_TEMPLATE specific `path_parameter'
and provide a way to use ctx.item (..) to also include meta variable, query, form, ... items
2012-03-19 10:21:29 +01:00
Jocelyn Fiat
b05ff01262 Use local variable to speed up access to `input' 2012-03-19 10:12:06 +01:00
Jocelyn Fiat
9f1940c46d Applied wsf_extension creation, and classes moved from wsf to wsf_extension 2012-03-16 15:17:22 +01:00
Jocelyn Fiat
f69ff42564 Created wsf_extension, and moved some classes from wsf to wsf_extension
WSF_HANDLER_HELPER
   WSF_RESOURCE_HANDLER_HELPER
   WSF_HANDLER_ROUTES_RECORDER
2012-03-16 14:12:02 +01:00
Jocelyn Fiat
eb3e9f2186 applied removal of HTTP_HEADER.put_status (..) 2012-03-16 13:53:22 +01:00
Jocelyn Fiat
03b10bdc14 Removed HTTP_HEADER.put_status (...)
It is not recommended to send the status code as part of the HTTP Header,
  so let's remove this ambiguity and do not encourage EWF user to use it
2012-03-16 13:35:52 +01:00
Jocelyn Fiat
46eb92ac37 Major renaming, adopt the WSF_ prefix for all classes under "wsf", and simplify some class names
Removed in WGI_INPUT_STREAM, the assertion "same_last_string_reference"
Copyright updates
2012-03-16 09:49:41 +01:00
Jocelyn Fiat
25218996e0 Fixed compilation of draft/library/server/request/rest/tests/..
Note the "rest" library will not be maintained since this is not REST.
2012-03-13 18:41:32 +01:00
Jocelyn Fiat
68dbbdea9f precise that library/server/request/router is now part of "wsf" library and not anymore independant library. 2012-03-13 18:09:16 +01:00
Jocelyn Fiat
5abc79b7c3 Nino connector:
- fixed issue related to `ready_for_reading'  now use the `try_...' variant
 - for now Nino does not support persistent connection, then we have to respond with "Connection: close"

REQUEST_FILE_SYSTEM_HANDLER:
 - added not_found_handler and access_denied_handler, so that the user can customize related response

WSF_REQUEST and WSF_VALUE:
 - modified how uploaded file are handled, fixed various issues, and added WSF_UPLOADED_FILE (it is a WSF_VALUE)

WSF_VALUE:
 - added change_name (a_name: like name)
 - added url_encoded_name to other WSF_values

WSF_REQUEST:
 - added `destroy' to perform end of request cleaning (such as deleting temp uploaded files)
 - renamed `raw_post_data_recorded' as `raw_input_data_recorded', and related feature
 - do not store the RAW_POST_DATA in meta variable anymore, but in WSF_REQUEST.raw_input_data is asked

Added WSF_HTML_PAGE_RESPONSE to help user

WSF_REPONSE.redirect_... now use "temp_redirect" as default
  instead of "moved_permanently" which is specific usage

Removed many obsolete features.
2012-03-13 18:07:28 +01:00
Jocelyn Fiat
c5fe539acb use https:// url for git submodules 2012-02-29 17:23:34 +01:00
Jocelyn Fiat
ac3e969b3c Added assertions to catch if route mapping does not already exists 2012-02-29 11:27:46 +01:00
Jocelyn Fiat
98f2efbd68 Merging changes from Javier
Updated restbucksCRUD example, and related class in wsf/router
2012-02-28 09:23:09 +01:00
Jocelyn Fiat
7314e92fe6 Synchronized with nino and json library 2012-02-28 09:20:08 +01:00
jvelilla
468b2851be Refactor REQUEST_RESOURCE_HANDLER_HELPER to figure out the
transfer encoding: Chunked.
Added a new method to retrieve_data independently if the
transfer is chunked or not.
Updated ORDER_HANLDER to use this new feature.
Sync with Jocelyn repo
2012-02-17 08:48:27 -03:00
jvelilla
f1fe5464c6 Merge branch 'master' of git://github.com/jocelyn/Eiffel-Web-Framework 2012-02-17 07:28:57 -03:00
Jocelyn Fiat
d621987020 Minor correction, to avoid returning 200 as status code, when the client can not connect 2012-02-16 10:32:24 +01:00
Jocelyn Fiat
e541fdcb0c fixed compilation 2012-02-15 12:36:57 +01:00
Jocelyn Fiat
5950d768c9 sync with cURL library 2012-02-15 11:58:32 +01:00
Jocelyn Fiat
413fdaf6cd Fixed error visitor due to recent signature changes 2012-02-15 11:33:39 +01:00
Jocelyn Fiat
9138ffedfb renamed (add|remove)_synchronized_handler as (add|remove)_synchronization 2012-02-15 11:07:12 +01:00
Jocelyn Fiat
72cc05532c Removed tests target from encoder(-safe).ecf
(now there is a tests-safe.ecf in folder tests)
2012-02-15 11:04:42 +01:00
Jocelyn Fiat
145b129b28 Fixed ERROR_HANDLER.destroy
Fixed and export ERROR_HANDLER.remove_synchronized_handler
Added comments
Added associated autotests
2012-02-15 11:03:30 +01:00
Jocelyn Fiat
fbec89f354 Better signature for encoders
Split library .ecf and the autotest .ecf
2012-02-14 18:03:42 +01:00
Jocelyn Fiat
f59d5cac32 added postcondition to ensure the body string set to the response, is the same reference
this is important, since sometime we just do
  rep.set_body (s)
  s.append_string ("..")
2012-02-14 18:02:14 +01:00
Jocelyn Fiat
4bb8a71c1b Added DEBUG_OUTPUT to ERROR, since this is convenient during debugging 2012-02-14 18:01:17 +01:00
Jocelyn Fiat
dd6b74326e Added notion of synchronization between error handler
this is convenient to integrate two components using their own ERROR_HANDLER (not sharing the same object)
2012-02-14 12:57:01 +01:00
Jocelyn Fiat
e52cd6b352 use WSF_PAGE_RESPONSE, instead of reimplementing it ourself 2012-02-14 10:20:15 +01:00
Jocelyn Fiat
537bd8241f added a JSON encoder test case 2012-02-13 14:38:13 +01:00
Jocelyn Fiat
040c1d1c10 Merge pull request #9 from oligot/fix-libfcgi-location
[FIX] libfcgi.so location
2012-02-13 03:21:29 -08:00
Olivier Ligot
f3c779cf6e [FIX] libfcgi.so location
On Ubuntu 10.04 LTS, libfcgi.so is in /usr/lib instead of /usr/local/lib
2012-02-10 14:01:04 +01:00
Jocelyn Fiat
6cf35e90c6 added a case in test_json_encoder 2012-02-08 21:36:49 +01:00
unknown
497fe03d38 libcurl: Applied a workaround to avoid issue on Win32 (see LIBCURL_HTTP_CLIENT_REQUEST.apply_workaround)
Separated the http_client-safe.ecf and test-safe.ecf
Added HTTP_CLIENT_SESSION.set_max_redirects
Fixed broken test due to formatting trouble.
2012-02-08 21:32:25 +01:00
Jocelyn Fiat
ca3a520bb9 fixed http_client tests 2012-02-08 16:36:54 +01:00
jvelilla
3c755019aa Updated content 2012-02-08 08:47:39 -03:00
Jocelyn Fiat
3a9b67c8ad Better code to test similar functions but with chunked input 2012-02-07 16:05:19 +01:00
Jocelyn Fiat
e21da4a591 Improved the WSF_PAGE_RESPONSE to be more flexible and allow to change some values as expected. 2012-02-07 15:49:02 +01:00
Jocelyn Fiat
69bc4d568c Added support for chunked input data (see Transfer-Encoding: chunked) 2012-02-07 15:47:55 +01:00
Jocelyn Fiat
cf8d25c4e5 Added HTTP_HEADER.append_header_object and append_array.
This is helpful to "merge" two HTTP_HEADER and provide user friendly features
2012-02-07 15:45:44 +01:00
Jocelyn Fiat
2b9ca86501 Added proxy, at least to make it is possible to use http://fiddler2.com/ to inspect the traffic. 2012-02-07 15:44:45 +01:00
Jocelyn Fiat
2f43660628 Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework 2012-02-07 15:13:59 +01:00
Jocelyn Fiat
d8476edf36 Fixed wrong code for postcondition on HTTP_HEADER.string
Patch provided by Paul-G.Crismer
2012-02-01 16:53:24 +01:00
Jocelyn Fiat
67e6b460b3 removed unwanted set_status_code, since we already use put_header to set the status code. 2012-02-01 16:05:30 +01:00
Jocelyn Fiat
962154fc81 Eventually fixing trouble with c_strlen being over capacity
(added this for testing, and while waiting a fix from EiffelcURL)
2012-02-01 11:57:42 +01:00
Jocelyn Fiat
645b35590b Improved redirect_now_custom to allow custom status code, custom header, and custom content 2012-02-01 10:57:52 +01:00
Jocelyn Fiat
a1354136fa Fixed usage of lst[] in web form, now we are url-decoding the name because the [] could escaped...
Fixed bad code for assertion related to variable url-encoded name
2012-01-31 17:57:59 +01:00
Jocelyn Fiat
945ef79857 added REQUEST_HANDLER_CONTEXT.string_array_path_parameter (...) to help user handling list/array parameters
fixed postcondition WSF_REQUEST.set_meta_string_variable ...
2012-01-31 12:12:41 +01:00
Jocelyn Fiat
2c4df29877 Make sure to return a response
Added precondition to check URI_TEMPLATE is valid
2012-01-25 16:27:22 +01:00
Jocelyn Fiat
e6687c7791 Fixed wrong assertion, status_committed instead of status_set 2012-01-24 16:47:12 +01:00
Jocelyn Fiat
754d3f670c Fixed issue with WSF_FILE_RESPONSE not setting the status code
Added Last-Modified
2012-01-23 18:20:25 +01:00
Jocelyn Fiat
8e420de8ec Fixed wrong code for postcondition in unset_orig_path_info 2012-01-23 15:32:11 +01:00
Jocelyn Fiat
6dc1c0d2b0 Removed most of the "retry" in rescue clauses, since it was hidding critical issue.
This should be the choice of the application to "retry" on exception, otherwise let the framework handle this in the lower part.

Better handling of response termination (alias commit)
Added the notion of "status_committed"
2012-01-23 15:31:34 +01:00
Jocelyn Fiat
80d68699b1 added "conversion" to ease the use of HTTP_HEADER 2012-01-23 15:28:06 +01:00
Jocelyn Fiat
fcdf4e456e fixed compilation (was not up to date with tests.ecf) 2012-01-20 20:04:56 +01:00
Jocelyn Fiat
c92c2a91b4 Corrected remaining issue related to recent addition of REQUEST_ROUTER.make_with_base_url
And applied removal of format_name and format_id, and replaced by accepted_format_name, ...
2012-01-20 18:55:03 +01:00
Jocelyn Fiat
da9fa4ecc2 Do not add again ctx.headers, since it is already "imported" during the creation of Current request
(see HTTP_CLIENT_REQUEST.make)
2012-01-20 15:37:04 +01:00
Jocelyn Fiat
abdd68863d Removed any "format" related query from router lib, this is too application specific to be there.
Better handling of base_url for REQUEST_ROUTER
2012-01-20 15:35:03 +01:00
Jocelyn Fiat
83a8ad3879 separate library .ecf and tests .ecf
merged tests .ecf for draft 05 and current implementation
2012-01-19 14:34:04 +01:00
Jocelyn Fiat
1b55b09b64 Fixed WSF_REQUEST.script_url (..) for clean path
Added related autotests
2012-01-19 10:25:53 +01:00
Jocelyn Fiat
4cf3393a13 Don't forget to put Content-Length: 0 for redirect without any content 2012-01-17 17:37:26 +01:00
Jocelyn Fiat
4486df14cc export handler from REQUEST_ROUTER 2012-01-17 07:51:26 -08:00
Jocelyn Fiat
60574ee85f REQUEST_ROUTER now inherit from ITERABLE [..] 2012-01-17 16:35:52 +01:00
Jocelyn Fiat
7a6c51e47e Send the Status code, as an header line Status: code reason 2012-01-17 16:34:48 +01:00
Jocelyn Fiat
d8c420c4b7 use READABLE_STRING_8 instead of STRING_8 2012-01-17 16:33:40 +01:00
Jocelyn Fiat
790aa40591 According to http://www.fastcgi.com/docs/faq.html#httpstatus
send the Status code, as an header line  Status: code reason
2012-01-17 13:49:04 +01:00
Jocelyn Fiat
e506397406 Do not send any Status line back to the FastCGI client 2012-01-16 13:49:38 +01:00
Jocelyn Fiat
434f031680 Synchronized with ejson library
Cleaned JSON_ENCODER
2012-01-13 19:04:26 +01:00
Jocelyn Fiat
e36533bc99 Added JSON_ENCODER 2012-01-12 10:38:43 +01:00
Jocelyn Fiat
d90ecbd5fe removed obsolete call on WSF_RESPONSE.write_..' by using the up-to-date WSF_RESPONSE.put_..' 2012-01-09 10:21:35 +01:00
Jocelyn Fiat
20281bc922 HTTP_HEADER: - added put_last_modified
- added RFC1123 http date format helper
             - added put_cookie_with_expiration_date as DATE_TIME
REQUEST: added `execution_variable' to provide a way to keep object attached to the request
         and indexed by a string. A typical usage is a SESSION object
2012-01-06 18:27:52 +01:00
jvelilla
6b3a2d3b43 Update examples/restbucksCRUD/readme.md 2011-12-21 15:40:03 -02:00
Jocelyn Fiat
83346c92a7 added REQUEST.execution_variables ... to provide a solution to store data during request execution
could be used for SESSION, or any "shared" data inside the same Request
2011-12-18 12:57:24 +01:00
Jocelyn Fiat
6b50ab8c55 applied write_ as put_ renaming to examples 2011-12-18 12:55:42 +01:00
Jocelyn Fiat
c8efa04147 Use put_ instead of write_ 2011-12-15 23:52:53 +01:00
Jocelyn Fiat
37860f43b5 various minor changes 2011-12-15 23:38:34 +01:00
Jocelyn Fiat
65a998cec3 use /usr/lib/libfcgi.so instead of /usr/local/lib/libfcgi.so 2011-12-15 20:10:31 +01:00
Jocelyn Fiat
7207a021be Applied renaming from write_ to put_ 2011-12-15 19:34:20 +01:00
Jocelyn Fiat
32373addfa Renamed write_ feature as put_ 2011-12-15 19:04:26 +01:00
Jocelyn Fiat
e16f03b1c2 Fixed stupid mistake in {WGI_NINO_INPUT_SREEAM}.end_of_input 2011-12-15 15:36:47 +01:00
Jocelyn Fiat
1698a06ea0 Fixed typo and missing uri_template reference for draft rest library 2011-12-15 14:40:43 +01:00
Jocelyn Fiat
da3594db50 Now the 'router' library is part of 'wsf'
Move hello_routed_world under tests/dev since it was not really an example, but more a dev workspace/test
2011-12-15 14:10:52 +01:00
Jocelyn Fiat
bfa620eee3 Made DEFAULT_SERVICE_LAUNCHER more flexible for the user. 2011-12-15 13:30:19 +01:00
jvelilla
1423412f31 Update read_trailer feature. 2011-12-15 09:18:37 -03:00
jvelilla
0f51925ec1 Initial implementation of wgi_chunked_input_stream
as a wrapper of wgi_input_stream
2011-12-15 08:53:50 -03:00
Jocelyn Fiat
b6784ee35c Use port 9090 for restbuck server
mainly to avoid using 80 or 8080 which are often already used (by current webserver, or even skype, or jenkins, or ...)
2011-12-14 16:34:01 +01:00
Jocelyn Fiat
ab5b43d8ef Forgot to add make_and_launch_with_options to the creation procedures 2011-12-14 15:04:29 +01:00
Jocelyn Fiat
c7366615cf Added DEFAULT_SERVICE_LAUNCHER.make_and_launch_with_options
Added WSF_RESPONSE.redirect_now_with_content (...)
Updated hello_routed_world .. mainly example use to test/develop... not really a nice example
2011-12-14 14:44:06 +01:00
Jocelyn Fiat
b60c41ee1b Updated readme on how to get source code 2011-12-13 11:43:24 +01:00
Jocelyn Fiat
f9dfeb0034 added head and bottom value in WSF_FILE_RESPONSE, to enable the user to set a head and bottom part easily 2011-12-13 10:35:49 +01:00
Jocelyn Fiat
5e35bc59a9 avoid infinite rescue due to internal error or user code not dealing well with socket disconnection 2011-12-12 21:19:45 +01:00
Jocelyn Fiat
2ed6d92e53 Removed dotnet target for now 2011-12-12 21:18:35 +01:00
Jocelyn Fiat
33d3071cad Merge branch 'master' of github.com:Eiffel-World/Eiffel-Web-Framework 2011-12-12 18:57:09 +01:00
Jocelyn Fiat
35dde23976 Fixed http_client autotest code 2011-12-12 18:50:40 +01:00
Jocelyn Fiat
390c05b056 Break inheritance from WGI_RESPONSE, since it is not flexible for future improvement. 2011-12-12 18:24:46 +01:00
Jocelyn Fiat
011f8746d6 Fixed HTTP client callers 2011-12-12 18:17:39 +01:00
Jocelyn Fiat
0335226e8b Renamed DEFAULT_SERVICE as DEFAULT_SERVICE_LAUNCHER 2011-12-12 18:17:27 +01:00
Jocelyn Fiat
68e4ac9a8f Fixed WSF_FILE_RESPONSE
and added WSF_FORCE_DOWNLOAD_RESPONSE
2011-12-12 16:20:06 +01:00
Jocelyn Fiat
f6b293d4ae Merge changes from Javier
- update on RESTbuck examples
- new example
- fixed bad typo in WSF_REQUEST

Reverted some changes such as
- http_client_response: keep the headers as a list to handle multiple message-value with same message-name

Fixed simple and simple_file example
Improved HTTP_HEADER

Changed libcurl implementation for http client
- now the header from the context really overwrite any of the session headers
- better design which is more strict, and remove any doubt about context's header usage
2011-12-12 16:03:38 +01:00
Jocelyn Fiat
89572b4f33 Removed any (put|write)_file_content from the WSF_ or WGI_ OUTPUT classes
Now DEFAULT_SERVICE has to be created instead of inherited.
   - This seems to be better for new user, and this avoid potential conflict and difference when inheriting between the various DEFAULT_SERVICE implementation.
   - remember that DEFAULT_SERVICE, is mainly to help the user to build its very first service.
Use READABLE_STRING_8 as argument whenever it is possible.
Added WSF_RESPONSE_MESSAGE, and WSF_RESPONSE.put_response (a_response_message)
Now WSF_RESPONSE inherit from WGI_RESPONSE
2011-12-12 11:16:15 +01:00
jvelilla
52e6944f37 Merge branch 'master' of github.com:jvelilla/Eiffel-Web-Framework 2011-12-10 18:06:39 -03:00
jvelilla
bf056154d8 Update restbuck client, create and read an order.
Update JSON converter, the id is not important, applied the DRY principle.
Update the ORDER_HANDLER to use the meta_string_variable instead of meta_variable from req.
Fix, the key in meta_variable_table, use c.key instead of c.item
2011-12-10 18:05:41 -03:00
jvelilla
a3c50956f1 Update examples/restbucksCRUD/readme.md 2011-12-10 11:02:20 -02:00
jvelilla
0d67533c83 Merge branch 'master' of github.com:jvelilla/Eiffel-Web-Framework 2011-12-09 21:14:18 -03:00
jvelilla
c0c206e9ae Update the restbuck_client, still work in progress.
Update restbuck_server, remove unused class in inherit.
Update libcurl_http_client_request, to parse context headers before the
execution.
Update wgi_input_stream, commented precondition.
2011-12-09 21:11:16 -03:00
jvelilla
36601fd3a4 Update examples/restbucksCRUD/readme.md 2011-12-09 19:16:07 -02:00
jvelilla
9a85c24c0d Update examples/restbucksCRUD/readme.md 2011-12-09 19:15:33 -02:00
jvelilla
5ef19021eb Update examples/restbucksCRUD/readme.md 2011-12-09 19:10:09 -02:00
jvelilla
7495d0e6a7 Update examples/restbucksCRUD/readme.md 2011-12-09 19:00:58 -02:00
jvelilla
f27c1f97a3 Update examples/restbucksCRUD/readme.md 2011-12-09 18:59:23 -02:00
jvelilla
b96029a750 Update examples/restbucksCRUD/readme.md 2011-12-09 18:56:49 -02:00
jvelilla
9ef10c749a Update examples/restbucksCRUD/readme.md 2011-12-09 18:45:50 -02:00
jvelilla
0aa3d81b22 Update examples/restbucksCRUD/readme.md 2011-12-09 18:44:21 -02:00
jvelilla
5d17b0dd29 Update examples/restbucksCRUD/readme.md 2011-12-09 17:24:01 -02:00
jvelilla
5e2c2af18a Update examples/restbucksCRUD/readme.md 2011-12-09 11:57:47 -02:00
jvelilla
de157be6f1 Update examples/restbucksCRUD/readme.md 2011-12-09 11:57:04 -02:00
jvelilla
f601ae1c8b Update examples/restbucksCRUD/readme.md 2011-12-09 11:52:18 -02:00
jvelilla
f6f94add80 Update examples/restbucksCRUD/readme.md 2011-12-09 11:43:58 -02:00
jvelilla
a70e75f729 Update examples/restbucksCRUD/readme.md 2011-12-09 11:41:58 -02:00
jvelilla
2dd43ad829 Update examples/restbucksCRUD/readme.md 2011-12-09 11:02:31 -02:00
jvelilla
108396bd91 Update examples/restbucksCRUD/readme.md 2011-12-09 10:56:58 -02:00
jvelilla
e9b7fc4c93 Update examples/restbucksCRUD/readme.md 2011-12-08 20:28:14 -02:00
jvelilla
0dd2812574 Updated documentation 2011-12-08 20:04:39 -02:00
jvelilla
d961544b8b Updated restbucksCRUD documentation 2011-12-08 18:48:50 -03:00
jvelilla
3313e9cf81 Added basic two basic examples, refactor rename restbucks
to restbucksCRUD
2011-12-08 18:43:29 -03:00
jvelilla
39b5a70979 Sync Jocelyn repo 2011-12-07 07:22:51 -03:00
Jocelyn Fiat
379e806166 Update README.md 2011-12-03 14:55:55 +01:00
Jocelyn Fiat
c1e08a1bdc Update README.md 2011-12-03 14:55:28 +01:00
Jocelyn Fiat
af21520e5d Update README.md 2011-12-03 14:42:09 +01:00
Jocelyn Fiat
effc6ba81d fixed markdown syntax 2011-12-03 14:40:54 +01:00
Jocelyn Fiat
019fb539ae Remove any useless library include from this .ecf
we just need default_"connector", router, wsf and http
2011-12-02 13:50:39 +01:00
Jocelyn Fiat
03938b43c3 Fixed compilation issue for CGI and libFCGI connector
due to recent changes in interface  (use READABLE_STRING_8)
2011-12-02 12:05:07 +01:00
Jocelyn Fiat
e70d67aed5 Integrated new system to handle form_parameter, input_data in relation with MIME handling
This is not yet clear how to let the user precise its own MIME handler
but it is in progress
2011-12-01 19:12:26 +01:00
Jocelyn Fiat
de38f46d1d fixed remaining issue or useless code to set http environment variable 2011-12-01 18:41:51 +01:00
Jocelyn Fiat
8c79a64f0c Fixed stupid error where we were concatenating ... value by error 2011-12-01 18:38:26 +01:00
Jocelyn Fiat
fff7a5c96d Added WSF_RESPONSE.write_chunk (s: ?READABLE_STRING_8)
to help user sending chunk with "Transfer-Encoding: chunked"
2011-12-01 18:22:47 +01:00
Jocelyn Fiat
1b92403045 Synchronized with Nino 2011-12-01 17:59:35 +01:00
Jocelyn Fiat
8ae4a30ee8 Fixed WSF_RESPONSE.redirect* features 2011-12-01 17:52:31 +01:00
Jocelyn Fiat
8ffe2a8f73 sync with Nino, call to put_readable_string_8 2011-12-01 17:52:00 +01:00
Jocelyn Fiat
769f2bb5a8 Synchronized with EiffelWebNino 2011-12-01 15:28:38 +01:00
Jocelyn Fiat
483f065ef1 relative path for README link 2011-12-01 15:13:15 +01:00
jvelilla
8ff055803d Update library/protocol/CONNEG/README.md 2011-12-01 09:38:13 -02:00
jvelilla
3b30f4b994 Update library/protocol/CONNEG/README.md 2011-12-01 09:34:11 -02:00
jvelilla
f71bbc07e8 Updated Conneg library, added test cases 2011-12-01 08:13:42 -03:00
jvelilla
9b9bc1f190 Fixed minor issue, added test cases to check language negotiation. 2011-11-30 08:56:13 -03:00
jvelilla
6feaf5757f Update conneg library and test cases 2011-11-30 07:15:17 -03:00
Jocelyn Fiat
6f4ec89404 Fixed example due to recent interface changes 2011-11-25 20:44:32 +01:00
Jocelyn Fiat
cdfc6851e7 - (WGI|WSF)_RESPONSE(*) renamed write_headers_string as write_header_text
- HTTP_HEADER.string does not have the ending CRLFCRLF .. but just CRLF
- WGI_RESPONSE.write_header_text has the responsibility to handle the last blank line CRLF (separating the header from the message)
- HTTP_HEADER.string does not set anymore a default content type as text/html
- added WGI_RESPONSE.write_header_lines (ITERABLE [TUPLE [name,value: READABLE_STRING_8]] mainly as an helper method,
   this way the WGI user does not have to know about the CRLF end of line
2011-11-25 20:43:04 +01:00
Jocelyn Fiat
e0ec84611e Applied recent renaming from WGI_RESPONSE_BUFFER as WGI_RESPONSE 2011-11-25 19:21:45 +01:00
Jocelyn Fiat
2234d3712b updated WGI specification 2011-11-25 18:25:50 +01:00
Jocelyn Fiat
c89ccfa768 Added missing wgi_connector 2011-11-25 16:27:46 +01:00
Jocelyn Fiat
1a88388ffe added "redirect" helper feature to WSF_RESPONSE 2011-11-25 16:24:55 +01:00
Jocelyn Fiat
5eab38778a Added `{WGI_REQUEST}.wgi_*' function to WSF_REQUEST 2011-11-25 16:24:26 +01:00
Jocelyn Fiat
9d457bb978 rename application' as service' 2011-11-25 16:22:44 +01:00
Jocelyn Fiat
42be0b2a4e Use HTTP_HEADER instead of WSF_HEADER
(WSF_HEADER is kept for convenience and existing code)
2011-11-25 15:53:15 +01:00
Jocelyn Fiat
48d4d26cda better script to check compilation and tests 2011-11-25 14:52:00 +01:00
Jocelyn Fiat
182749d010 Moved implementation of WSF_HEADER to HTTP_HEADER in the http library 2011-11-25 14:51:46 +01:00
Jocelyn Fiat
fd0912904c Simplified EWSGI interfaces
Renamed WGI_RESPONSE_BUFFER as WGI_RESPONSE to avoid confusion
Removed EWF_HEADER and removed related caller from WGI implementation,
   now this is only part of WSF library
Added wgi_version, wgi_implementation and wgi_connector to the WGI_REQUEST interface
   to give more information to the user
Added back WGI_CONNECTOR to WGI specification, mainly because of `{WGI_REQUEST}.wgi_connector'
   simplified WGI_CONNECTOR to contain for now only `name' and `version'
   if the implementation of connector inherit from WGI_CONNECTOR (recommended)
   this might gives more access to the user using a reverse assignment for specific needs
   (but this usage is not recommended due to portability issue on other connector)
Removed useless connector.ecf since now EWF/WGI library provides the helper classes
2011-11-25 14:39:48 +01:00
Jocelyn Fiat
3032b91ff7 Fixed sample example config file after recent location change for "rest" lib 2011-11-23 18:36:56 +01:00
Jocelyn Fiat
772b88f257 Improved run_CI_tests.py and include the compile_all call directly in the python script.
If compile_all tool supports  -keep ... let's use it. (recent addition)
2011-11-23 16:35:22 +01:00
Jocelyn Fiat
a1cc2d1d1a fixed rest(-safe).ecf due to recent location change 2011-11-23 15:37:01 +01:00
Jocelyn Fiat
9f90bf56a5 Merge branch 'master' of github.com:Eiffel-World/Eiffel-Web-Framework 2011-11-23 15:31:47 +01:00
Jocelyn Fiat
dbea0e509b Updated README.md in relation with "rest" lib relocation 2011-11-23 15:27:51 +01:00
Jocelyn Fiat
a3f28e3945 Move "rest" library under "draft/..." since it is more an experiment rather than a real REST library 2011-11-23 15:18:35 +01:00
Jocelyn Fiat
379a6193e9 Update draft/README.md 2011-11-21 18:28:33 +01:00
Jocelyn Fiat
03d9c3785c updated Eiffel libfcgi README file 2011-11-21 17:43:02 +01:00
Jocelyn Fiat
612915c918 Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework
Conflicts:
	library/server/libfcgi/Clib/README.md
2011-11-21 17:33:34 +01:00
Jocelyn Fiat
ff967d6332 Added scripts to help building the libfcgi.dll and .lib from modified source of libfcgi
Extracted into "libfcgi" only the files needed to compile the Windows .dll and .lib
2011-11-21 17:07:38 +01:00
Jocelyn Fiat
8d75a04068 Added scripts to help building the libfcgi.dll and .lib from modified source of libfcgi 2011-11-21 16:38:36 +01:00
Jocelyn Fiat
202ad2861b updated README to apply 'ext' renamed as 'contrib' 2011-11-21 14:30:03 +01:00
Jocelyn Fiat
44857d28ec fixed compilation for tests.ecf 2011-11-18 14:56:02 +01:00
Jocelyn Fiat
e3597c0f3b fixed typo 2011-11-18 14:18:30 +01:00
Jocelyn Fiat
0cce4d8244 Updated "draft" folder which contain potential future addition to EWF 2011-11-18 14:18:22 +01:00
Jocelyn Fiat
aab910ab64 Added "draft" folder to contain potential future addition to EWF 2011-11-18 13:56:07 +01:00
Jocelyn Fiat
257ede7586 restructured CONNEG library
fixed various issue in .ecf files
2011-11-18 11:14:30 +01:00
jvelilla
b58e4e19e1 Initial import CONNEG library, support server side
content negotiation.
2011-11-18 10:19:54 +01:00
Jocelyn Fiat
6ec37c90a2 Rename "ext" as "contrib" in compile_all.ini as well
no need to test the code coming from other projects.
2011-11-17 16:03:29 +01:00
Jocelyn Fiat
49c3e8e789 Renamed "ext" folder as "contrib" folder and reorganized a little bit
Renamed any *_APPLICATION as *_SERVICE
   mainly because those components
   such as WSF_APPLICATION, renamed as WSF_SERVICE
   are not always the main application entry, and "service" describe them better
Minor implementation change in WSF_REQUEST
Cosmetics
2011-11-17 15:50:30 +01:00
Jocelyn Fiat
cc11debf08 handle last run failure 2011-11-16 16:18:27 +01:00
Jocelyn Fiat
b71a22d040 Added request method PATCH even if not really used for now, it might in the future 2011-11-16 15:52:00 +01:00
Jocelyn Fiat
7022206a73 Do not print command during script execution 2011-11-16 13:10:35 +01:00
Jocelyn Fiat
b715d674ca fixed indentation in python script 2011-11-16 09:00:23 +01:00
Jocelyn Fiat
02f5bdd801 Added information output to run_CI_tests.py 2011-11-16 08:57:02 +01:00
Jocelyn Fiat
203d51a97e updated run_CI_tests.py 2011-11-16 08:48:24 +01:00
Jocelyn Fiat
733296e71e updated run_CI_tests.py 2011-11-16 08:42:08 +01:00
Jocelyn Fiat
0a497b9a4d updated run_CI_tests.py 2011-11-16 08:34:00 +01:00
Jocelyn Fiat
4ed91a91a2 updated run_CI_tests.py 2011-11-16 07:51:04 +01:00
Jocelyn Fiat
a76eb75267 removed unused local variables 2011-11-16 07:25:29 +01:00
Jocelyn Fiat
2c94a98730 added a python script to be use inside jenkins CI server
(experimental for now)
2011-11-16 07:25:15 +01:00
Jocelyn Fiat
cc960310e9 cosmetic 2011-11-14 19:06:31 +01:00
Jocelyn Fiat
d9daac67d9 cosmetics 2011-11-14 19:05:48 +01:00
Jocelyn Fiat
955f73dee9 Added various README.md (using the markdown syntax) 2011-11-14 19:00:00 +01:00
Jocelyn Fiat
137ed3888c updated README with links to sub READM.md 2011-11-14 18:46:37 +01:00
Jocelyn Fiat
8382e8f134 sync with Eiffel Web Nino 2011-11-14 16:39:26 +01:00
Jocelyn Fiat
0b7ea3c427 Added default WSF_APPLICATION for libfcgi connector 2011-11-14 16:27:55 +01:00
Jocelyn Fiat
1e7b370859 code removal 2011-11-14 16:26:31 +01:00
Jocelyn Fiat
8c02b0d546 Updated libfcgi source code for Windows AND Linux.
Cleaning some code and feature clauses.
2011-11-14 15:44:10 +01:00
Jocelyn Fiat
13b09adc8c Changed the WGI_INPUT_STREAM and WGI_OUTPUT_STREAM interfaces
main changes for existing code  `read_stream' is renamed `read_string'
2011-11-14 14:17:41 +01:00
Jocelyn Fiat
bc2e8b8ee2 Added is_request_method (STRING): BOOLEAN to help users 2011-11-09 18:07:03 +01:00
Jocelyn Fiat
36493b4324 updated readme with better way to get the source code recursively 2011-11-07 11:11:04 +01:00
Jocelyn Fiat
a09908c048 added script to build archive for download area 2011-11-07 01:22:14 -08:00
Jocelyn Fiat
d96ee66a32 sync with Eiffel Web Nino 2011-11-04 20:28:08 +01:00
Jocelyn Fiat
7669ccfc1d sync with nino and applied changes to connector 2011-11-04 20:21:35 +01:00
Jocelyn Fiat
3a6e3592ae Use recent changes from Nino, to get access to the launched and port information.
Quite useful when launching using port=0 to use a random free port.
This is great for testing, this way we can run many tests in the same time without any port blocking.
2011-11-04 12:15:40 +01:00
Jocelyn Fiat
07f9a8cec7 applied recent changes from Nino 2011-11-03 18:50:19 +01:00
Jocelyn Fiat
16cab53fb4 removed compliance on ewsgi, since now we target WSF
applied recent changes related to WSF_VALUE
2011-11-02 16:11:40 +01:00
Jocelyn Fiat
a2bf68e18a Safer interface for WSF_VALUE, when related to STRING value 2011-11-02 15:42:58 +01:00
Jocelyn Fiat
214255c4b9 sync with submodules 2011-11-02 13:30:35 +01:00
Jocelyn Fiat
082b8902ea Merge branch 'master' of git://github.com/Eiffel-World/Eiffel-Web-Framework 2011-11-02 13:11:09 +01:00
Jocelyn Fiat
ee9722fa18 renamed WSF_(.*)_VALUE as WSF_$1 2011-11-02 13:10:35 +01:00
Jocelyn Fiat
4a81d02d12 Fixed obsolete calls, and compilation error. 2011-10-31 18:42:44 +01:00
Jocelyn Fiat
0f5ae7e153 fixed path to cURL.ecf file, using the correct uppercase 2011-10-31 09:14:43 -07:00
Jocelyn Fiat
179dbceaba Fixed missing syntax="provisional" , this was preventing compiling with "across" statements 2011-10-31 16:06:10 +01:00
Jocelyn Fiat
45292e0248 Better implementation to get http header for http_client, and to get list of header entries by key,value 2011-10-31 16:05:34 +01:00
Jocelyn Fiat
a38fca267b Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework 2011-10-31 12:33:20 +01:00
Jocelyn Fiat
d4266a83ec updated instructions related to submodules 2011-10-31 02:43:44 -07:00
Jocelyn Fiat
83a181ebf1 Fixed remaining 6.8 vs 7.0 compilation issue related to UTF8_(URL_)ENCODER 2011-10-31 09:02:19 +01:00
Jocelyn Fiat
54ecd2b1e8 Merge branch 'master' of github.com:Eiffel-World/Eiffel-Web-Framework 2011-10-31 08:48:44 +01:00
Jocelyn Fiat
da8a216448 removed unused local variable 2011-10-31 08:48:19 +01:00
Jocelyn Fiat
085b520879 Added convenient features to BASE64
- decode_string_to_buffer (v: STRING; a_buffer: STRING)
   - decode_string_to_output_medium (v: STRING; a_output: IO_MEDIUM)
2011-10-31 08:45:50 +01:00
Jocelyn Fiat
c115a40922 removed unused local variable 2011-10-31 08:43:04 +01:00
Jocelyn Fiat
6f600362e3 Fixed code to be compilable with EiffelStudio 6.8 and 7.0 (due to recent change in UNICODE_CONVERSION) UNICODE_CONVERSION 2011-10-31 08:42:48 +01:00
jvelilla
bd36aa8b04 Added headers to response in HTTP_CLIENT_RESPONSE 2011-10-28 14:25:26 -03:00
Jocelyn Fiat
812f521c88 Merge branch 'master' of github.com:Eiffel-World/Eiffel-Web-Framework 2011-10-27 16:24:40 +02:00
Jocelyn Fiat
beb1bd1599 use '%/123/' syntax, to make sure no editor replace the accentued characters 2011-10-27 16:24:19 +02:00
Jocelyn Fiat
9bbcdc9927 removed unwanted .rc 2011-10-27 16:03:10 +02:00
Jocelyn Fiat
0d637d478a Fixed a previously character changes in WSF_REQUEST (related to safe_filename), and modified the implementation to use inspect
Fixed the request_content_type computation
Cosmetic in REQUEST_RESOURCE_HANDLER_HELPER
2011-10-27 16:00:33 +02:00
Jocelyn Fiat
8e4e7a5084 Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework
Conflicts:
	library/server/wsf/src/wsf_request.e
2011-10-27 15:49:12 +02:00
Jocelyn Fiat
95d44890d9 added script to update current git working copy and submodules recursively 2011-10-27 14:58:14 +02:00
Jocelyn Fiat
161a5c720b Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework 2011-10-27 14:45:37 +02:00
Jocelyn Fiat
35a4cd7df9 cosmetic, or minor changes 2011-10-27 14:45:14 +02:00
Jocelyn Fiat
70ee7ff47a Merge branch 'master' of github.com:Eiffel-World/Eiffel-Web-Framework 2011-10-27 14:43:32 +02:00
jvelilla
c9343688f3 Added eel and eapml in EWF libraries.
Removed them from gitmodule
2011-10-27 08:29:01 -03:00
jvelilla
f804a705d5 Updated request resource handler.
TODO: implement Content-Negotiation
2011-10-26 08:21:50 -03:00
Jocelyn Fiat
926c0a79b7 Start index for list[]=a&list[]=b ... from 1 instead of 0
Stick to Eiffel spirit
2011-10-24 17:44:13 +02:00
Jocelyn Fiat
fb7854fbcc Added visitor patterns to WSF_VALUE
Handling UTF-8 unencoding for WSF_VALUE ...
Added WSF_TABLE_VALUE to handle list[]=a&list[]=b ...

Library encoder: added UTF8 facilities
2011-10-24 17:23:36 +02:00
Jocelyn Fiat
663a39d2ec missing implementation (forgot to uncomment) 2011-10-24 09:07:26 +03:00
jvelilla
6fb36da9ac Merge remote-tracking branch 'jocelynEWF/master'
Conflicts:
	examples/restbucks/restbucks-safe.ecf
	examples/restbucks/src/resource/order_handler.e
	library/server/request/router/src/misc/request_resource_handler_helper.e
2011-10-23 20:58:28 -03:00
jvelilla
3fbd81aeb1 Added eel and eapml modules 2011-10-23 09:10:27 -03:00
jvelilla
6344f964fa Update delete method to hanlde method not allowed.
Added method not allowed to request resource handler helper class.
Update gitmodules
2011-10-23 09:05:12 -03:00
Jocelyn Fiat
14a2c01f41 Applied recent changes on WGI_ and WSF_
Moved classes away from ewsgi, restructured, cleaned
2011-10-21 16:58:23 +02:00
Jocelyn Fiat
79e12b8d04 Continued reducing WGI and move implementation to WSF (Web Server Framework)
Removed many usage of READABLE_STRING_GENERAL in favor to READABLE_STRING_8
   to avoid potential nasty issues in user's code
URI-template is working only with STRING_8, then changed any _GENERAL or _STRING_32 to _STRING_8
2011-10-21 16:58:18 +02:00
Jocelyn Fiat
aec0136739 First try to get a limited WGI_ and use WSF_ as default framework 2011-10-21 16:58:11 +02:00
jvelilla
9f53287226 Update Restbucks example: Conditional GET, PUT.
Added a response method to support resource not
modified.
Added a ETAG_UTILS class to calcule md5_digest.
Added ext libs eel and eapml.
2011-10-21 08:26:14 -03:00
Jocelyn Fiat
eaa99c9c61 Used object test 2011-10-19 00:40:04 +02:00
Jocelyn Fiat
5f492d6fb6 removed useless local variable 2011-10-19 00:35:32 +02:00
Jocelyn Fiat
c3f5376ef5 fixed cgi and libfcgi connectors due to recent changes from WGI_APPLICATION 2011-10-14 14:27:54 +02:00
Jocelyn Fiat
21e973f8a4 Removed handling of internal error from WGI_APPLICATION
And for now added it into nino connector
2011-10-14 14:15:23 +02:00
Jocelyn Fiat
dec1958909 Fixed issue with index in uri template matcher 2011-10-14 14:14:13 +02:00
Jocelyn Fiat
1453873b6c Added HTTP_FILE_EXTENSION_MIME_MAPPING
Added REQUEST_FILE_SYSTEM_HANDLER to the router library
Added file system handler in "hello_routed_world" example
2011-10-14 14:13:40 +02:00
jvelilla
8255dfd996 Added handle_resource_conflict_response feature to handle 409 reponse,
Cosmetic.
2011-10-13 09:07:37 -03:00
Jocelyn Fiat
fcdc164214 Added data and file for post and put request methods 2011-10-12 21:45:57 +02:00
Jocelyn Fiat
4c36d75ef3 Using Transfer-Encoding: chunked in example to send response progressively 2011-10-12 17:23:24 +02:00
Jocelyn Fiat
09030a27d9 sync with submodules 2011-10-12 17:22:46 +02:00
Jocelyn Fiat
b9ca22006b removed unwanted code 2011-10-12 15:38:45 +02:00
Jocelyn Fiat
593b48fe90 applied recent changes on HTTP_REQUEST_METHOD_CONSTANTS 2011-10-12 11:56:25 +02:00
Jocelyn Fiat
735730b5a0 cosmetic 2011-10-12 11:52:00 +02:00
Jocelyn Fiat
035a133b5b Addition to "http" library, separated constants into
- HTTP_MIME_TYPES
 - HTTP_HEADER_NAMES
 - HTTP_REQUEST_METHODS
 - HTTP_STATUS_CODE   (already exists)

Do not set the "Status" header when using WGI_RESPONSE_BUFFER.write_header (...)
Cosmetic
2011-10-12 11:51:49 +02:00
Jocelyn Fiat
0144e97d69 Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework
Conflicts:	examples/restbucks/src/domain/json_order_converter.e
Cosmetics
2011-10-11 14:25:22 +02:00
Jocelyn Fiat
26bfd72f5f Fixed errors recently introduced 2011-10-11 14:16:08 +02:00
Jocelyn Fiat
88542c2762 Merge branch 'master' of github.com:Eiffel-World/Eiffel-Web-Framework 2011-10-11 14:09:10 +02:00
Jocelyn Fiat
12fc54a403 sync with latest JSON 2011-10-11 14:08:41 +02:00
jvelilla
eb44eef885 Update order_handler, fix json_order_converter 2011-10-11 08:18:46 -03:00
Jocelyn Fiat
c2b66d6ca6 Use local curl if compiler is < 7.0.8.7340
otherwise, use ISE_LIBRARY cURL
2011-10-11 11:09:00 +02:00
Jocelyn Fiat
6758c4aef4 Temporary fixed issue of using modified cURL (which is cURL provided with EiffelStudio 7.0)
This changes will be reverted in the future
2011-10-11 10:46:56 +02:00
Jocelyn Fiat
6408bec628 Updated readme related to mirrored Eiffel cURL library 2011-10-10 17:56:09 +02:00
Jocelyn Fiat
f77ba9ccd8 added submodule ext/ise_library/curl to use the updated Eiffel cURL from ISE. 2011-10-10 17:48:18 +02:00
Jocelyn Fiat
c105c267e7 cosmetic 2011-10-10 16:09:44 +02:00
Jocelyn Fiat
19da4d6fd0 added http diagrams found on the web 2011-10-07 16:05:39 +02:00
Jocelyn Fiat
a9e2dc1135 Added the possibility to specify the supported content types
Added FIXME
2011-10-07 15:39:04 +02:00
Jocelyn Fiat
142dbc39b4 Cosmetic 2011-10-07 14:11:03 +02:00
Jocelyn Fiat
b17887d634 Added "Date:" helper feature in EWF_HEADER
Added license.lic to restbuck example, and mainly copyright to Javier
Use HTTP_STATUS_CODES
Minor improvements using object tests
Cosmetic (indentation, ..)
2011-10-07 14:03:31 +02:00
Jocelyn Fiat
f443087e71 Added a first simple test client to test the restbuck client 2011-10-06 19:09:56 +02:00
Jocelyn Fiat
e5eb11b4e7 added support for data in POST request 2011-10-06 19:09:17 +02:00
Jocelyn Fiat
720d8be08a Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework 2011-10-06 17:37:41 +02:00
jvelilla
ed04b7fba0 Added REQUEST_RESOURCE_HANDLER_HELPER class to contain
common http method behavior.
Updated ORDER_HANLDER to use this new class.
2011-10-06 09:54:20 -03:00
Jocelyn Fiat
4c9e7a4331 Added `base_url' for REQUEST_ROUTER (and descendants)
Fixed implementation of REST_REQUEST_AGENT_HANDLER to avoid wrong path in inherited routine.
Allow to build a URI_TEMPLATE from another URI TEMPLATE,
   this way, if later we have more attribute (status or settings) to URI_TEMPLATE,
   we'll be able to change the `template' without breaking the settings
2011-10-05 17:09:16 +02:00
Jocelyn Fiat
cc6992a6fc added missing call to pre_execute and post_execute 2011-10-05 14:47:59 +02:00
Jocelyn Fiat
71c851ca39 Fixed missing http:// in absolute URL 2011-10-05 14:47:30 +02:00
Jocelyn Fiat
900ed8baea remove pre_execute, and post_execute, and make process_request frozen
this way, the user won't be tempted to redefine feature not being part of pure EWSGI interface.
2011-10-05 14:46:39 +02:00
Jocelyn Fiat
dba55fcfd9 better argument name, to precise the timeout is in second
also in comment.
2011-10-05 14:45:47 +02:00
Jocelyn Fiat
456299ccdf Fixed agent handler for rest library 2011-10-04 17:33:15 +02:00
Jocelyn Fiat
810208f176 Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework 2011-10-04 16:19:36 +02:00
Jocelyn Fiat
27c637b066 fixed inheritance and precursor bad usage. 2011-10-04 16:19:09 +02:00
Jocelyn Fiat
a0df04a7f2 Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework 2011-10-04 09:50:14 +02:00
Jocelyn Fiat
bc5d20b221 Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework 2011-10-04 09:49:20 +02:00
jvelilla
7ba3eb9ecd Updated support for PUT. Now the example support
GET, POST, PUT, DELETE.
2011-10-03 09:26:01 -03:00
Jocelyn Fiat
2b14a40898 fixed compilation for ewsgi/tests/tests.ecf file 2011-09-28 17:08:28 +02:00
Jocelyn Fiat
aa20a1423f Made WGI_VALUE.name as READABLE_STRING_32 .. otherwise it is a pain to manipulate.
Changed return type of meta_variable to be WGI_STRING_VALUE ... since the meta variable can not be anything else.
Made sure REQUEST_URI starts with one and only one slash
Internal implementation: the _table now compares object
Removed SELF variable ... at least for now
Be sure to provide a REQUEST_URI even if the underlying connector does not.
2011-09-28 16:41:22 +02:00
Jocelyn Fiat
34c8cfa427 cleaned http_client configuration files 2011-09-28 14:53:34 +02:00
Jocelyn Fiat
f7dcadccd5 Added library/library.index 2011-09-28 14:42:53 +02:00
Jocelyn Fiat
f24df1d745 restructured ewsgi to avoid too many sub cluster 2011-09-28 14:42:34 +02:00
jvelilla
5adf40a9ed Updated Restbucks examples, handle not method allowed
in a better way, added the readme file.
2011-09-28 08:54:12 -03:00
jvelilla
f20bc42b76 Merge remote-tracking branch 'jocelynEWF/master' 2011-09-28 07:36:35 -03:00
Jocelyn Fiat
a4df57a7ac fixed compilation of rest example 2011-09-26 20:54:04 +02:00
Jocelyn Fiat
df59ae579b fixed typo 2011-09-26 17:19:37 +02:00
Jocelyn Fiat
738eb7555f Changed ITERATION_CURSOR [WGI_VALUE] into ITERABLE [WGI_VALUE] for WGI_REQUEST.*parameters* and similar
Applied recent changes on EWF_HEADER
2011-09-26 17:10:05 +02:00
Jocelyn Fiat
d397d4e35d Updated changelogs.txt
sync with nino and doc
2011-09-23 18:34:44 +02:00
Jocelyn Fiat
eeaa47d4f1 Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework 2011-09-23 18:23:35 +02:00
Jocelyn Fiat
0db4317a49 Added AutoTest simple cases for ewsgi using Nino web server 2011-09-23 18:22:42 +02:00
Jocelyn Fiat
668847f8e8 Fixing issue with experimental WGI_MULTIPLE_STRING_VALUE
Fixed issue with RAW_POST_DATA
2011-09-23 18:21:57 +02:00
Jocelyn Fiat
e7fd7af2c5 Removed put_redirection' and replaced by put_location'
Removed useless code in some features
2011-09-23 18:20:23 +02:00
Jocelyn Fiat
24a5c7613d Use READABLE_STRING(_*) instead of just STRING(_*) 2011-09-23 18:20:16 +02:00
Jocelyn Fiat
d9f6cbe80e Added feature to shutdown the Nino http server 2011-09-23 18:18:54 +02:00
Jocelyn Fiat
95ec2e77df Added error reporting in HTTP_CLIENT_RESPONSE
Added missing set_connect_timeout
2011-09-23 18:18:27 +02:00
jvelilla
19b5edd9b4 Added validations. 2011-09-23 09:06:23 -03:00
Jocelyn Fiat
d25146dd27 Merge branch 'master' of https://github.com/jvelilla/Eiffel-Web-Framework 2011-09-22 16:19:48 +02:00
Jocelyn Fiat
ab1c696837 Added code to create an HTTP_AUTHORIZATION from the client side as well.
So now we can either interpret an HTTP_AUTHORIZATION  or build one HTTP_AUTHORIZATION

So far , only Basic auth is supported.
2011-09-22 15:13:59 +02:00
Jocelyn Fiat
dae8e1d67d Made all libraries compilable in any mode (voidsafe or not)
Fixed related examples
2011-09-22 15:12:33 +02:00
jvelilla
888bc61522 Initial import, work in progress restbuck example. Only support create
a resource
2011-09-22 09:29:59 -03:00
jvelilla
8291905da1 Merge remote-tracking branch 'jocelynEWF/master' 2011-09-22 07:53:23 -03:00
Jocelyn Fiat
d9ba97d33b Fixed issue where Content-Type and Content-Length were translated into HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH instead of just
CONTENT_TYPE and CONTENT_LENGTH
2011-09-21 15:33:40 +02:00
Jocelyn Fiat
33eddd9197 better assertion to ensure `base' is a valid base url 2011-09-21 15:30:20 +02:00
Jocelyn Fiat
458cb56f75 synch with Nino 2011-09-21 15:29:25 +02:00
Jocelyn Fiat
88c015470e better return type for http client functions
added helper features
2011-09-21 15:29:12 +02:00
jvelilla
f68a713c48 Merge remote-tracking branch 'jocelynEWF/master' 2011-09-21 07:49:40 -03:00
Jocelyn Fiat
0414cd4501 fixed case sensitive path 2011-09-20 18:19:23 +02:00
Jocelyn Fiat
284d7826c8 missing -safe.ecf config file for http_client 2011-09-20 16:59:54 +02:00
Jocelyn Fiat
dff267cd58 Now using READABLE_STRING_... type 2011-09-20 16:57:28 +02:00
Jocelyn Fiat
c2f7c198e0 Added simple HTTP client.
For now the implementation is using Eiffel cURL library.
It requires Eiffel cURL coming with next EiffelStudio 7.0 (or from eiffelstudio's repo from rev#87244 )
2011-09-20 16:55:44 +02:00
Jocelyn Fiat
b3ef7c846b Fixed issues in WGI_REQUEST's invariant
Fixed issues with guessing the default format for REST handling
Fixed issue with .._ROUTING_.. component.
2011-09-16 20:59:06 +02:00
Jocelyn Fiat
111812c4e9 Fixed issue with uri template router ..
it was applying on request_uri instead of path_info
now it match on PATH_INFO
2011-09-16 18:56:02 +02:00
Jocelyn Fiat
92d8357d09 more flexible authenticated query .. on handler, and not anymore on context object 2011-09-16 18:55:26 +02:00
Jocelyn Fiat
64060cfa41 fixed wrong order in parameter for callers of set_meta_string_variable 2011-09-16 18:54:44 +02:00
Jocelyn Fiat
d3239ec41b added debug_output to WGI_VALUE 2011-09-16 18:54:16 +02:00
Jocelyn Fiat
7b1557a52a first version of http authorization ..
for now, only basic digest
2011-09-16 18:53:57 +02:00
Jocelyn Fiat
c9a4ebcb23 added request_handler_routes_recorder to provide an implementation for `REQUEST_HANDLER.on_handler_mapped' 2011-09-16 15:17:49 +02:00
Jocelyn Fiat
3f899f6aae Added "on_handler_mapped" callback
to allow any REQUEST_HANDLER to record the existing routes.
2011-09-16 15:11:37 +02:00
Jocelyn Fiat
18684d167b typo 2011-09-16 15:02:08 +02:00
jvelilla
32bb75b9dc Merge remote-tracking branch 'jocelynEWF/master' 2011-09-16 07:04:40 -03:00
Jocelyn Fiat
d06bc76944 minor enhancement of error lib 2011-09-15 22:02:58 +02:00
Jocelyn Fiat
86825854ca Added WGI_MULTIPLE_STRING_VALUE
Renamed value as WGI_STRING_VALUE.string
Renamed a few classes .._CONTEXT_I  as .._CONTEXT
updated example.
2011-09-15 17:49:47 +02:00
Jocelyn Fiat
774cd004db cosmetic 2011-09-15 15:49:53 +02:00
Jocelyn Fiat
c300cf5b6e Merge branch 'master' of git://github.com/Eiffel-World/Eiffel-Web-Framework 2011-09-15 11:17:07 +02:00
Jocelyn Fiat
68247a1849 updated README.md 2011-09-15 10:55:14 +02:00
Jocelyn Fiat
22fd7490fe Simplified interface of "router" library classes 2011-09-14 16:48:27 +02:00
Jocelyn Fiat
8b6e9273fa applied renaming for rest and router lib 2011-09-14 16:05:01 +02:00
Jocelyn Fiat
76fa3e9ff5 Reorganized library "server/request/rest" 2011-09-14 15:46:45 +02:00
Jocelyn Fiat
1e3770d724 some renaming to use _I for the generic classes, and removed the DEFAULT_ prefix for default implementation
this should makes things easier for new users
2011-09-14 15:39:37 +02:00
Jocelyn Fiat
840ae1e6e4 reorganized router library 2011-09-14 15:04:29 +02:00
Jocelyn Fiat
5626e03aa8 - Adopted deferred WGI_VALUE design for Result type of *_parameter and similar functions
- Adopted the ITERATION_CURSOR [WGI_VALUE] design for *_parameters and similar functions
- renamed parameter as item
- provided helper function to handle "string" value parameters

Experimental for now.
2011-09-14 14:54:06 +02:00
Jocelyn Fiat
4bcea900a6 better result type (using READABLE_..) 2011-09-14 14:48:08 +02:00
Jocelyn Fiat
b1f5065e63 sync with nino 2011-09-14 14:47:29 +02:00
jvelilla
c37fe9ad79 Merge remote-tracking branch 'jocelynEWF/master' 2011-09-14 07:58:40 -03:00
Jocelyn Fiat
2e53f7e0c4 updated changelogs 2011-09-13 17:12:12 +02:00
Jocelyn Fiat
512f2d2ce5 Added first draft for RESTful library
note: the interfaces are likely to change in the future
2011-09-13 17:08:40 +02:00
Jocelyn Fiat
92105ca7b3 updated config file and examples 2011-09-13 17:07:17 +02:00
Jocelyn Fiat
f0c6eec23d adding routing handler
few renaming
2011-09-13 16:49:45 +02:00
Jocelyn Fiat
32197d0513 changing design to use generic instead of anchor types 2011-09-09 16:24:11 +02:00
Jocelyn Fiat
11286eeeef make router more easy to inherit from and specialized 2011-09-09 14:10:54 +02:00
Jocelyn Fiat
fb8412fcae Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework 2011-09-09 08:54:20 +02:00
Jocelyn Fiat
9ec87a4329 Added support during match for {/vars}
and also handle cases such as   /foo.{format}{/vars}  or /foo.{format}{?vars} where no literal exists between the uri template expressions
2011-09-09 08:51:45 +02:00
Jocelyn Fiat
0c7e6c08e7 better type for argument and result (using READABLE_...) 2011-09-09 08:50:29 +02:00
Jocelyn Fiat
c1120a4226 change to standard default values 2011-09-09 08:50:05 +02:00
jvelilla
5c0cae35ef Sync to jocelyn EWF master 2011-09-08 07:45:10 -03:00
jvelilla
7bd5cdc232 Merge remote-tracking branch 'jocelynEWF/master' 2011-09-08 07:44:27 -03:00
jvelilla
ef85c07603 Update 2011-09-08 07:43:36 -03:00
Jocelyn Fiat
10db3c28a5 sync doc/wiki 2011-09-07 14:31:52 +02:00
Jocelyn Fiat
54dc7de189 use `resource' as generic name for uri or uri_template 2011-09-07 12:46:09 +02:00
Jocelyn Fiat
2244d101ea added changelogs.txt 2011-09-07 12:22:11 +02:00
Jocelyn Fiat
244fdf1b02 Added request methods criteria for the router component.
Now one can decide

map_agent_with_request_methods ("/foo/bar/{bar_id}", agent handle_foo_bar, <<"GET">>)
(and similar for non agent way)
This might be useful in pure RESTful environment.
2011-09-07 12:14:03 +02:00
Jocelyn Fiat
3c9fce293f fixed example .. where we forgot to set the status, and send the header
(DbC helped here)
2011-09-07 12:10:48 +02:00
Jocelyn Fiat
eee085dd5a renamed (un)set_meta_parameter as (un)set_meta_variable 2011-09-07 11:42:53 +02:00
Jocelyn Fiat
2d9e2d12a0 Missing HTTP_ prefix for header meta variable in REQUEST 2011-09-07 11:42:02 +02:00
Jocelyn Fiat
6a581f6d62 Changed prefix from EWSGI_ to WGI_
Changed meta variable type to READABLE_STRING_32
2011-08-30 19:20:42 +02:00
Jocelyn Fiat
ed8f5d694f naming: meta_variable(s)
changed some string type to READABLE_STRING_32
or READABLE_STRING_8 for now regarding Meta variables (need decision here..)
2011-08-29 12:48:03 +02:00
Jocelyn Fiat
c20600f281 changed prefix GW_ into EWF_ for EiffelWebFramework
use READABLE_STRING_GENERAL instead of just STRING
2011-08-25 16:00:18 +02:00
Jocelyn Fiat
53ccaa3fde sync wiki doc 2011-08-25 14:48:30 +02:00
Jocelyn Fiat
22afbd7ed0 Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework
Conflicts:
	library/server/ewsgi/connectors/nino/src/gw_nino_connector.e
	library/server/ewsgi/ewsgi-safe.ecf
2011-08-25 14:48:02 +02:00
Jocelyn Fiat
f6b362217c Merged REQUEST and ENVIRONMENT into REQUEST
renamed ENVIRONMENT_NAMES into META_NAMES
better usage of READABLE_STRING_GENERAL, and other strings
abstract RESPONSE_BUFFER in implementation of EWSGI
for the implementation, inheriting from deferred specification (more to come later)
2011-08-25 14:41:35 +02:00
Jocelyn Fiat
e9ccf855b3 Merged REQUEST and ENVIRONMENT into REQUEST
renamed ENVIRONMENT_NAMES into META_NAMES
better usage of READABLE_STRING_GENERAL, and other strings
for the implementation, inheriting from deferred specification (more to come later)
2011-08-25 12:33:20 +02:00
Jocelyn Fiat
4d0148d562 fixing wrong feature usage 2011-08-24 15:54:01 +02:00
Jocelyn Fiat
ec6cc5f2b8 code cleaning, and prepare for internal review 2011-08-18 12:25:40 +02:00
Jocelyn Fiat
40018d36eb enhanced the ERROR_HANDLER 2011-08-04 15:11:51 +02:00
Jocelyn Fiat
8e18329063 minor improvements on response_as_result code 2011-08-02 14:53:37 +02:00
Jocelyn Fiat
c372494713 cosmetic in config file .ecf 2011-08-02 10:47:16 +02:00
Jocelyn Fiat
10f4a99ee1 add "write_headers_string" to RESPONSE_BUFFER 2011-08-02 10:46:53 +02:00
Jocelyn Fiat
e9085c614c sync wiki 2011-08-01 17:02:33 +02:00
Jocelyn Fiat
f7d3f519a7 moved ewsgi-full config file under tests (this is mainly for dev purpose, to be able to compile and edit all classes related to ewsgi) 2011-08-01 16:47:00 +02:00
Jocelyn Fiat
4eb22d0272 Tried to reduce gap between both EWSGI proposals
Re-adapt the Spec-compliant solution (instead of Lib-compliant solution).
  Thus no more 100% deferred interface.
Rename EWSGI_RESPONSE into EWSGI_RESPONSE_BUFFER
Added in extra/response-as-result/  an copy/paste from the implementation of Paul's proposal (not up to date with Paul's spec). But this is mainly for information and tests.
Removed part of the ewsgi/specification interfaces ... to be able to test EWSGI compliant library against the pure specification (experimental).
Renamed most of the GW_... into EWSGI_...
2011-08-01 16:41:16 +02:00
Jocelyn Fiat
bbcc9ef44b added http_accept feature to represent "Accept:" HTTP header 2011-07-29 15:13:34 +02:00
Jocelyn Fiat
801caa4e69 added hello_routed_world example
few changes on new `router' library (still in-progress)
2011-07-29 15:13:08 +02:00
Jocelyn Fiat
1b49445077 Added first draft for a URI and/or URI-template base request router. 2011-07-29 10:51:22 +02:00
Jocelyn Fiat
f005d8bb06 cosmetic 2011-07-29 10:50:31 +02:00
Jocelyn Fiat
a278537f7b Added "flush" to the EWSGI_RESPONSE_STREAM 2011-07-29 10:50:24 +02:00
Jocelyn Fiat
78b5b6f5fe Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework 2011-07-29 08:52:57 +02:00
Jocelyn Fiat
a215c1e4d2 added missing non-void-safe .ecf 2011-07-29 08:52:36 +02:00
Jocelyn Fiat
fe3726677b added missing non-void-safe .ecf 2011-07-29 08:45:26 +02:00
Jocelyn Fiat
94d4909644 Fixed various issue with URI template, added corresponding tests 2011-07-28 18:45:25 +02:00
639 changed files with 79220 additions and 4715 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,4 @@
EIFGENs
tests/temp/
.svn/
*.swp

17
.gitmodules vendored
View File

@@ -1,9 +1,12 @@
[submodule "doc/wiki"]
path = doc/wiki
url = https://github.com/Eiffel-World/Eiffel-Web-Framework.wiki.git
[submodule "ext/server/nino"]
path = ext/server/nino
url = http://github.com/Eiffel-World/EiffelWebNino.git
[submodule "ext/text/json"]
path = ext/text/json
url = http://github.com/Eiffel-World/ejson-svn.git
url = https://github.com/EiffelWebFramework/EWF.wiki.git
[submodule "contrib/library/server/nino"]
path = contrib/library/server/nino
url = https://github.com/Eiffel-World/EiffelWebNino.git
[submodule "contrib/library/text/parser/json"]
path = contrib/library/text/parser/json
url = https://github.com/Eiffel-World/json.git
[submodule "contrib/ise_library/cURL"]
path = contrib/ise_library/cURL
url = https://github.com/EiffelSoftware/mirror-Eiffel-cURL.git

38
CHANGELOGS.txt Normal file
View File

@@ -0,0 +1,38 @@
History for Eiffel-Web-Framework
[2011-09-23] Jocelyn
* library "ewsgi":
- NEW simple autotest cases using Nino web server
-fixed issue with RAW_POST_DATA being added in form_data_parameters
instead of meta_variables ...
- Implemented WGI_VALUE for parameter's type (query_parameter,
form_data_parameter, item ...)
* Nino connector: added feature to shutdown the server from the WGI application
* NEW library "http_client": a new library to perform simple http requests
such as get, head, post, put, ... (currently implemented with Eiffel cURL)
* NEW library "http_authorization": added simple library to support
HTTP_AUTHORIZATION. For now only "Basic" auth type is supported ..
[2011-09-22] Javier
* NEW Example: added partial Restbuck example
[2011-09-21] Jocelyn
* Nino connector: fixed an issue with missing value for Content-Type and Content-Length
[2011-09-13] Jocelyn
* library "router": now using a generic design to allow customization of
request handler context class.
* NEW library "server/request/rest": first attempt to provide a library to
help building RESTful application (the interfaces are likely to change
soon) EXPERIMENTAL
[2011-09-09] Jocelyn
* library "uri-template": better support for {/vars} and {?vars}
[2011-09-07] Jocelyn
* library "router": now routing depends on uri (or uri template) and request methods
* Nino connector: Fixed issue where HTTP_ prefix were missing for header meta variable.
[2011-09-07] Jocelyn
* changelog: starting to write down changelogs file

1218
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

1
README
View File

@@ -1 +0,0 @@
README.md

View File

@@ -1,30 +1,80 @@
# Eiffel Web Framework
## Overview
Official project site for Eiffel Web Framework:
* https://github.com/Eiffel-World/Eiffel-Web-Framework
* http://eiffelwebframework.github.com/EWF/
For more information please have a look at the related wiki:
* https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki
How to get the source code?
---------------------------
* https://github.com/EiffelWebFramework/EWF/wiki
git clone https://github.com/Eiffel-World/Eiffel-Web-Framework.git
cd Eiffel-Web-Framework
git submodule update --init
git submodule foreach git pull origin master
git submodule foreach git checkout master
## Requirements
Overview
--------
* Developped using EiffelStudio 7.0 (on Windows, Linux)
* Tested using EiffelStudio 7.0 with "jenkins" CI server (and v6.8 for time to time)
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](http://docs.eiffel.com/book/method/void-safe-programming-eiffel) )
* library/server/ewsgi: Eiffel Web Server Gateway Interface
* library/server/ewsgi/connectors: various web server connectors for EWSGI
* library/server/libfcgi: Wrapper for libfcgi SDK
## How to get the source code?
* library/protocol/http: HTTP related classes, constants for status code, content types, ...
* library/protocol/uri_template: URI Template library (parsing and expander)
Using git version >= 1.6.5
* git clone --recursive https://github.com/EiffelWebFramework/EWF.git
Otherwise, try
* git clone https://github.com/EiffelWebFramework/EWF.git
* cd Eiffel-Web-Framework
* git submodule update --init
* git submodule foreach --recursive git checkout master
An alternative to the last 2 instructions is to use the script from tools folder:
* cd tools
* update_git_working_copy
* And to build the required and related Clibs
* cd contrib/ise_library/cURL
* geant compile
## Libraries under 'library'
### server
* __ewsgi__: Eiffel Web Server Gateway Interface [read more](library/server/ewsgi)
* connectors: various web server connectors for EWSGI
* libfcgi: Wrapper for libfcgi SDK
* __wsf__: Web Server Framework [read more](library/server/wsf)
* __router__: URL dispatching/routing based on uri, uri_template, or custom [read more](library/server/wsf/router)
### protocol
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/protocol/http)
* __uri_template__: URI Template library (parsing and expander) [read more](library/protocol/uri_template)
* __CONNEG__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
### client
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
### text
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
### crypto
* eel
* eapml
### Others
* error: very simple/basic library to handle error
## External libraries under 'contrib'
* [Eiffel Web Nino](contrib/library/server/nino)
* ..
## Draft folder = call for contribution ##
### library/server/request ###
* request
* rest: (experimental) "a" RESTful library to help building RESTful services
## Examples
..
* library/error: very simple/basic library to handle error
* library/text/encoder: Various simpler encoder: base64, url-encoder, xml entities, html entities
For more information please have a look at the related wiki:
* https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki
* https://github.com/EiffelWebFramework/EWF/wiki

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>cURL: libcURL wrapper library for Eiffel.
Copyright (c) 1984-2006, Eiffel Software and others.
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ECF_CONFIG_PATH)\curl\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ECF_CONFIG_PATH)/curl/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ECF_CONFIG_PATH)/curl/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)/curl/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<cluster name="curl" location=".\" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/gtk$</exclude>
<condition>
<platform value="macintosh"/>
<custom name="vision_implementation" value="cocoa"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform excluded_value="windows"/>
<custom name="vision_implementation" excluded_value="cocoa"/>
</condition>
</file_rule>
</cluster>
</target>
<target name="curl_dotnet" extends="curl">
<setting name="msil_generation" value="true"/>
</target>
</system>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>cURL: libcURL wrapper library for Eiffel.
Copyright (c) 1984-2006, Eiffel Software and others.
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ECF_CONFIG_PATH}\curl\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ECF_CONFIG_PATH}/curl/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ECF_CONFIG_PATH}/curl/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH}/curl/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH}\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH}\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH}\curl\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<cluster name="curl" location=".\" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/gtk$</exclude>
<condition>
<platform value="macintosh"/>
<custom name="vision_implementation" value="cocoa"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform excluded_value="windows"/>
<custom name="vision_implementation" excluded_value="cocoa"/>
</condition>
</file_rule>
</cluster>
</target>
<target name="curl_dotnet" extends="curl">
<setting name="msil_generation" value="true"/>
</target>
</system>

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

25
draft/README.md Normal file
View File

@@ -0,0 +1,25 @@
This "draft" folder contains potential addition to EWF
Anyone wanting to contribute is welcome to the listed libraries, or by suggesting/contributing with extra libraries
## Current suggestions ##
### protocol ###
* web syndication [__Atom__](library/protocol/syndication/atom)
* web syndication [__RSS__](library/protocol/syndication/rss)
* [__Twitter__](library/protocol/twitter)
* [__XMPP__](library/protocol/xmpp) (also known as Jabber)
### Security ###
* [__OAuth__](library/security/oauth)
* [__OpenID__](library/security/openid)
### Text ###
* [__Filters__](library/text/filter) : Wiki markup, Markdown, ...
* [__Templates__](library/text/template) : Web template engine ...
### ... ###
Any contribution is welcome, help us make Eiffel Web Framework bigger, richer and better.

View File

@@ -0,0 +1,9 @@
Web Syndication
http://en.wikipedia.org/wiki/Web_syndication
* [Atom Pub](atom)
* [RSS](rss)
* ...
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,10 @@
Atom protocol
http://en.wikipedia.org/wiki/Atom_(standard)
Atom standard
* [RFC 4287](http://tools.ietf.org/html/rfc4287) "The Atom Syndication Format"
* [RFC 5023](http://tools.ietf.org/html/rfc5023) "The Atom Publishing Protocol"
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="atom" uuid="076DEABB-20DA-43E9-A4C7-F3FAEDF5B1FC" library_target="atom">
<target name="atom">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="atom" uuid="076DEABB-20DA-43E9-A4C7-F3FAEDF5B1FC" library_target="atom">
<target name="atom">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,22 @@
note
description: "[
Main interface for ATOM interface
]"
date: "$Date$"
revision: "$Revision$"
class
ATOM
create
make
feature {NONE} -- Initialization
make
-- Instantiate Current object
do
check not_yet_implemented: False end
end
end

View File

@@ -0,0 +1,7 @@
RSS protocol
http://en.wikipedia.org/wiki/RSS
* [RSS specification](http://www.rssboard.org/rss-specification)
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rss" uuid="8D8E3E5A-2685-40AF-9EF9-E3113B3C62AA" library_target="rss">
<target name="rss">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rss" uuid="8D8E3E5A-2685-40AF-9EF9-E3113B3C62AA" library_target="rss">
<target name="rss">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,22 @@
note
description: "[
Main interface for RSS interface
]"
date: "$Date$"
revision: "$Revision$"
class
RSS
create
make
feature {NONE} -- Initialization
make
-- Instantiate Current object
do
check not_yet_implemented: False end
end
end

View File

@@ -0,0 +1,6 @@
Twitter protocol
http://en.wikipedia.org/wiki/Twitter
Eventually move http://bricabrac.origo.ethz.ch/wiki/Eiffel_Twitter here
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,6 @@
XMPP/Jabber protocol
http://en.wikipedia.org/wiki/Xmpp
Eventually move http://bricabrac.origo.ethz.ch/wiki/Eiffel_XMPP here
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,7 @@
OAuth
http://en.wikipedia.org/wiki/Oauth
* [RFC5849](http://tools.ietf.org/html/rfc5849)
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="oauth" uuid="F8B4DF74-C71B-45A3-9B9A-F6141C4D3C56" library_target="oauth">
<target name="oauth">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="oauth" uuid="F8B4DF74-C71B-45A3-9B9A-F6141C4D3C56" library_target="oauth">
<target name="oauth">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,22 @@
note
description: "[
Main interface for OAUTH interface
]"
date: "$Date$"
revision: "$Revision$"
class
OAUTH
create
make
feature {NONE} -- Initialization
make
-- Instantiate Current object
do
check not_yet_implemented: False end
end
end

View File

@@ -0,0 +1,5 @@
OpenID
http://en.wikipedia.org/wiki/Openid
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="openid" uuid="E6B80EAB-AC99-46F5-9896-4892D3477A9A" library_target="openid">
<target name="openid">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="openid" uuid="E6B80EAB-AC99-46F5-9896-4892D3477A9A" library_target="openid">
<target name="openid">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,22 @@
note
description: "[
Main interface for OPENID interface
]"
date: "$Date$"
revision: "$Revision$"
class
OPENID
create
make
feature {NONE} -- Initialization
make
-- Instantiate Current object
do
check not_yet_implemented: False end
end
end

View File

@@ -0,0 +1 @@
reference:forum2

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rest" uuid="97FA9457-7820-4A21-8A13-C8D0E9CCEC62" library_target="rest">
<target name="rest">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="wsf" location="..\..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
<library name="wsf_extension" location="..\..\..\..\..\library\server\wsf_extension\wsf_extension-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\..\library\protocol\http\http-safe.ecf"/>
<library name="uri_template" location="..\..\..\..\..\library\protocol\uri_template\uri_template-safe.ecf"/>
<cluster name="contrib" location=".\src\contrib\" recursive="true">
<file_rule>
<exclude>/html$</exclude>
</file_rule>
<cluster name="html" location="$|doc\html\" recursive="true" hidden="true"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/contrib$</exclude>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="rest" uuid="97FA9457-7820-4A21-8A13-C8D0E9CCEC62" library_target="rest">
<target name="rest">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="wsf" location="..\..\..\..\..\library\server\wsf\wsf.ecf"/>
<library name="wsf_extension" location="..\..\..\..\..\library\server\wsf_extension\wsf_extension.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\..\library\protocol\http\http.ecf"/>
<library name="uri_template" location="..\..\..\..\..\library\protocol\uri_template\uri_template.ecf"/>
<cluster name="contrib" location=".\src\contrib\" recursive="true">
<file_rule>
<exclude>/html$</exclude>
</file_rule>
<cluster name="html" location="$|doc\html\" recursive="true" hidden="true"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/contrib$</exclude>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -0,0 +1,184 @@
note
description: "Summary description for {HTML_PAGE}."
date: "$Date$"
revision: "$Revision$"
class
HTML_PAGE
inherit
HTML_UTILITIES
create
make
feature {NONE} -- Initialization
make (a_title: like title)
do
create {ARRAYED_LIST [like html_attributes.item]} html_attributes.make (0)
create head.make (a_title)
create {ARRAYED_LIST [like body_attributes.item]} body_attributes.make (0)
create body.make_empty
initialize
end
initialize
-- Initialize
do
create headers.make
end
feature -- Access
headers: HTTP_HEADER
feature -- Recycle
recycle
do
html_attributes.wipe_out
headers.recycle
head.recycle
body_attributes.wipe_out
body.wipe_out
internal_header_string := Void
internal_message_string := Void
end
feature -- Access
html_attributes: LIST [TUPLE [name: STRING; value: STRING]]
head: HTML_PAGE_HEAD
body_attributes: LIST [TUPLE [name: STRING; value: STRING]]
body: STRING
feature -- Query
title: detachable STRING
do
Result := head.title
end
add_html_ttribute (a: like html_attributes.item)
do
html_attributes.force (a)
end
add_body_attribute (a: like body_attributes.item)
do
body_attributes.force (a)
end
set_body (s: like body)
-- Set `body' to `s'
do
body := s
end
feature -- Element change
set_title (t: like title)
do
head.title := t
end
feature -- Output
compute
-- Compute the string output
local
s, t: STRING
do
--| HTML beginning
create s.make (128)
s.append_string ("<html")
s.append_string (attributes_to_string (html_attributes))
s.append_string (">%N")
--| Head
head.compute --| Be sure to have a fresh string
t := head.string
if not t.is_empty then
s.append_string (t)
s.append_character ('%N')
end
--| Body
s.append_string ("<body")
s.append_string (attributes_to_string (body_attributes))
s.append_string (">%N")
s.append_string (body)
s.append_string ("</body>")
--| End
s.append_string ("</html>")
--| Http headers
headers.put_content_length (s.count)
internal_header_string := headers.string
internal_message_string := s
end
header_string: STRING
local
o: like internal_header_string
do
o := internal_header_string
if o = Void then
compute
o := internal_header_string
if o = Void then
check output_computed: False end
create o.make_empty
end
end
Result := o
end
message_string: STRING
local
o: like internal_message_string
do
o := internal_message_string
if o = Void then
compute
o := internal_message_string
if o = Void then
check output_computed: False end
create o.make_empty
end
end
Result := o
end
send (buf: WSF_RESPONSE)
do
buf.set_status_code (200)
buf.put_header_text (header_string)
buf.put_string (message_string)
end
feature {NONE} -- Implementation: output
internal_header_string: detachable like header_string
internal_message_string: detachable like message_string
invariant
header_attached: headers /= Void
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,111 @@
note
description: "Summary description for {HTML_PAGE_HEAD}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HTML_PAGE_HEAD
inherit
HTML_UTILITIES
create
make
feature {NONE} -- Initialization
make (a_title: like title)
do
initialize
title := a_title
end
initialize
do
create text.make_empty
create {ARRAYED_LIST [like attributes.item]} attributes.make (0)
end
feature -- Recycle
recycle
do
attributes.wipe_out
title := Void
text.wipe_out
internal_string := Void
end
feature -- Access
attributes: LIST [TUPLE [name: STRING; value: STRING]]
title: detachable STRING assign set_title
text: STRING
feature -- Element change
set_title (t: like title)
do
title := t
end
feature -- Output
compute
-- Compute the string output
local
s: STRING
do
create s.make_empty
if attached title as t then
s.append_string ("<title>" + t + "</title>%N")
end
if text.count > 0 then
s.append_string (text)
s.append_character ('%N')
end
if s.count > 0 then
internal_string := "<head" + attributes_to_string (attributes) + ">%N" + s + "</head>"
else
internal_string := s
end
end
string: STRING
--
local
o: like internal_string
do
o := internal_string
if o = Void then
compute
o := internal_string
if o = Void then
check output_computed: False end
create o.make_empty
end
end
Result := o
end
feature {NONE} -- Implementation: output
internal_string: detachable like string
invariant
text_attached: text /= Void
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,90 @@
note
description: "Summary description for {HTML_UTILITIES}."
date: "$Date$"
revision: "$Revision$"
class
HTML_UTILITIES
feature -- Encoding
html_special_chars_encoded_string (s: STRING): STRING
local
c: CHARACTER
i,n: INTEGER
do
from
i := 1
n := s.count
create Result.make (n + 10)
until
i > n
loop
c := s[i]
inspect c
when '&' then
Result.append_string ("&amp;")
when '%"' then
Result.append_string ("&quot;")
when '%'' then
Result.append_string ("&#039;")
when '<' then
Result.append_string ("&lt;")
when '>' then
Result.append_string ("&gt;")
else
Result.extend (c)
end
i := i + 1
end
end
feature -- Helpers
strings_to_string (lst: LIST [STRING]; sep: STRING): STRING
do
create Result.make_empty
if lst.count > 0 then
from
lst.start
until
lst.after
loop
Result.append_string (lst.item)
Result.append_string (sep)
lst.forth
end
end
end
attributes_to_string (atts: LIST [TUPLE [name: STRING; value: STRING]]): STRING
do
create Result.make_empty
if atts.count > 0 then
from
atts.start
until
atts.after
loop
Result.append_character (' ')
Result.append_string (atts.item.name)
Result.append_character ('=')
Result.append_character ('%"')
Result.append_string (html_special_chars_encoded_string (atts.item.value))
Result.append_character ('%"')
atts.forth
end
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,327 @@
note
description: "Summary description for {REST_API_DOCUMENTATION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_API_DOCUMENTATION [C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
REST_REQUEST_HANDLER [C]
create
make
feature {NONE} -- Initialization
make (a_router: like router; a_base_doc_url: like base_doc_url)
do
router := a_router
base_doc_url := a_base_doc_url
description := "Technical documention for the API"
end
feature {NONE} -- Access: Implementation
router: REST_REQUEST_ROUTER [REST_REQUEST_HANDLER [C], C]
base_doc_url: READABLE_STRING_8
feature -- Access
authentication_required (req: WSF_REQUEST): BOOLEAN
do
end
resource_value (ctx: C): detachable READABLE_STRING_32
do
if attached {WSF_STRING} ctx.item ("resource") as s then
Result := s.string
end
end
feature -- Execution
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
rep: like new_html_page
s: STRING
rq: detachable REST_REQUEST_HANDLER [C]
rq_resource: detachable READABLE_STRING_GENERAL
-- l_dft_format_name: detachable STRING
hdl_cursor: like router.new_cursor
do
rep := new_html_page
rep.headers.put_content_type_text_html
create s.make_empty
if
attached resource_value (ctx) as l_resource
then
from
hdl_cursor := router.new_cursor
until
hdl_cursor.after or rq /= Void
loop
if hdl_cursor.item.resource.same_string_general (l_resource) then
rq := hdl_cursor.item.handler
rq_resource := l_resource
end
hdl_cursor.forth
end
end
-- if a_args /= Void and then not a_args.is_empty then
-- rq := router.handler_by_path (a_args)
-- if rq = Void then
-- rq := handler_manager.smart_handler_by_path (a_args)
---- if attached {REST_REQUEST_GROUP_HANDLER} rq as grp then
---- rq := grp.handlers.handler_by_path (a_args)
---- end
-- end
-- if
-- rq /= Void and then
-- attached rq.path_information (a_args) as l_info
-- then
-- l_dft_format_name := l_info.format
-- end
-- end
if rq /= Void and then rq_resource /= Void then
rep.set_big_title ("API: Technical documentation for ["+ rq_resource.as_string_8 +"]")
s.append_string ("<div class=%"api%">")
s.append_string ("<h2 class=%"api-name%" >")
s.append_string ("<a href=%"" + base_doc_url + "%">.. Show all features ..</a>")
s.append_string ("</h2></div>%N")
process_request_handler_doc (rq, rq_resource.as_string_8, s, ctx, req, res, Void)
else
rep.set_big_title ("API: Technical documentation")
from
hdl_cursor := router.new_cursor
until
hdl_cursor.after
loop
if attached hdl_cursor.item as l_item then
rq := l_item.handler
rep.add_shortcut (l_item.resource)
s.append ("<a name=%"" + rep.last_added_shortcut + "%"/>")
process_request_handler_doc (rq, l_item.resource, s, ctx, req, res, Void)
hdl_cursor.forth
end
end
end
rep.set_body (s)
rep.send (res)
rep.recycle
end
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; a_dft_format: detachable STRING)
local
l_dft_format_name: detachable STRING
s: STRING
l_uri_tpl: URI_TEMPLATE
do
s := buf
if a_dft_format /= Void then
if rq.supported_format_names.has (a_dft_format) then
l_dft_format_name := a_dft_format
end
end
s.append_string ("<div class=%"api%">")
s.append_string ("<h2 class=%"api-name%" ><a href=%""+ url (req, base_doc_url, a_resource, False) +"%">"+ a_resource +"</a></h2>")
s.append_string ("<div class=%"inner%">")
-- if rq.hidden (req) then
-- s.append_string ("<div class=%"api-description%">This feature is hidden</div>%N")
-- else
if attached rq.description as desc then
s.append_string ("<div class=%"api-description%">" + desc + "</div>")
end
-- if attached {REST_REQUEST_GROUP_HANDLER} rq as grp then
-- s.append_string ("<div class=%"api-format%">Handler: <strong>")
-- if attached grp.handlers.new_cursor as l_handlers_cursor then
-- from
-- until
-- l_handlers_cursor.after
-- loop
-- s.append_string (" ")
-- s.append_string ("<a class=%"api-handler%" href=%"")
-- s.append_string (url (ctx, l_handlers_cursor.item.path, False))
-- s.append_string ("%">"+ l_handlers_cursor.item.path +"</a>")
-- l_handlers_cursor.forth
-- end
-- end
-- s.append_string ("</strong></div>")
-- end
if attached rq.supported_format_names as l_formats and then not l_formats.is_empty then
s.append_string ("<div class=%"api-format%">Supported formats: <strong>")
if attached l_formats.new_cursor as l_formats_cursor then
from
until
l_formats_cursor.after
loop
s.append_string (" ")
s.append_string ("<a class=%"api-name api-format")
if l_formats_cursor.item ~ l_dft_format_name then
s.append_string (" selected")
end
s.append_string ("%" href=%"" + url (req, base_doc_url, a_resource, False) + "." + l_formats_cursor.item + "%">"+ l_formats_cursor.item +"</a>")
l_formats_cursor.forth
end
end
s.append_string ("</strong></div>")
end
if attached rq.supported_request_method_names as l_methods and then not l_methods.is_empty then
s.append_string ("<div class=%"api-method%">Supported request methods: <strong>")
if attached l_methods.new_cursor as l_methods_cursor then
from
until
l_methods_cursor.after
loop
s.append_string (" ")
s.append_string (l_methods_cursor.item)
l_methods_cursor.forth
end
end
s.append_string ("</strong></div>")
end
s.append_string ("<div class=%"api-auth%">Authentication required: <strong>" + rq.authentication_required (req).out + "</strong></div>")
if attached {REST_REQUEST_URI_TEMPLATE_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]} router as l_uri_template_router then
create l_uri_tpl.make (a_resource)
if attached l_uri_tpl.query_variable_names as l_query_variable_names and then not l_query_variable_names.is_empty then
s.append_string ("<div class=%"api-uri-template%">Query parameters: ")
-- s.append_string (rq.path)
from
l_query_variable_names.start
until
l_query_variable_names.after
loop
if l_query_variable_names.isfirst then
s.append_string ("?")
else
s.append_string ("&")
end
if attached l_query_variable_names.item as l_query_param then
s.append_string ("<strong>" + l_query_param + "</strong>")
s.append_string ("=<em>" + l_query_param + "</em>")
end
l_query_variable_names.forth
end
s.append_string ("</div>%N")
end
if attached l_uri_tpl.path_variable_names as l_path_variable_names and then not l_path_variable_names.is_empty then
s.append_string ("<div class=%"api-uri-template%">Path Segment parameters: ")
-- s.append_string (rq.path)
from
l_path_variable_names.start
until
l_path_variable_names.after
loop
if attached l_path_variable_names.item as l_seg_param then
s.append_string ("<em>{" + l_seg_param + "}</em>")
end
l_path_variable_names.forth
end
s.append_string ("</div>%N")
end
end
-- if attached rq._parameters as l_uri_params and then not l_uri_params.is_empty then
-- s.append_string ("<div class=%"api-uri-template%">URI Template: ")
-- s.append_string (rq.path)
-- if attached l_uri_params.new_cursor as l_uri_params_cursor then
-- from
-- until
-- l_uri_params_cursor.after
-- loop
-- if attached l_uri_params_cursor.item as l_uri_param then
-- s.append_string ("/<strong>" + l_uri_param.name + "</strong>")
-- s.append_string ("/<em>{" + l_uri_param.name + "}</em>")
-- end
-- l_uri_params_cursor.forth
-- end
-- end
-- s.append_string ("</div>%N")
-- end
-- if attached rq.parameters as l_params and then not l_params.is_empty then
-- s.append_string ("<div class=%"api-params%">Parameters: ")
-- --| show form only if we have a default format
-- if l_dft_format_name = Void then
-- s.append_string ("<span class=%"note%">to test the parameter(s), please first select a supported format.</span>%N")
-- else
-- if rq.method_post_supported then
-- s.append_string ("<form id=%""+ rq.path +"%" method=%"POST%" action=%"" + ctx.script_url (rq.path) + "." + l_dft_format_name + "%">%N")
-- else
-- s.append_string ("<form id=%""+ rq.path +"%" method=%"GET%" action=%"" + ctx.script_url (rq.path) + "." + l_dft_format_name + "%">%N")
-- end
-- end
-- s.append_string ("<ul>")
-- if attached l_params.new_cursor as l_params_cursor then
-- from
-- until
-- l_params_cursor.after
-- loop
-- if attached l_params_cursor.item as l_param then
-- s.append_string ("<li><strong>" + l_param.name + "</strong>")
-- if l_param.optional then
-- s.append_string (" <em>(Optional)</em>")
-- end
-- if attached l_param.description as l_param_desc then
-- s.append_string (": <em>" + l_param_desc + "</em>")
-- end
-- if l_dft_format_name /= Void then
-- s.append (" <input name=%"" + l_param.name + "%" type=%"text%" />")
-- end
-- s.append_string ("</li>")
-- end
-- l_params_cursor.forth
-- end
-- end
-- if l_dft_format_name /= Void then
-- s.append_string ("<input type=%"submit%" value=%"Test "+ rq.path + "." + l_dft_format_name + "%"/>")
-- s.append_string ("</form>")
-- end
-- s.append_string ("</ul></div>")
-- else
-- if l_dft_format_name /= Void then
-- s.append_string ("<a class=%"api-name%" href=%"" + ctx.script_url (a_resource + "." + l_dft_format_name) + "%">Test "+ a_resource + "." + l_dft_format_name + "</a>")
-- else
-- s.append_string ("<a class=%"api-name%" href=%"" + ctx.script_url (a_resource) + "%">Test "+ a_resource +"</a>")
-- end
-- end
s.append_string ("</div>%N")
-- end
s.append_string ("</div>%N") -- inner
end
feature -- Access
new_html_page: REST_API_DOCUMENTATION_HTML_PAGE
do
create Result.make ("API Documentation")
end
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,124 @@
note
description: "Summary description for {REST_API_DOCUMENTATION_HTML_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_API_DOCUMENTATION_HTML_PAGE
inherit
HTML_PAGE
redefine
head,
initialize,
recycle,
compute
end
create
make
feature {NONE} -- Initialization
initialize
do
Precursor
create {LINKED_LIST [like shortcuts.item]} shortcuts.make
end
feature -- Recyle
recycle
do
Precursor
shortcuts.wipe_out
end
feature -- Access
head: REST_API_DOCUMENTATION_HTML_PAGE_HEAD
big_title: detachable STRING
shortcuts: LIST [TUPLE [name: STRING; anchor: STRING]]
add_shortcut (s: STRING)
local
t: STRING
do
t := s.string
t.replace_substring_all ("/", "-")
shortcuts.force ([s,t])
end
last_added_shortcut: STRING
do
if shortcuts.count > 0 and then attached shortcuts.last as sht then
Result := sht.anchor
else
create Result.make_empty
end
end
shortcuts_to_html: detachable STRING
do
if not shortcuts.is_empty then
from
create Result.make_from_string ("<strong>Shortcuts:</strong> | ")
shortcuts.start
until
shortcuts.after
loop
Result.append_string ("<a href=%"#"+ shortcuts.item.anchor +"%">"+ shortcuts.item.name +"</a> | ")
shortcuts.forth
end
end
end
feature -- Element change
set_big_title (t: like big_title)
do
big_title := t
end
feature -- Basic operation
compute
local
l_old_body: STRING
sh, bt: detachable STRING
do
sh := shortcuts_to_html
bt := big_title
if sh /= Void or bt /= Void then
l_old_body := body
if bt /= Void then
bt := "<h1>" + bt + "</h2>%N"
if sh /= Void then
body := bt + sh + l_old_body
else
body := bt + l_old_body
end
elseif sh /= Void then
body := sh + l_old_body
end
Precursor
body := l_old_body
else
Precursor
end
end
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,75 @@
note
description: "Summary description for {REST_API_DOCUMENTATION_HTML_PAGE_HEAD}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_API_DOCUMENTATION_HTML_PAGE_HEAD
inherit
HTML_PAGE_HEAD
redefine
initialize,
compute
end
create
make
feature {NONE} -- Initialization
initialize
do
Precursor
style := "[
body {margin: 0px;}
a { text-decoration: none; }
h1 { padding: 10px; border: solid 2px #000; background-color: #009; color: #fff;}
div.api { padding: 5px; margin-bottom: 10px;}
div.api .api-description { padding: 5px 5px 5px 0px; font-style: italic; color: #090;}
div.api div.inner { padding-left: 40px;}
div.api h2>a { color: #009; text-decoration: none;}
div.api a.api-format { color: #009; text-decoration: none;}
div.api a.api-format.selected { padding: 0 4px 0 4px; color: #009; text-decoration: none; border: solid 1px #99c; background-color: #eeeeff;}
div.api>h2 { margin: 2px; padding: 2px 2px 2px 10px; display: inline-block; border: dotted 1px #cce; width: 100%; color: #009; background-color: #E7F3F8; text-decoration: none; font-weight: bold; font-size: 120%;}
div.api span.note { font-style: italic;}
]"
end
feature {REST_API_DOCUMENTATION_HTML_PAGE} -- Access
style: STRING
feature -- Output
compute
-- Compute the string output
local
s: detachable STRING
p: INTEGER
do
Precursor
s := internal_string
if s /= Void then
p := s.substring_index ("</head>", 1)
if p > 0 then
s.insert_string ("<style>%N" + style + "%N</style>%N", p)
else
s.append_string ("<style>%N" + style + "%N</style>%N")
end
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,47 @@
note
description: "Summary description for REST_REQUEST_GROUP_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_GROUP_HANDLER [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
REQUEST_ROUTING_HANDLER [H, C]
redefine
execute
end
REST_REQUEST_HANDLER [C]
redefine
execute
select
execute_application
end
create
make
feature -- status
authentication_required: BOOLEAN
feature -- Execution
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
do
Precursor {REST_REQUEST_HANDLER} (ctx, req, res)
end
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,56 @@
note
description: "Summary description for {REST_RESPONSE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_RESPONSE
inherit
WSF_PAGE_RESPONSE
rename
header as headers,
body as message,
set_body as set_message,
put_string as append_message,
make as page_make,
send_to as send
end
create
make
feature {NONE} -- Initialization
make (a_api: like api)
do
api := a_api
page_make
end
feature -- Recycle
recycle
do
headers.recycle
message := Void
end
feature -- Access
api: STRING
-- Associated api query string.
invariant
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,52 @@
note
description: "Summary description for REST_REQUEST_AGENT_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_AGENT_HANDLER [C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
WSF_AGENT_HANDLER [C]
rename
execute as execute_application
end
REST_REQUEST_HANDLER [C]
select
execute
end
create
make
feature -- status
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
feature -- Element change
set_authentication_required (b: like authentication_required)
do
internal_authentication_required := b
end
feature {NONE} -- Implementation
internal_authentication_required: BOOLEAN
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,332 @@
note
description: "Summary description for {REST_REQUEST_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_HANDLER [C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
WSF_HANDLER [C]
WSF_HANDLER_HELPER
feature -- Access
authentication_required (req: WSF_REQUEST): BOOLEAN
-- Is authentication required
-- might depend on the request environment
-- or the associated resources
deferred
end
description: detachable STRING
-- Optional description
feature -- Element change
set_description (s: like description)
-- Set `description' to `s'
do
description := s
end
feature -- Execution
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
if request_method_name_supported (req.request_method) then
if authentication_required (req) and then not authenticated (ctx) then
execute_unauthorized (ctx, req, res)
else
pre_execute (ctx, req, res)
execute_application (ctx, req, res)
post_execute (ctx, req, res)
end
else
execute_request_method_not_allowed (req, res, supported_request_method_names)
end
rescue
execute_rescue (ctx, req, res)
end
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
pre_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
end
post_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
end
execute_rescue (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
post_execute (ctx, req, res)
rescue
--| Just in case, the rescue is raising other exceptions ...
end
execute_unauthorized (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
res.put_header ({HTTP_STATUS_CODE}.unauthorized, Void)
res.put_string ("Unauthorized")
end
feature -- Auth
authenticated (ctx: C): BOOLEAN
-- Is authenticated?
do
--| To redefine if needed
end
feature {NONE} -- Implementation
supported_formats: INTEGER
-- Support request format result such as json, xml, ...
feature {NONE} -- Status report
format_id_supported (a_id: INTEGER): BOOLEAN
do
Result := (supported_formats & a_id) = a_id
end
format_name_supported (n: STRING): BOOLEAN
-- Is format `n' supported?
do
Result := format_id_supported (format_constants.format_id (n))
end
format_constants: HTTP_FORMAT_CONSTANTS
once
create Result
end
feature -- Status report
supported_format_names: LIST [STRING]
-- Supported format names ...
do
create {LINKED_LIST [STRING]} Result.make
if format_json_supported then
Result.extend (format_constants.json_name)
end
if format_xml_supported then
Result.extend (format_constants.xml_name)
end
if format_text_supported then
Result.extend (format_constants.text_name)
end
if format_html_supported then
Result.extend (format_constants.html_name)
end
if format_rss_supported then
Result.extend (format_constants.rss_name)
end
if format_atom_supported then
Result.extend (format_constants.atom_name)
end
end
format_json_supported: BOOLEAN
do
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.json)
end
format_xml_supported: BOOLEAN
do
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.xml)
end
format_text_supported: BOOLEAN
do
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.text)
end
format_html_supported: BOOLEAN
do
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.html)
end
format_rss_supported: BOOLEAN
do
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.rss)
end
format_atom_supported: BOOLEAN
do
Result := format_id_supported ({HTTP_FORMAT_CONSTANTS}.atom)
end
feature -- Element change: formats
reset_supported_formats
do
supported_formats := 0
end
enable_format_json
do
enable_format ({HTTP_FORMAT_CONSTANTS}.json)
end
enable_format_xml
do
enable_format ({HTTP_FORMAT_CONSTANTS}.xml)
end
enable_format_text
do
enable_format ({HTTP_FORMAT_CONSTANTS}.text)
end
enable_format_html
do
enable_format ({HTTP_FORMAT_CONSTANTS}.html)
end
enable_format (f: INTEGER)
do
supported_formats := supported_formats | f
end
feature {NONE} -- Implementation
supported_request_methods: INTEGER
-- Support request method such as GET, POST, ...
feature {NONE} -- Status report
request_method_id_supported (a_id: INTEGER): BOOLEAN
do
Result := (supported_request_methods & a_id) = a_id
end
request_method_name_supported (n: STRING): BOOLEAN
-- Is request method `n' supported?
do
Result := request_method_id_supported (request_method_constants.method_id (n))
end
request_method_constants: HTTP_REQUEST_METHOD_CONSTANTS
once
create Result
end
feature -- Status report
supported_request_method_names: LIST [STRING]
-- Support request method such as GET, POST, ...
do
create {LINKED_LIST [STRING]} Result.make
if method_get_supported then
Result.extend (request_method_constants.method_get)
end
if method_post_supported then
Result.extend (request_method_constants.method_post)
end
if method_put_supported then
Result.extend (request_method_constants.method_put)
end
if method_patch_supported then
Result.extend (request_method_constants.method_patch)
end
if method_delete_supported then
Result.extend (request_method_constants.method_delete)
end
if method_head_supported then
Result.extend (request_method_constants.method_head)
end
end
method_get_supported: BOOLEAN
do
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.get)
end
method_post_supported: BOOLEAN
do
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.post)
end
method_put_supported: BOOLEAN
do
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.put)
end
method_patch_supported: BOOLEAN
do
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.patch)
end
method_delete_supported: BOOLEAN
do
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.delete)
end
method_head_supported: BOOLEAN
do
Result := request_method_id_supported ({HTTP_REQUEST_METHOD_CONSTANTS}.head)
end
feature -- Element change: request methods
reset_supported_request_methods
do
supported_request_methods := 0
end
enable_request_method_get
do
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.get)
end
enable_request_method_post
do
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.post)
end
enable_request_method_put
do
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.put)
end
enable_request_method_patch
do
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.patch)
end
enable_request_method_delete
do
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.delete)
end
enable_request_method_head
do
enable_request_method ({HTTP_REQUEST_METHOD_CONSTANTS}.head)
end
enable_request_method (m: INTEGER)
do
supported_request_methods := supported_request_methods | m
end
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,131 @@
note
description: "Summary description for {REST_REQUEST_HANDLER_CONTEXT}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_HANDLER_CONTEXT
inherit
WSF_HANDLER_CONTEXT
feature -- Accept: Content-Type
accepted_content_type: detachable READABLE_STRING_8
do
if internal_accepted_content_type = Void then
get_accepted_content_type (Void)
end
Result := internal_accepted_content_type
end
get_accepted_content_type (a_supported_content_types: detachable ARRAY [STRING_8])
do
if internal_accepted_content_type = Void then
internal_accepted_content_type := request_accepted_content_type (a_supported_content_types)
end
end
feature -- Format name
accepted_format_name: detachable READABLE_STRING_8
do
if internal_accepted_format_name = Void then
get_accepted_format_name (Void, Void)
end
Result := internal_accepted_format_name
end
get_accepted_format_name (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [STRING_8])
do
if internal_accepted_format_name = Void then
internal_accepted_format_name := request_accepted_format (a_format_variable_name, a_supported_content_types)
end
end
feature -- Format id
accepted_format_id: INTEGER
do
if internal_accepted_format_id = 0 then
get_accepted_format_id (Void, Void)
end
Result := internal_accepted_format_id
end
get_accepted_format_id (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [STRING_8])
do
if internal_accepted_format_id = 0 then
internal_accepted_format_id := request_accepted_format_id (a_format_variable_name, a_supported_content_types)
end
end
feature {NONE} -- Constants
Format_constants: HTTP_FORMAT_CONSTANTS
once
create Result
end
feature -- Format
request_accepted_format (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [READABLE_STRING_8]): detachable READABLE_STRING_8
-- Format id for the request based on {HTTP_FORMAT_CONSTANTS}
do
if a_format_variable_name /= Void and then attached string_item (a_format_variable_name) as ctx_format then
Result := ctx_format.as_string_8
else
Result := request_format_from_content_type (request_accepted_content_type (a_supported_content_types))
end
end
request_accepted_format_id (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [READABLE_STRING_8]): INTEGER
-- Format id for the request based on {HTTP_FORMAT_CONSTANTS}
do
if attached request_accepted_format (a_format_variable_name, a_supported_content_types) as l_format then
Result := Format_constants.format_id (l_format)
else
Result := 0
end
end
feature {NONE} -- Format/Content type implementation
request_format_from_content_type (a_content_type: detachable READABLE_STRING_8): detachable READABLE_STRING_8
-- `a_content_type' converted into a request format name
do
if a_content_type /= Void then
if a_content_type.same_string ({HTTP_MIME_TYPES}.text_json) then
Result := {HTTP_FORMAT_CONSTANTS}.json_name
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.application_json) then
Result := {HTTP_FORMAT_CONSTANTS}.json_name
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.text_xml) then
Result := {HTTP_FORMAT_CONSTANTS}.xml_name
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.text_html) then
Result := {HTTP_FORMAT_CONSTANTS}.html_name
elseif a_content_type.same_string ({HTTP_MIME_TYPES}.text_plain) then
Result := {HTTP_FORMAT_CONSTANTS}.text_name
end
end
end
feature {NONE} -- Internal
internal_accepted_content_type: like accepted_content_type
internal_accepted_format_id: like accepted_format_id
internal_accepted_format_name: like accepted_format_name
;note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,23 @@
note
description: "Summary description for {REST_REQUEST_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_ROUTER [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
WSF_ROUTER [H, C]
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,23 @@
note
description: "Summary description for {DEFAULT_REST_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_SERVICE
inherit
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_HANDLER_CONTEXT], REST_REQUEST_HANDLER_CONTEXT]
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,31 @@
note
description: "Summary description for {REST_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_SERVICE_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
WSF_ROUTED_SERVICE_I [H, C]
redefine
router
end
feature -- Setup
router: REST_REQUEST_ROUTER [H, C]
-- Request router
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_URI_HANDLER
inherit
REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,28 @@
note
description: "Summary description for {WSF_URI_HANDLER_CONTEXT}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_HANDLER_CONTEXT
inherit
WSF_URI_HANDLER_CONTEXT
REST_REQUEST_HANDLER_CONTEXT
create
make
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,40 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTER
inherit
REST_REQUEST_URI_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
redefine
map_agent_with_request_methods
end
create
make
feature -- Mapping
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
local
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
do
create h.make (a_action)
map_with_request_methods (a_id, h, rqst_methods)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,36 @@
note
description: "Summary description for {REST_REQUEST_URI_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTER_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_URI_HANDLER_CONTEXT create make end]
inherit
WSF_URI_ROUTER_I [H, C]
REST_REQUEST_ROUTER [H, C]
create
make
feature -- Mapping
-- map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: like {REST_REQUEST_AGENT_HANDLER}.action; rqst_methods: detachable ARRAY [READABLE_STRING_8])
-- do
-- Precursor (a_id, a_action, rqst_methods)
-- end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,33 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTING_HANDLER
inherit
REST_REQUEST_URI_ROUTING_HANDLER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
redefine
router
end
create
make
feature {NONE} -- Routing
router: REST_REQUEST_URI_ROUTER
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,64 @@
note
description: "Summary description for {WSF_ROUTING_HANDLER }."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTING_HANDLER_I [H -> REST_REQUEST_HANDLER [C],
C -> REST_REQUEST_URI_HANDLER_CONTEXT create make end]
inherit
WSF_URI_ROUTING_HANDLER_I [H, C]
redefine
router,
execute
end
REST_REQUEST_HANDLER [C]
undefine
execute
end
create
make
feature -- Status report
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
feature {NONE} -- Implementation
internal_authentication_required: BOOLEAN
feature -- Execution
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
Precursor {WSF_URI_ROUTING_HANDLER_I} (ctx, req, res)
end
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
check should_not_occur: False end
end
feature {NONE} -- Routing
router: REST_REQUEST_URI_ROUTER_I [H, C]
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,30 @@
note
description: "Summary description for {DEFAULT_REST_URI_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_URI_SERVICE
inherit
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
redefine
router
end
feature -- Router
router: REST_REQUEST_URI_ROUTER
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_URI_TEMPLATE_HANDLER
inherit
REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,28 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_HANDLER_CONTEXT}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
inherit
WSF_URI_TEMPLATE_HANDLER_CONTEXT
REST_REQUEST_HANDLER_CONTEXT
create
make
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,41 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTER
inherit
REST_REQUEST_URI_TEMPLATE_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
redefine
map_agent_with_request_methods
end
create
make,
make_with_base_url
feature -- Mapping
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
local
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
do
create h.make (a_action)
map_with_request_methods (a_id, h, rqst_methods)
end
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,29 @@
note
description: "Summary description for {REST_REQUEST_URI_TEMPLATE_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTER_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end]
inherit
WSF_URI_TEMPLATE_ROUTER_I [H, C]
REST_REQUEST_ROUTER [H, C]
create
make,
make_with_base_url
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,34 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER
inherit
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
redefine
router
end
create
make,
make_with_base_url
feature {NONE} -- Routing
router: REST_REQUEST_URI_TEMPLATE_ROUTER
;note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,66 @@
note
description: "Summary description for {WSF_ROUTING_HANDLER }."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [H -> REST_REQUEST_HANDLER [C],
C -> REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end]
inherit
WSF_URI_TEMPLATE_ROUTING_HANDLER_I [H, C]
redefine
router,
execute
end
REST_REQUEST_HANDLER [C]
undefine
execute
end
create
make,
make_with_base_url
feature -- Status report
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
feature {NONE} -- Implementation
internal_authentication_required: BOOLEAN
feature -- Execution
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
pre_execute (ctx, req, res)
Precursor {WSF_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
post_execute (ctx, req, res)
end
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
check should_not_occur: False end
end
feature {NONE} -- Routing
router: REST_REQUEST_URI_TEMPLATE_ROUTER_I [H, C]
;note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,30 @@
note
description: "Summary description for {DEFAULT_URI_TEMPLATE_REST_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_URI_TEMPLATE_SERVICE
inherit
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
redefine
router
end
feature -- Router
router: REST_REQUEST_URI_TEMPLATE_ROUTER
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,26 @@
Options Indexes FollowSymLinks ExecCGI
<IfModule mod_fcgid.c>
AddHandler fcgid-script .eapp
FcgidWrapper c:/_dev/Dev-Process/web-framework/library/server/request/rest/tests/htdocs/../EIFGENs/rest_sample_cgi/W_code/sample.exe .eapp
</IfModule>
Options +ExecCGI
AddHandler cgi-script exe
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /REST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ sample.eapp/$1
# To let CGI app knows about HTTP_AUTHORIZATION
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

View File

@@ -0,0 +1,31 @@
= How to make this works with Apache =
* In the apache's configuration file, be sure to add the following, or similar
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule mod_fcgid.c>
FcgidIdleTimeout 60
FcgidBusyScanInterval 120
FcgidProcessLifeTime 1600
#7200
FcgidMaxProcesses 5
FcgidMaxProcessesPerClass 100
FcgidMinProcessesPerClass 100
FcgidConnectTimeout 8
FcgidIOTimeout 3000
FcgidBusyTimeout 3200
FcgidMaxRequestLen 10000000
FcgidPassHeader Authorization
</IfModule>
alias /REST/ "c:/_dev/Dev-Process/src/server/htdocs/"
<directory "c:/_dev/Dev-Process/src/server/htdocs/">
AllowOverride All
Order allow,deny
Allow from all
</directory>
* You can use <Location>, but then the AllowOverride All, should be somewhere else, since <Location> does not allow it.
* And then, check the .htaccess from this folder for additional settings (but required)

View File

@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<project name="update_htdocs" default="menu">
<target name="menu">
<echo message="1 - update_cgi_link" />
<echo message="2 - update_htaccess" />
<echo message="0 - quit" />
<input message="Your choice :" variable="answer" defaultvalue="0" validargs="1,2,0" answer_required="true" />
<geant target="update_cgi_link" if="$answer=1" />
<geant target="update_htaccess" if="$answer=2" />
</target>
<target name="update_cgi_link">
<echo message="Update CGI link" />
<exec executable="junction CGI ..\EIFGENs\rest_sample_cgi\W_code" accept_errors="true" exit_code_variable="return_code" dir="$cwd" />
</target>
<target name="update_htaccess">
<replace file="htaccess" to_file=".htaccess" token="##SAMPLE-CGI-DIR##" replace="$cwd/../EIFGENs/rest_sample_cgi/W_code" flags="g" />
<replace file=".htaccess" to_file=".htaccess" token="\" replace="/" flags="g" />
</target>
</project>

View File

@@ -0,0 +1,26 @@
Options Indexes FollowSymLinks ExecCGI
<IfModule mod_fcgid.c>
AddHandler fcgid-script .eapp
FcgidWrapper ##SAMPLE-CGI-DIR##/sample.exe .eapp
</IfModule>
Options +ExecCGI
AddHandler cgi-script exe
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /REST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ sample.eapp/$1
# To let CGI app knows about HTTP_AUTHORIZATION
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="common" uuid="4E02DF53-9DF0-44B6-B8A8-7554E0B94957">
<target name="common">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
</file_rule>
<option cat_call_detection="false" is_attached_by_default="true" void_safety="all" syntax="provisional">
</option>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="rest" location="..\rest-safe.ecf" readonly="false"/>
<library name="wsf" location="..\..\..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\..\..\library\protocol\http\http-safe.ecf" readonly="false"/>
</target>
<target name="sample_fcgi" extends="common">
<root class="APP_SERVER" feature="make"/>
<setting name="executable_name" value="sample"/>
<library name="ewsgi_fcgi" location="..\..\..\..\..\..\library\server\ewsgi\connectors\libfcgi\libfcgi-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/gateway$</exclude>
</file_rule>
</cluster>
<cluster name="gateway" location=".\src\gateway\fcgi\" recursive="true"/>
</target>
<target name="sample_cgi" extends="common">
<root class="APP_SERVER" feature="make"/>
<setting name="executable_name" value="sample"/>
<library name="ewsgi_cgi" location="..\..\..\..\..\..\library\server\ewsgi\connectors\cgi\cgi-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/gateway$</exclude>
</file_rule>
</cluster>
<cluster name="gateway" location=".\src\gateway\cgi\" recursive="true"/>
</target>
<target name="sample_nino" extends="common">
<root class="APP_SERVER" feature="make"/>
<setting name="executable_name" value="sample"/>
<library name="ewsgi_nino" location="..\..\..\..\..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/>
<library name="default_nino" location="..\..\..\..\..\..\library\server\wsf\default\nino-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/gateway$</exclude>
</file_rule>
</cluster>
<cluster name="gateway" location=".\src\gateway\nino\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,112 @@
note
description: "Summary description for {APP_ACCOUNT_VERIFY_CREDENTIAL}."
date: "$Date$"
revision: "$Revision$"
class
APP_ACCOUNT_VERIFY_CREDENTIAL
inherit
APP_REQUEST_HANDLER
redefine
initialize,
execute_unauthorized
end
create
make
feature {NONE} -- Initialization
make
do
description := "Verify credentials"
initialize
end
initialize
do
Precursor
enable_request_method_get
enable_format_json
enable_format_xml
enable_format_text
end
feature -- Access
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := True
end
feature -- Execution
execute_unauthorized (a_hdl_context: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING
lst: LIST [STRING]
do
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
res.put_header ({HTTP_STATUS_CODE}.unauthorized, <<["WWW-Authenticate", "Basic realm=%"My Silly demo auth, password must be the same as login such as foo:foo%""]>>)
res.put_string ("Unauthorized")
end
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_full: BOOLEAN
h: HTTP_HEADER
l_login: STRING_8
s: STRING
content_type_supported: ARRAY [STRING]
l_format_id: INTEGER
do
content_type_supported := <<{HTTP_CONSTANTS}.application_json, {HTTP_CONSTANTS}.text_xml, {HTTP_CONSTANTS}.text_plain>>
l_format_id := ctx.request_accepted_format_id ("format", content_type_supported)
if authenticated (ctx) then
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
if attached authenticated_identifier (ctx) as log then
l_login := log.as_string_8
create h.make
create s.make_empty
inspect l_format_id
when {HTTP_FORMAT_CONSTANTS}.json then
h.put_content_type_text_plain
s.append_string ("{ %"login%": %"" + l_login + "%" }%N")
when {HTTP_FORMAT_CONSTANTS}.xml then
h.put_content_type_text_xml
s.append_string ("<login>" + l_login + "</login>%N")
when {HTTP_FORMAT_CONSTANTS}.text then -- Default
h.put_content_type_text_plain
s.append_string ("login: " + l_login + "%N")
else
execute_content_type_not_allowed (req, res, content_type_supported,
<<{HTTP_FORMAT_CONSTANTS}.json_name, {HTTP_FORMAT_CONSTANTS}.html_name, {HTTP_FORMAT_CONSTANTS}.xml_name, {HTTP_FORMAT_CONSTANTS}.text_name>>
)
end
if not s.is_empty then
res.set_status_code ({HTTP_STATUS_CODE}.ok)
res.put_header_text (h.string)
res.put_string (s)
end
else
send_error (ctx.path, 0, "User/password unknown", Void, ctx, req, res)
end
else
send_error (ctx.path, 0, "Authentication rejected", Void, ctx, req, res)
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,97 @@
note
description: "Summary description for {APP_TEST}."
date: "$Date$"
revision: "$Revision$"
class
APP_TEST
inherit
APP_REQUEST_HANDLER
redefine
initialize
end
create
make
feature {NONE} -- Initialization
make
do
description := "Return a simple test output "
initialize
end
initialize
do
Precursor
enable_request_method_get
enable_format_text
end
feature -- Access
authentication_required (req: WSF_REQUEST): BOOLEAN
do
end
feature -- Execution
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
local
s: STRING
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_plain
create s.make_empty
s.append_string ("test")
if attached {WSF_STRING} req.meta_variable ("REQUEST_COUNT") as l_request_count_val then
s.append_string ("(request_count="+ l_request_count_val.string +")%N")
end
-- ctx.request_format_id ("format", Void)
if attached ctx.request_accepted_format ("format", Void) as l_format then
s.append_string (" format=" + l_format + "%N")
end
if attached ctx.string_item ("op") as l_op then
s.append_string (" op=" + l_op)
if l_op.same_string ("crash") then
(create {DEVELOPER_EXCEPTION}).raise
elseif l_op.starts_with ("env") then
s.append_string ("%N%NAll variables:")
s.append (wgi_value_iteration_to_string (req.items, False))
s.append_string ("<br/>script_url(%"" + req.path_info + "%")=" + ctx.script_url (req.path_info) + "%N")
-- if attached ctx.http_authorization_login_password as t then
-- s.append_string ("Check login=" + t.login + "<br/>%N")
-- end
if authenticated (ctx) and then attached authenticated_identifier (ctx) as l_login then
s.append_string ("Authenticated: login=" + l_login.as_string_8 + "<br/>%N")
end
end
else
s.append ("%N Try " + ctx.script_absolute_url (req.path_info + "?op=env") + " to display all variables%N")
s.append ("%N Try " + ctx.script_absolute_url (req.path_info + "?op=crash") + " to demonstrate exception trace%N")
end
res.set_status_code (200)
res.put_header_text (h.string)
res.put_string (s)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,149 @@
note
description: "Summary description for {APP_SERVER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
APP_SERVER
inherit
APP_SERVICE
redefine
execute
end
REST_SERVICE_GATEWAY
create
make
feature {NONE} -- Initialization
make
-- Initialize `Current'.
do
initialize_router
build_gateway_and_launch
end
feature {NONE} -- Handlers
create_router
-- Create `router'
do
create router.make (5)
end
setup_router
local
h: APP_REQUEST_HANDLER
rah: APP_REQUEST_AGENT_HANDLER
gh: APP_REQUEST_ROUTING_HANDLER
do
create {APP_ACCOUNT_VERIFY_CREDENTIAL} h.make
router.map ("/account/verify_credentials", h)
router.map ("/account/verify_credentials.{format}", h)
create {APP_TEST} h.make
create gh.make (4)
router.map ("/test", gh)
-- gh.map ("/test", h)
gh.map ("/test/{op}", h)
gh.map ("/test.{format}", h)
gh.map ("/test.{format}/{op}", h)
create rah.make (agent execute_exit_application)
h := rah
h.set_description ("tell the REST server to exit (in FCGI context, this is used to reload the FCGI server)")
h.enable_request_method_get
h.enable_format_text
router.map ("/debug/exit", h)
router.map ("/debug/exit.{format}", h)
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
request_count := request_count + 1
Precursor (req, res)
end
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
local
rqst_uri: detachable STRING
l_path_info: detachable STRING
h: HTTP_HEADER
s: STRING
l_redir_url: STRING
do
create h.make
-- h.put_refresh (ctx.script_url ("/doc"), 2)
l_redir_url := "/doc"
h.put_refresh (l_redir_url, 2)
h.put_content_type_text_html
create s.make_empty
s := "Request [" + req.path_info + "] is not available. <br/>%N";
s.append ("You are being redirected to <a href=%"" + l_redir_url + "%">/doc</a> in 2 seconds ...%N")
h.put_content_length (s.count)
res.set_status_code ({HTTP_STATUS_CODE}.temp_redirect)
res.put_header_text (h.string)
res.put_string (s)
end
request_count: INTEGER
-- execute_rescue (ctx: like new_request_context)
-- -- Execute the default rescue behavior
-- do
-- execute_exception_trace (ctx)
-- end
feature -- Implementation
-- execute_exception_trace (ctx: like new_request_context)
-- local
-- h: HTTP_HEADER
-- s: STRING
-- do
-- create h.make
-- h.put_content_type_text_plain
-- ctx.output.put_string (h.string)
-- ctx.output.put_string ("Error occurred .. rq="+ request_count.out +"%N")
-- if attached (create {EXCEPTIONS}).exception_trace as l_trace then
-- ctx.output.put_string ("<pre>" + l_trace + "</pre>")
-- end
-- h.recycle
-- exit_with_code (-1)
-- end
execute_exit_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING
do
res.set_status_code (200)
res.put_header (200, <<["Content-Type", "text/html"]>>)
create s.make_empty
s.append_string ("Exited")
s.append_string (" <a href=%"" + ctx.script_url ("/") + "%">start again</a>%N")
res.put_string (s)
exit_with_code (0)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,24 @@
deferred class
REST_SERVICE_GATEWAY
inherit
WSF_SERVICE
feature -- Access
build_gateway_and_launch
local
cgi: WGI_CGI_CONNECTOR
do
create cgi.make (to_wgi_service)
cgi.launch
end
gateway_name: STRING = "CGI"
exit_with_code (a_code: INTEGER)
do
(create {EXCEPTIONS}).die (a_code)
end
end

View File

@@ -0,0 +1,35 @@
deferred class
REST_SERVICE_GATEWAY
inherit
WSF_SERVICE
feature -- Access
build_gateway_and_launch
local
libfcgi: WGI_LIBFCGI_CONNECTOR
do
create libfcgi.make (to_wgi_service)
libfcgi.launch
end
gateway_name: STRING = "libFCGI"
exit_with_code (a_code: INTEGER)
do
(create {EXCEPTIONS}).die (a_code)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,44 @@
deferred class
REST_SERVICE_GATEWAY
inherit
WSF_SERVICE
feature -- Access
build_gateway_and_launch
local
app: NINO_SERVICE
port_number: INTEGER
base_url: STRING
do
port_number := 8080
base_url := ""
debug ("nino")
print ("Example: start a Nino web server on port " + port_number.out +
", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N")
end
create app.make_custom (to_wgi_service, base_url)
app.force_single_threaded
app.listen (port_number)
end
gateway_name: STRING = "NINO"
exit_with_code (a_code: INTEGER)
do
(create {EXCEPTIONS}).die (a_code)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,35 @@
note
description: "Summary description for REST_REQUEST_AGENT_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
class
APP_REQUEST_AGENT_HANDLER
inherit
APP_REQUEST_HANDLER
undefine
execute, pre_execute, post_execute
end
REST_REQUEST_AGENT_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
undefine
authenticated
end
create
make
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,85 @@
note
description : "Objects that ..."
date : "$Date$"
revision : "$Revision$"
deferred class
APP_REQUEST_HANDLER
inherit
REST_REQUEST_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
redefine
authenticated
end
APP_REQUEST_HELPER
feature {NONE} -- Initialization
initialize
-- Initialize various attributes
do
end
feature {NONE} -- Implementation
wgi_value_iteration_to_string (v: ITERABLE [WSF_VALUE]; using_pre: BOOLEAN): STRING_8
do
create Result.make (100)
if using_pre then
Result.append ("<pre>")
end
across
v as cur
loop
Result.append_string (cur.item.name.as_string_8 + " = " + cur.item.string_representation.as_string_8 + "%N")
end
if using_pre then
Result.append ("</pre>")
end
end
feature -- Auth
authenticated (ctx: APP_REQUEST_HANDLER_CONTEXT): BOOLEAN
-- Is authenticated?
do
--| To redefine if needed
if attached ctx.request.http_authorization as l_http_authorization then
Result := True
end
end
authenticated_identifier (ctx: APP_REQUEST_HANDLER_CONTEXT): detachable READABLE_STRING_32
do
if attached ctx.request.http_authorization as l_http_authorization then
Result := "foo" -- Implement it as you want
end
end
feature -- Helpers
format_id (s: detachable STRING): INTEGER
do
Result := {HTTP_FORMAT_CONSTANTS}.text
if s /= Void then
Result := format_constants.format_id (s)
end
end
exit_with_code (a_code: INTEGER)
do
(create {EXCEPTIONS}).die (a_code)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,26 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
class
APP_REQUEST_HANDLER_CONTEXT
inherit
REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
create
make
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,101 @@
note
description: "Summary description for {APP_REQUEST_HELPER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
APP_REQUEST_HELPER
feature -- Helpers
send_error (a_path: STRING; a_error_id: INTEGER; a_error_name: STRING; a_error_message: detachable STRING; ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING
i,nb: INTEGER
rep_data: REST_RESPONSE
do
res.set_status_code ({HTTP_STATUS_CODE}.expectation_failed)
create rep_data.make (a_path)
rep_data.headers.put_content_type_text_plain
create s.make_empty
inspect ctx.accepted_format_id
when {HTTP_FORMAT_CONSTANTS}.json then
rep_data.headers.put_content_type_text_plain
s := "{%"application%": %"" + a_path + "%""
s.append_string (", %"error%": {")
s.append_string ("%"id%": " + a_error_id.out)
s.append_string (",%"name%": %"" + a_error_name + "%"")
if a_error_message /= Void then
s.append_string (",%"message%": %"")
if a_error_message.has ('%N') then
from
i := s.count
s.append_string (a_error_message)
nb := s.count
until
i > nb
loop
inspect s[i]
when '%R' then
if s.valid_index (i+1) and then s[i+1] = '%N' then
s[i] := '\'
s[i+1] := 'n'
i := i + 1
end
when '%N' then
s.insert_character ('\', i)
s[i] := 'n'
else
end
i := i + 1
end
else
s.append_string (a_error_message)
end
s.append_string ("%"")
end
s.append_string ("}") -- end error
s.append_string ("}") -- end global object
rep_data.set_message (s)
when {HTTP_FORMAT_CONSTANTS}.xml then
rep_data.headers.put_content_type_text_xml
s := "<application path=%"" + a_path + "%"><error id=%"" + a_error_id.out + "%" name=%""+ a_error_name +"%">"
if a_error_message /= Void then
s.append_string (a_error_message)
end
s.append_string ("</error></application>")
rep_data.set_message (s)
when {HTTP_FORMAT_CONSTANTS}.html then
rep_data.headers.put_content_type_text_html
s := "<strong>application</strong>: " + a_path + "<br/>%N<strong>Error</strong> (" + a_error_id.out + ") %"" + a_error_name + "%"<br/>%N"
if a_error_message /= Void then
s.append_string ("<blockquote>" + a_error_message + "</blockquote>")
end
rep_data.set_message (s)
when {HTTP_FORMAT_CONSTANTS}.text then -- Default
s := "Application: " + a_path + "<br/>%N"
s.append_string ("Error (" + a_error_id.out + ") %"" + a_error_name + "%"%N")
if a_error_message /= Void then
s.append_string ("%T" + a_error_message + "%N")
end
rep_data.set_message (s)
end
res.send (rep_data)
rep_data.recycle
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,27 @@
note
description: "Summary description for {REST_REQUEST_URI_TEMPLATE_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
APP_REQUEST_ROUTER
inherit
REST_REQUEST_URI_TEMPLATE_ROUTER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
create
make,
make_with_base_url
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,42 @@
note
description: "Summary description for {APP_REQUEST_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
APP_REQUEST_ROUTING_HANDLER
inherit
APP_REQUEST_HANDLER
undefine
execute
end
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
undefine
authenticated,
pre_execute,
post_execute
redefine
router
end
create
make
feature {NONE} -- Routing
router: APP_REQUEST_ROUTER
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,30 @@
note
description: "Summary description for {APP_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
APP_SERVICE
inherit
REST_SERVICE_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
redefine
router
end
feature {NONE} -- Router
router: APP_REQUEST_ROUTER
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,7 @@
Support for various text filters such as
* [wikitext](http://en.wikipedia.org/wiki/Wiki_markup)
* [Markdown](http://en.wikipedia.org/wiki/Markdown)
* ...
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,7 @@
We could add libraries for template engines such as
* [Velocity](http://en.wikipedia.org/wiki/Apache_Velocity)
* [Smarty](http://en.wikipedia.org/wiki/Smarty)
* ...
Anyone wanting to contribute is welcome

View File

@@ -0,0 +1,11 @@
Make sure to have the Clib generated in the related cURL library
- if you use EiffelStudio >= 7.0
check %ISE_LIBRARY%\library\cURL\spec\%ISE_C_COMPILER%\$ISE_PLATFORM
or $ISE_LIBRARY/library/cURL/spec/$ISE_PLATFORM
- otherwise if you use earlier version
check under ext/ise_library/curl/spec/...
And on Windows, be sure to get the libcurl.dll from %ISE_LIBRARY%\studio\spec\%ISE_PLATFORM%\bin\libcurl.dll

View File

@@ -0,0 +1,19 @@
<?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="client" uuid="D0059CEB-5F5C-4D21-8C71-842BD0F88468">
<target name="client">
<root class="RESTBUCK_CLIENT" feature="make"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http_client" location="..\..\..\library\client\http_client\http_client-safe.ecf" readonly="false"/>
<library name="json" location="..\..\..\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,19 @@
<?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="client" uuid="D0059CEB-5F5C-4D21-8C71-842BD0F88468">
<target name="client">
<root class="RESTBUCK_CLIENT" feature="make"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<setting name="concurrency" value="thread"/>
<library name="http_client" location="..\..\..\library\client\http_client\http_client.ecf"/>
<library name="json" location="..\..\..\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
<library name="thread" location="$ISE_LIBRARY/library/thread/thread.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,152 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
class
RESTBUCK_CLIENT
create
make
feature {NONE} -- Initialization
make
-- Initialize `Current'.
local
h: LIBCURL_HTTP_CLIENT
sess: HTTP_CLIENT_SESSION
resp : HTTP_CLIENT_RESPONSE
l_location : detachable READABLE_STRING_8
body : STRING
do
create h.make
sess := h.new_session ("http://127.0.0.1:9090")
-- Create Order
print ("%N Create Order %N")
resp := create_order (sess)
-- Read the Order
print ("%N Read Order %N")
l_location := resp.header ("Location")
resp := read_order (sess, l_location)
-- Update the Order
if attached resp.body as l_body then
body := l_body.as_string_8
body.replace_substring_all ("takeAway", "in Shop")
print ("%N Update Order %N")
resp := update_order (sess, l_location, body)
end
end
update_order ( sess: HTTP_CLIENT_SESSION; uri : detachable READABLE_STRING_8; a_body : STRING) : HTTP_CLIENT_RESPONSE
local
context : HTTP_CLIENT_REQUEST_CONTEXT
do
create Result.make
if attached uri as l_uri then
sess.set_base_url (l_uri)
create context.make
context.headers.put ("application/json", "Content-Type")
Result := sess.put ("", context, a_body )
-- Show headers
across
Result.headers as l_headers
loop
print (l_headers.item.name)
print (":")
print (l_headers.item.value)
io.put_new_line
end
-- Show body
print (Result.body)
io.put_new_line
end
end
read_order ( sess: HTTP_CLIENT_SESSION; uri : detachable READABLE_STRING_8) : HTTP_CLIENT_RESPONSE
do
create Result.make
if attached uri as l_uri then
sess.set_base_url (l_uri)
Result := sess.get ("", Void)
-- Show headers
across
Result.headers as l_headers
loop
print (l_headers.item.name)
print (":")
print (l_headers.item.value)
io.put_new_line
end
-- Show body
print (Result.body)
io.put_new_line
end
end
create_order (sess: HTTP_CLIENT_SESSION) : HTTP_CLIENT_RESPONSE
local
s: READABLE_STRING_8
j: JSON_PARSER
id: detachable STRING
context : HTTP_CLIENT_REQUEST_CONTEXT
do
s := "[
{
"location":"takeAway",
"items":[
{
"name":"Late",
"option":"skim",
"size":"Small",
"quantity":1
}
]
}
]"
create context.make
context.headers.put ("application/json", "Content-Type")
Result := sess.post ("/order", context, s)
-- Show the Headers
across
Result.headers as l_headers
loop
print (l_headers.item.name)
print (":")
print (l_headers.item.value)
io.put_new_line
end
-- Show the Response body
if attached Result.body as m then
create j.make_parser (m)
if j.is_parsed and attached j.parse_object as j_o then
if attached {JSON_STRING} j_o.item ("id") as l_id then
id := l_id.item
end
print (m)
io.put_new_line
end
end
end
feature {NONE} -- Implementation
invariant
-- invariant_clause: True
end

View File

@@ -0,0 +1,4 @@
${NOTE_KEYWORD}
copyright: "2011-${YEAR}, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -0,0 +1,293 @@
Restbuck Eiffel Implementation based on the book of REST in Practice
====================================================================
This is an implementation of CRUD pattern for manipulate resources, this is the first step to use
the HTTP protocol as an application protocol instead of a transport protocol.
Restbuck Protocol
-----------------
<table>
<TR><TH>Verb</TH> <TH>URI or template</TH> <TH>Use</TH></TR>
<TR><TD>POST</TD> <TD>/order</TD> <TD>Create a new order, and upon success, receive a Locationheader specifying the new order's URI.</TD></TR>
<TR><TD>GET</TD> <TD>/order/{orderId}</TD> <TD>Request the current state of the order specified by the URI.</TD></TR>
<TR><TD>PUT</TD> <TD>/order/{orderId}</TD> <TD>Update an order at the given URI with new information, providing the full representation.</TD></TR>
<TR><TD>DELETE</TD> <TD>/order/{orderId}</TD> <TD>Logically remove the order identified by the given URI.</TD></TR>
</table>
Resource Represenation
----------------------
The previous tables shows a contrat, the URI or URI template, allows us to indentify resources, now we will chose a
representacion, for this particular case we will use JSON.
Note: <br/>
1. *A resource can have multiple URIs*.<br/>
2. *A resource can have multiple Representations*.<br/>
RESTBUCKS_SERVER
----------------
This class implement the main entry of our REST CRUD service, we are using a default connector (Nino Connector,
using a WebServer written in Eiffel).
We are inheriting from URI_TEMPLATE_ROUTED_SERVICE, this allows us to map our service contrat, as is shown in the previous
table, the mapping is defined in the feature setup_router, this also show that the class ORDER_HANDLER will be encharge
of to handle different type of request to the ORDER resource.
class
RESTBUCKS_SERVER
inherit
ANY
URI_TEMPLATE_ROUTED_SERVICE
DEFAULT_SERVICE
-- Here we are using a default connector using the default Nino Connector,
-- but it's possible to use other connector (CGI or FCGI).
create
make
feature {NONE} -- Initialization
make
-- Initialize the router (this will have the request handler and
-- their context).
do
initialize_router
make_and_launch
end
create_router
do
create router.make (2)
end
setup_router
local
order_handler: ORDER_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
do
create order_handler
router.map_with_request_methods ("/order", order_handler, <<"POST">>)
router.map_with_request_methods ("/order/{orderid}", order_handler, <<"GET", "DELETE", "PUT">>)
end
feature -- Execution
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- I'm using this method to handle the method not allowed response
-- in the case that the given uri does not have a corresponding http method
-- to handle it.
local
h : HTTP_HEADER
l_description : STRING
l_api_doc : STRING
do
if req.content_length_value > 0 then
req.input.read_string (req.content_length_value.as_integer_32)
end
create h.make
h.put_status ({HTTP_STATUS_CODE}.method_not_allowed)
h.put_content_type_text_plain
l_api_doc := "%NPlease check the API%NURI:/order METHOD: POST%NURI:/order/{orderid} METHOD: GET, PUT, DELETE%N"
l_description := req.request_method + req.request_uri + " is not allowed" + "%N" + l_api_doc
h.put_content_length (l_description.count)
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.method_not_allowed)
res.write_header_text (h.string)
res.write_string (l_description)
end
end
How to Create an order with POST
--------------------------------
Here is the convention that we are using:
POST is used for creation and the server determines the URI of the created resource.
If the request POST is SUCCESS, the server will create the order and will response with
201 CREATED, the Location header will contains the newly created order's URI,
if the request POST is not SUCCESS, the server will response with
400 BAD REQUEST, the client send a bad request or
500 INTERNAL_SERVER_ERROR, when the server can deliver the request.
POST /order HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
Content-Length: 196
Origin: chrome-extension://fhjcajmcbmldlhcimfajhfbgofnpcjmb
Content-Type: application/json
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es-419,es;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
{
"location":"takeAway",
"items":[
{
"name":"Late",
"option":"skim",
"size":"Small",
"quantity":1
}
]
}
Response success
HTTP/1.1 201 Created
Status 201 Created
Content-Type application/json
Content-Length 123
Location http://localhost:8080/order/1
Date FRI,09 DEC 2011 20:34:20.00 GMT
{
"location" : "takeAway",
"status" : "submitted",
"items" : [ {
"name" : "late",
"size" : "small",
"quantity" : 1,
"option" : "skim"
} ]
}
How to Read an order with GET
-----------------------------
Using GET to retrieve resource information.
If the GET request is SUCCESS, we response with 200 OK, and a representation of the order
If the GET request is not SUCCESS, we response with 404 Resource not found
If is a Conditional GET and the resource does not change we send a 304, Resource not modifed
GET /order/1 HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es-419,es;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
If-None-Match: 6542EF270D91D3EAF39CFB382E4CEBA7
Response
HTTP/1.1 200 OK
Status 200 OK
Content-Type application/json
Content-Length 123
Date FRI,09 DEC 2011 20:53:46.00 GMT
etag 2ED3A40954A95D766FC155682DC8BB52
{
"location" : "takeAway",
"status" : "submitted",
"items" : [ {
"name" : "late",
"size" : "small",
"quantity" : 1,
"option" : "skim"
} ]
}
How to Update an order with PUT
-------------------------------
A successful PUT request will not create a new resource, instead it will change the state of the resource identified by the current uri.
If success we response with 200 and the updated order.
404 if the order is not found
400 in case of a bad request
500 internal server error
If the request is a Conditional PUT, and it does not mat we response 415, precondition failed.
Suposse that we had created an Order with the values shown in the _How to create an order with POST_
But we change our decision and we want to stay in the shop.
PUT /order/1 HTTP/1.1
Content-Length: 122
Content-Type: application/json; charset=UTF-8
Host: localhost:8080
Connection: Keep-Alive
Expect: 100-Continue
{
"location" : "in shop",
"status" : "submitted",
"items" : [ {
"name" : "late",
"size" : "small",
"quantity" : 1,
"option" : "skim"
} ]
}
Response success
HTTP/1.1 200 OK
Status 200 OK
Content-Type application/json
Date FRI,09 DEC 2011 21:06:26.00 GMT
etag 8767F900674B843E1F3F70BCF3E62403
Content-Length 122
{
"location" : "in shop",
"status" : "submitted",
"items" : [ {
"name" : "late",
"size" : "small",
"quantity" : 1,
"option" : "skim"
} ]
}
How to Delete an order with DELETE
----------------------------------
Here we use DELETE to cancel an order, if that order is in state where it can still be canceled.
204 if is ok
404 Resource not found
405 if consumer and service's view of the resouce state is inconsisent
500 if we have an internal server error
DELETE /order/1 HTTP/1.1
Host: localhost:8080
Connection: Keep-Alive
Response success
HTTP/1.1 204 No Content
Status 204 No Content
Content-Type application/json
Date FRI,09 DEC 2011 21:10:51.00 GMT
If we want to check that the resource does not exist anymore we can try to retrieve a GET /order/1 and we will receive a
404 No Found
GET /order/1 HTTP/1.1
Host: localhost:8080
Connection: Keep-Alive
Response
HTTP/1.1 404 Not Found
Status 404 Not Found
Content-Type application/json
Content-Length 44
Date FRI,09 DEC 2011 21:14:17.79 GMT
The following resource/order/1 is not found
References
----------
1. [How to get a cup of coffe](http://www.infoq.com/articles/webber-rest-workflow)
2. [Rest in Practice] (http://restinpractice.com/default.aspx)

View File

View File

@@ -0,0 +1,31 @@
<?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="restbucks" uuid="7C9887BD-4AE4-47F2-A0AA-4BBB6736D433">
<target name="restbucks">
<root class="RESTBUCKS_SERVER" feature="make"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
</file_rule>
<option debug="true" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
<debug name="nino" enabled="true"/>
<assertions precondition="true" postcondition="true" invariant="true" supplier_precondition="true"/>
</option>
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="connector_nino" location="..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf" readonly="false">
<option debug="true">
<debug name="nino" enabled="true"/>
</option>
</library>
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf" readonly="false"/>
<library name="eel" location="..\..\library\crypto\eel\eel-safe.ecf" readonly="false"/>
<library name="encoder" location="..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="http" location="..\..\library\protocol\http\http-safe.ecf" readonly="false"/>
<library name="json" location="..\..\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="uri_template" location="..\..\library\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
<library name="wsf_extension" location="..\..\library\server\wsf_extension\wsf_extension-safe.ecf" readonly="false"/>
<cluster name="src" location="src\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,26 @@
note
description: "Summary description for {DATABASE_API}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
DATABASE_API
create
make
feature -- Initialization
make
do
create orders.make (10)
end
feature -- Access
orders: HASH_TABLE [ORDER, STRING]
;note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,19 @@
note
description: "Summary description for {SHARED_DATABASE_API}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
SHARED_DATABASE_API
feature -- Access
db_access: DATABASE_API
once
create Result.make
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,90 @@
note
description: "Summary description for {ITEM}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
ITEM
inherit
ITEM_CONSTANTS
create
make
feature -- Initialization
make ( a_name : STRING_32 ; a_size:STRING_32; a_option: STRING_32; a_quantity:INTEGER_8)
do
set_name (a_name)
set_size (a_size)
set_option (a_option)
set_quantity (a_quantity)
end
feature -- Access
name : STRING
-- product name type of Coffee(Late, Cappuccino, Expresso)
option : STRING
-- customization option Milk (skim, semi, whole)
size : STRING
-- small, mediumm large
quantity :INTEGER
feature -- Element Change
set_name (a_name: STRING)
require
valid_name: is_valid_coffee_type (a_name)
do
name := a_name
ensure
name_assigned : name.same_string(a_name)
end
set_size (a_size: STRING)
require
valid_size : is_valid_size_option (a_size)
do
size := a_size
ensure
size_assigned : size.same_string(a_size)
end
set_option (an_option: STRING)
require
valid_option : is_valid_milk_type (an_option)
do
option := an_option
ensure
option_assigned : option.same_string (an_option)
end
set_quantity (a_quantity: INTEGER)
require
valid_quantity : a_quantity > 0
do
quantity := a_quantity
ensure
quantity_assigned : quantity = a_quantity
end
feature -- Report
hash_code: INTEGER
--Hash code value
do
Result := option.hash_code + name.hash_code + size.hash_code + quantity.hash_code
end
invariant
valid_size : is_valid_size_option (size)
valid_coffe : is_valid_coffee_type (name)
valid_customization : is_valid_milk_type (option)
valid_quantity : quantity > 0
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,54 @@
note
description: "Summary description for {ITEM_CONSTANTS}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
ITEM_CONSTANTS
feature -- Access
is_valid_coffee_type (a_type: STRING) : BOOLEAN
--is `a_type' a valid coffee type
do
a_type.to_lower
coffe_types.compare_objects
Result := coffe_types.has (a_type)
end
Coffe_types : ARRAY[STRING]
-- List of valid Coffee types
once
Result := <<"late","cappuccino", "expresso">>
end
is_valid_milk_type (a_type: STRING) : BOOLEAN
--is `a_type' a valid milk type
do
a_type.to_lower
milk_types.compare_objects
Result := milk_types.has (a_type)
end
Milk_types : ARRAY[STRING]
-- List of valid Milk types
once
Result := <<"skim","semi", "whole">>
end
is_valid_size_option (an_option: STRING) : BOOLEAN
--is `an_option' a valid size option
do
an_option.to_lower
size_options.compare_objects
Result := size_options.has (an_option)
end
Size_options : ARRAY[STRING]
-- List of valid Size_options
once
Result := <<"small","mediumn", "large">>
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,170 @@
note
description: "Summary description for {JSON_ORDER_CONVERTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
JSON_ORDER_CONVERTER
inherit
JSON_CONVERTER
create
make
feature -- Initialization
make
do
create object.make ("","","")
end
feature -- Access
object : ORDER
value : detachable JSON_OBJECT
feature -- Conversion
from_json (j: attached like value): detachable like object
-- Convert from JSON value. Returns Void if unable to convert
local
s_id, s_location, s_status: detachable STRING_32
q: INTEGER_8
o: ORDER
i : ITEM
l_array : detachable ARRAYED_LIST [JSON_VALUE]
is_valid_from_json : BOOLEAN
do
is_valid_from_json := True
s_id ?= json.object (j.item (id_key), Void)
s_location ?= json.object (j.item (location_key), Void)
s_status ?= json.object (j.item (status_key), Void)
create o.make ("", s_location, s_status)
if attached {JSON_ARRAY} j.item (items_key) as l_val then
l_array := l_val.array_representation
from
l_array.start
until
l_array.after
loop
if attached {JSON_OBJECT} l_array.item_for_iteration as jv then
if attached {INTEGER_8} json.object (jv.item (quantity_key), Void) as l_integer then
q := l_integer
else
q := 0
end
if
attached {STRING_32} json.object (jv.item (name_key), Void) as s_name and then
attached {STRING_32} json.object (jv.item (size_key), Void) as s_key and then
attached {STRING_32} json.object (jv.item (option_key), Void) as s_option
then
if is_valid_item_customization (s_name, s_key, s_option,q) then
create i.make (s_name, s_key, s_option, q)
o.add_item (i)
else
is_valid_from_json := False
end
else
is_valid_from_json := False
end
end
l_array.forth
end
end
if not is_valid_from_json or o.items.is_empty then
Result := Void
else
Result := o
end
end
to_json (o: like object): like value
-- Convert to JSON value
local
ja : JSON_ARRAY
i : ITEM
jv: JSON_OBJECT
do
create Result.make
-- Result.put (json.value (o.id), id_key)
Result.put (json.value (o.location), location_key)
Result.put (json.value (o.status), status_key)
from
create ja.make_array
o.items.start
until
o.items.after
loop
i := o.items.item_for_iteration
create jv.make
jv.put (json.value (i.name), name_key)
jv.put (json.value (i.size),size_key)
jv.put (json.value (i.quantity), quantity_key)
jv.put (json.value (i.option), option_key)
ja.add (jv)
o.items.forth
end
Result.put (ja, items_key)
end
feature {NONE} -- Implementation
id_key: JSON_STRING
once
create Result.make_json ("id")
end
location_key: JSON_STRING
once
create Result.make_json ("location")
end
status_key: JSON_STRING
once
create Result.make_json ("status")
end
items_key : JSON_STRING
once
create Result.make_json ("items")
end
name_key : JSON_STRING
once
create Result.make_json ("name")
end
size_key : JSON_STRING
once
create Result.make_json ("size")
end
quantity_key : JSON_STRING
once
create Result.make_json ("quantity")
end
option_key : JSON_STRING
once
create Result.make_json ("option")
end
feature -- Validation
is_valid_item_customization ( name : STRING_32; size: STRING_32; option : STRING_32; quantity : INTEGER_8 ) : BOOLEAN
local
ic : ITEM_CONSTANTS
do
create ic
Result := ic.is_valid_coffee_type (name) and ic.is_valid_milk_type (option) and ic.is_valid_size_option (size) and quantity > 0
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

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