diff --git a/examples/filter/src/filter/logging_filter.e b/examples/filter/src/filter/logging_filter.e
deleted file mode 100644
index e6a8b89b..00000000
--- a/examples/filter/src/filter/logging_filter.e
+++ /dev/null
@@ -1,40 +0,0 @@
-note
- description: "Logging filter."
- author: "Olivier Ligot"
- date: "$Date$"
- revision: "$Revision$"
-
-class
- LOGGING_FILTER
-
-inherit
- WSF_FILTER
-
-feature -- Basic operations
-
- execute (req: WSF_REQUEST; res: WSF_RESPONSE)
- -- Execute the filter
- local
- l_user_agent: STRING
- l_date: DATE_TIME
- do
- if attached req.http_user_agent as ua then
- l_user_agent := ua.as_string_8
- else
- l_user_agent := "-"
- end
- create l_date.make_now
- io.put_string ("[" + l_date.formatted_out (Date_time_format) + "] %"" + req.request_method + " " + req.request_uri
- + " " + {HTTP_CONSTANTS}.http_version_1_1 + "%" " + res.status_code.out + " " + l_user_agent)
- io.put_new_line
- execute_next (req, res)
- end
-
-feature -- Constants
-
- Date_time_format: STRING = "yyyy/[0]mm/[0]dd [0]hh:[0]mi:[0]ss.ff3"
-
-note
- copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
- license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
-end
diff --git a/examples/filter/src/filter_server.e b/examples/filter/src/filter_server.e
index fff542ac..25d16fef 100644
--- a/examples/filter/src/filter_server.e
+++ b/examples/filter/src/filter_server.e
@@ -53,7 +53,7 @@ feature {NONE} -- Initialization
setup_filter
-- Setup `filter'
local
- l_logging_filter: LOGGING_FILTER
+ l_logging_filter: WSF_LOGGING_FILTER
do
create l_logging_filter
filter.set_next (l_logging_filter)
diff --git a/examples/restbucksCRUD/client/src/restbuck_client.e b/examples/restbucksCRUD/client/src/restbuck_client.e
index c325e5c3..22f84bbd 100644
--- a/examples/restbucksCRUD/client/src/restbuck_client.e
+++ b/examples/restbucksCRUD/client/src/restbuck_client.e
@@ -17,7 +17,7 @@ feature {NONE} -- Initialization
local
h: LIBCURL_HTTP_CLIENT
sess: HTTP_CLIENT_SESSION
- resp : HTTP_CLIENT_RESPONSE
+ resp : detachable HTTP_CLIENT_RESPONSE
l_location : detachable READABLE_STRING_8
body : STRING
do
@@ -39,7 +39,7 @@ feature {NONE} -- Initialization
-- Update the Order
- if attached resp.body as l_body then
+ if resp /= Void and then 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")
@@ -47,11 +47,10 @@ feature {NONE} -- Initialization
end
end
- update_order ( sess: HTTP_CLIENT_SESSION; uri : detachable READABLE_STRING_8; a_body : STRING) : HTTP_CLIENT_RESPONSE
+ update_order ( sess: HTTP_CLIENT_SESSION; uri : detachable READABLE_STRING_8; a_body : STRING): detachable 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
@@ -74,9 +73,8 @@ feature {NONE} -- Initialization
end
- read_order ( sess: HTTP_CLIENT_SESSION; uri : detachable READABLE_STRING_8) : HTTP_CLIENT_RESPONSE
+ read_order ( sess: HTTP_CLIENT_SESSION; uri : detachable READABLE_STRING_8): detachable HTTP_CLIENT_RESPONSE
do
- create Result.make
if attached uri as l_uri then
sess.set_base_url (l_uri)
Result := sess.get ("", Void)
diff --git a/examples/restbucksCRUD/src/restbucks_server.e b/examples/restbucksCRUD/src/restbucks_server.e
index ad1beb4d..79870862 100644
--- a/examples/restbucksCRUD/src/restbucks_server.e
+++ b/examples/restbucksCRUD/src/restbucks_server.e
@@ -10,6 +10,9 @@ inherit
ANY
WSF_URI_TEMPLATE_ROUTED_SERVICE
+ redefine
+ execute_default
+ end
WSF_HANDLER_HELPER
@@ -30,10 +33,13 @@ feature {NONE} -- Initialization
setup_router
local
order_handler: ORDER_HANDLER
+ doc: WSF_ROUTER_SELF_DOCUMENTATION_HANDLER
do
create order_handler
router.handle_with_request_methods ("/order", order_handler, router.methods_POST)
router.handle_with_request_methods ("/order/{orderid}", order_handler, router.methods_GET + router.methods_DELETE + router.methods_PUT)
+ create doc.make_hidden (router)
+ router.handle_with_request_methods ("/api/doc", doc, router.methods_GET)
end
feature -- Execution
@@ -54,6 +60,7 @@ feature -- Execution
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
+ l_description.append ("%NHTML documentation:/api/doc METHOD: GET%N")
h.put_content_length (l_description.count)
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.method_not_allowed)
diff --git a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e
index b237ef81..dc98f64f 100644
--- a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e
+++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e
@@ -62,7 +62,7 @@ feature -- Execution
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e
index 07b683b2..b1602527 100644
--- a/library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e
+++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e
@@ -61,7 +61,7 @@ feature -- Request processing
process_request (a_handler: HTTP_CONNECTION_HANDLER; a_socket: TCP_STREAM_SOCKET)
-- Process request ...
local
- env, vars: HASH_TABLE [STRING, STRING]
+ env: HASH_TABLE [STRING, STRING]
p: INTEGER
l_request_uri, l_script_name, l_query_string, l_path_info: STRING
l_server_name, l_server_port: detachable STRING
@@ -73,8 +73,16 @@ feature -- Request processing
l_request_uri := a_handler.uri
a_headers_map := a_handler.request_header_map
create e
- vars := e.starting_environment_variables
- env := vars.twin
+ if attached e.starting_environment_variables as vars then
+ create env.make (vars.count)
+ across
+ vars as c
+ loop
+ env.force (c.item.to_string_8, c.key.to_string_8)
+ end
+ else
+ create env.make (0)
+ end
--| for Any Abc-Def-Ghi add (or replace) the HTTP_ABC_DEF_GHI variable to `env'
from
@@ -189,7 +197,7 @@ feature -- Request processing
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/server/ewsgi/connectors/null/null-safe.ecf b/library/server/ewsgi/connectors/null/null-safe.ecf
index 9ad9cd54..6d82d779 100644
--- a/library/server/ewsgi/connectors/null/null-safe.ecf
+++ b/library/server/ewsgi/connectors/null/null-safe.ecf
@@ -1,6 +1,6 @@
-
-
+
+
/EIFGENs$
diff --git a/library/server/ewsgi/connectors/null/null.ecf b/library/server/ewsgi/connectors/null/null.ecf
index c8df2ee7..5255edb0 100644
--- a/library/server/ewsgi/connectors/null/null.ecf
+++ b/library/server/ewsgi/connectors/null/null.ecf
@@ -1,6 +1,6 @@
-
-
+
+
/EIFGENs$
diff --git a/library/server/ewsgi/src/implementation/wgi_request_from_table.e b/library/server/ewsgi/src/implementation/wgi_request_from_table.e
index 29dec9d2..1545e2a1 100644
--- a/library/server/ewsgi/src/implementation/wgi_request_from_table.e
+++ b/library/server/ewsgi/src/implementation/wgi_request_from_table.e
@@ -19,7 +19,7 @@ create
feature {NONE} -- Initialization
- make (a_vars: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]; a_input: like input; a_wgi_connector: like wgi_connector)
+ make (a_vars: HASH_TABLE [READABLE_STRING_GENERAL, READABLE_STRING_GENERAL]; a_input: like input; a_wgi_connector: like wgi_connector)
require
vars_attached: a_vars /= Void
do
@@ -244,7 +244,7 @@ feature -- Access: Extension to CGI meta parameters - 1.1
feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
- set_meta_variables (a_vars: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
+ set_meta_variables (a_vars: HASH_TABLE [READABLE_STRING_GENERAL, READABLE_STRING_GENERAL])
-- Fill with variable from `a_vars'
local
s: like meta_string_variable
@@ -264,7 +264,7 @@ feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
until
a_vars.after
loop
- table.force (a_vars.item_for_iteration, a_vars.key_for_iteration)
+ table.force (a_vars.item_for_iteration.to_string_8, a_vars.key_for_iteration.to_string_8)
a_vars.forth
end
diff --git a/library/server/libfcgi/fcgi-safe.ecf b/library/server/libfcgi/fcgi-safe.ecf
deleted file mode 100644
index 18fd9512..00000000
--- a/library/server/libfcgi/fcgi-safe.ecf
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- /\.svn$
- /\.git$
- /EIFGENs$
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /linux$
- /fake$
-
-
-
-
-
- /windows$
- /fake$
-
-
-
-
-
-
-
diff --git a/library/server/libfcgi/fcgi.ecf b/library/server/libfcgi/fcgi.ecf
deleted file mode 100644
index 05d15197..00000000
--- a/library/server/libfcgi/fcgi.ecf
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- /\.svn$
- /\.git$
- /EIFGENs$
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /linux$
- /fake$
-
-
-
-
-
- /windows$
- /fake$
-
-
-
-
-
-
-
diff --git a/library/server/libfcgi/tests/eiffelweb-safe.ecf b/library/server/libfcgi/tests/eiffelweb-safe.ecf
index 31acd804..781bae86 100644
--- a/library/server/libfcgi/tests/eiffelweb-safe.ecf
+++ b/library/server/libfcgi/tests/eiffelweb-safe.ecf
@@ -10,7 +10,7 @@
-
+
diff --git a/library/server/libfcgi/tests/eiffelweb.ecf b/library/server/libfcgi/tests/eiffelweb.ecf
index 35a36f2f..2167feb5 100644
--- a/library/server/libfcgi/tests/eiffelweb.ecf
+++ b/library/server/libfcgi/tests/eiffelweb.ecf
@@ -10,7 +10,7 @@
-
+
diff --git a/library/server/request/router/OBSOLETE.txt b/library/server/request/router/OBSOLETE.txt
deleted file mode 100644
index aecee2d5..00000000
--- a/library/server/request/router/OBSOLETE.txt
+++ /dev/null
@@ -1 +0,0 @@
-Now the router library is part of ../../wsf library
\ No newline at end of file
diff --git a/library/server/request/router/router-safe.ecf b/library/server/request/router/router-safe.ecf
deleted file mode 100644
index 3af161c9..00000000
--- a/library/server/request/router/router-safe.ecf
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
- /.git$
- /EIFGENs$
- /.svn$
-
-
-
-
-
-
diff --git a/library/server/request/router/router.ecf b/library/server/request/router/router.ecf
deleted file mode 100644
index 3ffd7d4c..00000000
--- a/library/server/request/router/router.ecf
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
- /.git$
- /EIFGENs$
- /.svn$
-
-
-
-
-
-
diff --git a/library/server/wsf/default/cgi-safe.ecf b/library/server/wsf/default/cgi-safe.ecf
index f10d0274..ed590547 100644
--- a/library/server/wsf/default/cgi-safe.ecf
+++ b/library/server/wsf/default/cgi-safe.ecf
@@ -8,6 +8,7 @@
/\.svn$
+
diff --git a/library/server/wsf/default/cgi.ecf b/library/server/wsf/default/cgi.ecf
index 6b525b01..42f3b093 100644
--- a/library/server/wsf/default/cgi.ecf
+++ b/library/server/wsf/default/cgi.ecf
@@ -9,6 +9,7 @@
+
diff --git a/library/server/wsf/default/libfcgi-safe.ecf b/library/server/wsf/default/libfcgi-safe.ecf
index d22c1a37..4b6a9804 100644
--- a/library/server/wsf/default/libfcgi-safe.ecf
+++ b/library/server/wsf/default/libfcgi-safe.ecf
@@ -8,6 +8,7 @@
/\.svn$
+
diff --git a/library/server/wsf/default/libfcgi.ecf b/library/server/wsf/default/libfcgi.ecf
index 2d49a118..57b00ded 100644
--- a/library/server/wsf/default/libfcgi.ecf
+++ b/library/server/wsf/default/libfcgi.ecf
@@ -8,6 +8,7 @@
/\.svn$
+
diff --git a/library/server/wsf/default/nino-safe.ecf b/library/server/wsf/default/nino-safe.ecf
index 83a163ce..8befe07f 100644
--- a/library/server/wsf/default/nino-safe.ecf
+++ b/library/server/wsf/default/nino-safe.ecf
@@ -8,6 +8,7 @@
/\.svn$
+
diff --git a/library/server/wsf/default/nino.ecf b/library/server/wsf/default/nino.ecf
index 124053b9..e75641d1 100644
--- a/library/server/wsf/default/nino.ecf
+++ b/library/server/wsf/default/nino.ecf
@@ -8,6 +8,7 @@
/\.svn$
+
diff --git a/library/server/wsf/router/context/wsf_router_context_mapping.e b/library/server/wsf/router/context/wsf_router_context_mapping.e
index afc38f1e..bf7f8895 100644
--- a/library/server/wsf/router/context/wsf_router_context_mapping.e
+++ b/library/server/wsf/router/context/wsf_router_context_mapping.e
@@ -9,6 +9,9 @@ deferred class
inherit
WSF_ROUTER_MAPPING
+ redefine
+ debug_output
+ end
feature -- Access
@@ -17,6 +20,14 @@ feature -- Access
deferred
end
+feature -- Status report
+
+ debug_output: STRING
+ -- String that should be displayed in debugger to represent `Current'.
+ do
+ Result := Precursor + " {" + ({C}).name + "}"
+ end
+
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
diff --git a/library/server/wsf/router/documentation/wsf_router_self_documentation_handler.e b/library/server/wsf/router/documentation/wsf_router_self_documentation_handler.e
index 427037f0..0de5d36b 100644
--- a/library/server/wsf/router/documentation/wsf_router_self_documentation_handler.e
+++ b/library/server/wsf/router/documentation/wsf_router_self_documentation_handler.e
@@ -17,8 +17,11 @@ inherit
on_mapped
end
+ WSF_SELF_DOCUMENTED_HANDLER
+
create
- make
+ make,
+ make_hidden
feature {NONE} -- Initialization
@@ -27,10 +30,28 @@ feature {NONE} -- Initialization
router := a_router
end
+ make_hidden (a_router: WSF_ROUTER)
+ do
+ make (a_router)
+ is_hidden := True
+ end
+
router: WSF_ROUTER
resource: detachable STRING
+ is_hidden: BOOLEAN
+ -- Current mapped handler should be hidden from self documentation
+
+feature -- Documentation
+
+ mapping_documentation (m: WSF_ROUTER_MAPPING): WSF_ROUTER_MAPPING_DOCUMENTATION
+ do
+ create Result.make (m)
+ Result.set_is_hidden (is_hidden)
+ Result.add_description ("Self generated documentation based on the router's setup")
+ end
+
feature {WSF_ROUTER} -- Mapping
on_mapped (a_mapping: WSF_ROUTER_MAPPING; a_rqst_methods: detachable WSF_ROUTER_METHODS)
diff --git a/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e b/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e
index 051446a9..2fc99843 100644
--- a/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e
+++ b/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e
@@ -195,7 +195,6 @@ feature {WSF_RESPONSE} -- Output
local
l_url: detachable STRING_8
l_base_url: detachable READABLE_STRING_8
- hdl: WSF_HANDLER
l_doc: detachable WSF_ROUTER_MAPPING_DOCUMENTATION
do
if attached {WSF_SELF_DOCUMENTED_ROUTER_MAPPING} m as l_doc_mapping then
@@ -223,21 +222,24 @@ feature {WSF_RESPONSE} -- Output
s.append ("")
if meths /= Void then
- s.append (" [ ")
+ s.append (" [")
across
meths as rq
loop
+ s.append_character (' ')
if l_url /= Void and then rq.item.is_case_insensitive_equal ("GET") then
s.append ("" + rq.item + "")
else
s.append (rq.item)
end
- if not rq.is_last then
- s.append (",")
- end
- s.append (" ")
+ s.append_character (',')
end
- s.append ("]")
+ if s[s.count] = ',' then
+ s.put (' ', s.count)
+ else
+ s.append_character (' ')
+ end
+ s.append_character (']')
end
s.append (" " + html_encoder.encoded_string (m.description) + " ")
diff --git a/library/server/wsf/router/filter/wsf_logging_filter.e b/library/server/wsf/router/filter/wsf_logging_filter.e
new file mode 100644
index 00000000..23b5db9a
--- /dev/null
+++ b/library/server/wsf/router/filter/wsf_logging_filter.e
@@ -0,0 +1,93 @@
+note
+ description: "Logging filter."
+ author: "Olivier Ligot"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WSF_LOGGING_FILTER
+
+inherit
+ WSF_FILTER
+ redefine
+ default_create
+ end
+
+create
+ default_create,
+ make_with_output
+
+feature {NONE} -- Initialization
+
+ default_create
+ do
+ Precursor
+ output := io.output
+ end
+
+ make_with_output (a_output: like output)
+ -- Create Current with `a_output' as `output'
+ require
+ a_output_opened: a_output.is_open_read
+ do
+ default_create
+ output := a_output
+ end
+
+ output: FILE
+ -- Output file
+ --| Could be stdout, or a file...
+
+feature -- Basic operations
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ -- Execute the filter
+ local
+ l_date: DATE_TIME
+ s: STRING
+ do
+ create s.make (64)
+ s.append (req.remote_addr)
+ s.append (" - - [")
+ create l_date.make_now_utc
+ s.append (l_date.formatted_out (Date_time_format))
+ s.append (" GMT] %"")
+ s.append (req.request_method)
+ s.append_character (' ')
+ s.append (req.request_uri)
+ s.append_character (' ')
+ s.append ({HTTP_CONSTANTS}.http_version_1_1)
+ s.append_character ('%"')
+ s.append_character (' ')
+ s.append_integer (res.status_code)
+ s.append_character (' ')
+ s.append_natural_64 (res.transfered_content_length)
+ s.append_character (' ')
+ if attached req.http_referer as r then
+ s.append_character ('%"')
+ s.append_character ('%"')
+ s.append (r)
+ s.append_character (' ')
+ end
+
+ if attached req.http_user_agent as ua then
+ s.append_character ('%"')
+ s.append (ua)
+ s.append_character ('%"')
+ else
+ s.append_character ('-')
+ end
+
+ output.put_string (s)
+ output.put_new_line
+ execute_next (req, res)
+ end
+
+feature -- Constants
+
+ Date_time_format: STRING = "[0]dd/[0]mm/yyyy [0]hh:[0]mi:[0]ss"
+
+note
+ copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+end
diff --git a/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping.e b/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping.e
index e62ffb50..c152150e 100644
--- a/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping.e
+++ b/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping.e
@@ -10,6 +10,8 @@ class
inherit
WSF_ROUTER_MAPPING
+ WSF_SELF_DOCUMENTED_ROUTER_MAPPING
+
create
make
diff --git a/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping.e b/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping.e
index 94dc3683..eb090784 100644
--- a/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping.e
+++ b/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping.e
@@ -12,8 +12,6 @@ inherit
WSF_SELF_DOCUMENTED_ROUTER_MAPPING
- DEBUG_OUTPUT
-
create
make,
make_from_template
@@ -47,14 +45,6 @@ feature -- Documentation
description: STRING_32 = "Match-URI-Template"
-feature -- Status report
-
- debug_output: STRING
- -- String that should be displayed in debugger to represent `Current'.
- do
- Result := "URI-template: " + template.template
- end
-
feature -- Element change
set_handler (h: like handler)
diff --git a/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_mapping.e b/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_mapping.e
index 4f9d00ab..98f27adf 100644
--- a/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_mapping.e
+++ b/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_mapping.e
@@ -11,8 +11,9 @@ inherit
WSF_ROUTER_CONTEXT_MAPPING [C]
WSF_SELF_DOCUMENTED_ROUTER_MAPPING
-
- DEBUG_OUTPUT
+ undefine
+ debug_output
+ end
create
make,
@@ -45,15 +46,7 @@ feature -- Access
feature -- Documentation
- description: STRING_32 = "Is-URI"
-
-feature -- Status report
-
- debug_output: STRING
- -- String that should be displayed in debugger to represent `Current'.
- do
- Result := "URI-template: " + template.template
- end
+ description: STRING_32 = "Match-URI-Template"
feature -- Element change
diff --git a/library/server/wsf/router/wsf_routed_service.e b/library/server/wsf/router/wsf_routed_service.e
index a2a83d8f..00dd52ab 100644
--- a/library/server/wsf/router/wsf_routed_service.e
+++ b/library/server/wsf/router/wsf_routed_service.e
@@ -47,7 +47,11 @@ feature -- Execution
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Default procedure
- deferred
+ local
+ not_found: WSF_NOT_FOUND_RESPONSE
+ do
+ create not_found.make (req)
+ res.send (not_found)
end
feature -- Access
diff --git a/library/server/wsf/router/wsf_router.e b/library/server/wsf/router/wsf_router.e
index bbe24b58..964a84d0 100644
--- a/library/server/wsf/router/wsf_router.e
+++ b/library/server/wsf/router/wsf_router.e
@@ -1,6 +1,10 @@
note
- description: "Summary description for {EWF_ROUTER}."
- author: ""
+ description: "[
+ URL dispatching of request
+
+ Map a route to an handler according to the request method and path
+
+ ]"
date: "$Date$"
revision: "$Revision$"
@@ -10,6 +14,8 @@ class
inherit
ITERABLE [WSF_ROUTER_ITEM]
+ WSF_REQUEST_EXPORTER
+
create
make,
make_with_base_url
@@ -53,8 +59,15 @@ feature -- Mapping
map_with_request_methods (a_mapping: WSF_ROUTER_MAPPING; rqst_methods: detachable WSF_ROUTER_METHODS)
-- Map `a_mapping' for request methods `rqst_methods'
do
- if attached rqst_methods as l_rm and then l_rm.has ({HTTP_REQUEST_METHODS}.method_get) then
- l_rm.enable_head
+ debug ("router")
+ -- Display conflict in mapping
+ if has_item_associated_with_resource (a_mapping.associated_resource, rqst_methods) then
+ io.error.put_string ("Mapping: " + a_mapping.debug_output + ": conflict with existing mapping")
+ if attached item_associated_with_resource (a_mapping.associated_resource, rqst_methods) as l_conflicted then
+ io.error.put_string (": " + l_conflicted.debug_output)
+ end
+ io.error.put_string ("%N")
+ end
end
mappings.extend (create {WSF_ROUTER_ITEM}.make_with_request_methods (a_mapping, rqst_methods))
a_mapping.handler.on_mapped (a_mapping, rqst_methods)
@@ -95,10 +108,28 @@ feature -- Access
-- And return the associated handler if mapping found and handler executed.
local
l_req_method: READABLE_STRING_8
+ head_res: WSF_HEAD_RESPONSE_WRAPPER
+ do
+ l_req_method := request_method (req)
+ is_dispatched := False
+ Result := dispatch_and_return_handler_for_request_method (req, res, l_req_method)
+ if Result = Void and l_req_method = {HTTP_REQUEST_METHODS}.method_head then
+ check is_not_dispatched: not is_dispatched end
+ create head_res.make_from_response (res)
+ req.set_request_method ({HTTP_REQUEST_METHODS}.method_GET)
+ Result := dispatch_and_return_handler_for_request_method (req, head_res, {HTTP_REQUEST_METHODS}.method_GET)
+ end
+ end
+
+feature {NONE} -- Dispatch implementation
+
+ dispatch_and_return_handler_for_request_method (req: WSF_REQUEST; res: WSF_RESPONSE; a_request_method: READABLE_STRING_8): detachable WSF_HANDLER
+ -- Dispatch request `req' among the `mappings'
+ -- And return the associated handler if mapping found and handler executed.
+ local
m: WSF_ROUTER_MAPPING
do
is_dispatched := False
- l_req_method := request_method (req)
across
mappings as c
@@ -106,7 +137,7 @@ feature -- Access
Result /= Void
loop
if attached c.item as l_info then
- if is_matching_request_methods (l_req_method, l_info.request_methods) then
+ if is_matching_request_methods (a_request_method, l_info.request_methods) then
m := l_info.mapping
if attached m.routed_handler (req, res, Current) as r then
is_dispatched := True
diff --git a/library/server/wsf/router/wsf_router_item.e b/library/server/wsf/router/wsf_router_item.e
index 77e3ae04..7978fbd1 100644
--- a/library/server/wsf/router/wsf_router_item.e
+++ b/library/server/wsf/router/wsf_router_item.e
@@ -1,6 +1,11 @@
note
- description: "Summary description for {WSF_ROUTER_ITEM}."
- author: ""
+ description: "[
+ Entry of WSF_ROUTER
+ It contains
+ - mapping
+ - request methods
+
+ ]"
date: "$Date$"
revision: "$Revision$"
@@ -38,11 +43,7 @@ feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
- if attached {DEBUG_OUTPUT} mapping as d then
- create Result.make_from_string (d.debug_output)
- else
- create Result.make_from_string (mapping.generator)
- end
+ create Result.make_from_string (mapping.debug_output)
if attached request_methods as mtds then
Result.append_string (" [ ")
across
@@ -66,4 +67,15 @@ feature -- Change
invariant
mapping_attached: mapping /= Void
+note
+ copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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
diff --git a/library/server/wsf/router/wsf_router_mapping.e b/library/server/wsf/router/wsf_router_mapping.e
index fcae82a0..5cc0efff 100644
--- a/library/server/wsf/router/wsf_router_mapping.e
+++ b/library/server/wsf/router/wsf_router_mapping.e
@@ -7,6 +7,9 @@ note
deferred class
WSF_ROUTER_MAPPING
+inherit
+ DEBUG_OUTPUT
+
feature {NONE} -- Initialization
make (a_resource: READABLE_STRING_8; h: like handler)
@@ -33,6 +36,14 @@ feature -- Documentation
deferred
end
+feature -- Status report
+
+ debug_output: STRING
+ -- String that should be displayed in debugger to represent `Current'.
+ do
+ Result := description.as_string_8 + " : " + associated_resource
+ end
+
feature -- Status
routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
diff --git a/library/server/wsf/src/wsf_head_response_wrapper.e b/library/server/wsf/src/wsf_head_response_wrapper.e
new file mode 100644
index 00000000..4575b317
--- /dev/null
+++ b/library/server/wsf/src/wsf_head_response_wrapper.e
@@ -0,0 +1,81 @@
+note
+ description: "[
+ This class is a wrapper on a standard WSF_RESPONSE
+ It is used to compute a HEAD request based on a GET request method handling
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WSF_HEAD_RESPONSE_WRAPPER
+
+inherit
+ WSF_RESPONSE
+ redefine
+ put_character,
+ put_string,
+ put_substring,
+ put_chunk,
+ put_chunk_end
+ end
+
+ WSF_RESPONSE_EXPORTER
+
+create
+ make_from_response
+
+feature {NONE} -- Initialization
+
+ make_from_response (res: WSF_RESPONSE)
+ do
+ wsf_response := res
+ make_from_wgi (res.wgi_response)
+ end
+
+feature {WSF_RESPONSE} -- Access
+
+ wsf_response: WSF_RESPONSE
+ -- Wrapped response
+
+feature -- Output operation
+
+ put_character (c: CHARACTER_8)
+ do
+ -- HEAD has no content
+ end
+
+ put_string (s: READABLE_STRING_8)
+ do
+ -- HEAD has no content
+ end
+
+ put_substring (s: READABLE_STRING_8; a_begin_index, a_end_index: INTEGER)
+ do
+ -- HEAD has no content
+ end
+
+ put_chunk (s: READABLE_STRING_8; a_extension: detachable READABLE_STRING_8)
+ do
+ -- HEAD has no content
+ end
+
+ put_chunk_end
+ do
+ -- HEAD has no content
+ end
+
+invariant
+ transfered_content_length_is_zero: transfered_content_length = 0
+
+note
+ copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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
diff --git a/library/server/wsf/src/wsf_request.e b/library/server/wsf/src/wsf_request.e
index 67820eee..ad31a9dc 100644
--- a/library/server/wsf/src/wsf_request.e
+++ b/library/server/wsf/src/wsf_request.e
@@ -39,6 +39,7 @@ feature {NONE} -- Initialization
tb: like meta_variables_table
do
wgi_request := r
+
create string_equality_tester
if attached r.meta_variables as l_vars then
create tb.make_with_key_tester (l_vars.count, string_equality_tester)
@@ -55,21 +56,26 @@ feature {NONE} -- Initialization
create error_handler.make
create uploaded_files_table.make_with_key_tester (0, string_equality_tester)
set_raw_input_data_recorded (False)
- create {STRING_32} empty_string.make_empty
+ create {IMMUTABLE_STRING_32} empty_string.make_empty
create execution_variables_table.make_with_key_tester (0, string_equality_tester)
execution_variables_table.compare_objects
initialize
analyze
+ ensure
+ wgi_request_set: wgi_request = r
+ request_method_set: request_method.same_string (r.request_method)
end
initialize
-- Specific initialization
local
s8: detachable READABLE_STRING_8
+ req: WGI_REQUEST
do
init_mime_handlers
+ req := wgi_request
--| Content-Length
if attached content_length as s and then s.is_natural_64 then
@@ -79,18 +85,21 @@ feature {NONE} -- Initialization
end
-- Content-Type
- s8 := wgi_request.content_type
+ s8 := req.content_type
if s8 /= Void then
create content_type.make_from_string (s8)
else
content_type := Void
end
+ --| Request Methods
+ request_method := req.request_method
+
--| PATH_INFO
- path_info := raw_url_encoder.decoded_string (wgi_request.path_info)
+ path_info := raw_url_encoder.decoded_string (req.path_info)
--| PATH_TRANSLATED
- s8 := wgi_request.path_translated
+ s8 := req.path_translated
if s8 /= Void then
path_translated := raw_url_encoder.decoded_string (s8)
end
@@ -211,6 +220,15 @@ feature -- Eiffel WGI access
Result := wgi_request.wgi_connector
end
+feature {WSF_REQUEST_EXPORTER} -- Override value
+
+ set_request_method (a_request_method: like request_method)
+ -- Set `request_method' to `a_request_method'
+ -- note: this is mainly to have smart handling of HEAD request
+ do
+ request_method := a_request_method
+ end
+
feature {NONE} -- Access: global variable
items_table: HASH_TABLE_EX [WSF_VALUE, READABLE_STRING_GENERAL]
@@ -679,9 +697,6 @@ feature -- Access: CGI meta parameters - 1.1
-- This variable is specific to requests made with HTTP.
--
-- Servers MUST provide this metavariable to scripts.
- do
- Result := wgi_request.request_method
- end
script_name: READABLE_STRING_8
-- The SCRIPT_NAME metavariable is set to a URL path that could
diff --git a/library/server/request/router/license.lic b/library/server/wsf/src/wsf_request_exporter.e
similarity index 51%
rename from library/server/request/router/license.lic
rename to library/server/wsf/src/wsf_request_exporter.e
index d4d72876..bd64e63d 100644
--- a/library/server/request/router/license.lic
+++ b/library/server/wsf/src/wsf_request_exporter.e
@@ -1,5 +1,13 @@
-${NOTE_KEYWORD}
- copyright: "2011-${YEAR}, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
+note
+ description: "Objects that can access low level features of {WSF_REQUEST}"
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_REQUEST_EXPORTER
+
+note
+ copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
@@ -8,3 +16,5 @@ ${NOTE_KEYWORD}
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
+end
+
diff --git a/library/server/wsf/src/wsf_response.e b/library/server/wsf/src/wsf_response.e
index 51b703dc..0a53da00 100644
--- a/library/server/wsf/src/wsf_response.e
+++ b/library/server/wsf/src/wsf_response.e
@@ -31,6 +31,8 @@ feature {NONE} -- Initialization
wgi_response := r
end
+feature {WSF_RESPONSE_EXPORTER} -- Properties
+
wgi_response: WGI_RESPONSE
-- Associated WGI_RESPONSE
diff --git a/library/server/wsf/src/wsf_response_exporter.e b/library/server/wsf/src/wsf_response_exporter.e
new file mode 100644
index 00000000..a75c81f9
--- /dev/null
+++ b/library/server/wsf/src/wsf_response_exporter.e
@@ -0,0 +1,19 @@
+note
+ description: "Objects that can access low level features of {WSF_RESPONSE}"
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_RESPONSE_EXPORTER
+
+note
+ copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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
diff --git a/library/server/wsf/wsf_extension-safe.ecf b/library/server/wsf/wsf_extension-safe.ecf
index bd44ce84..7bfa4489 100644
--- a/library/server/wsf/wsf_extension-safe.ecf
+++ b/library/server/wsf/wsf_extension-safe.ecf
@@ -12,7 +12,7 @@
-
+
diff --git a/library/server/wsf/wsf_extension.ecf b/library/server/wsf/wsf_extension.ecf
index e3622f9b..cef881de 100644
--- a/library/server/wsf/wsf_extension.ecf
+++ b/library/server/wsf/wsf_extension.ecf
@@ -12,7 +12,7 @@
-
+
diff --git a/library/server/wsf/wsf_session-safe.ecf b/library/server/wsf/wsf_session-safe.ecf
index 0c679d78..b94c5e7a 100644
--- a/library/server/wsf/wsf_session-safe.ecf
+++ b/library/server/wsf/wsf_session-safe.ecf
@@ -14,7 +14,7 @@
-
+
diff --git a/library/server/wsf/wsf_session.ecf b/library/server/wsf/wsf_session.ecf
index 5c2e26b0..f085bc3b 100644
--- a/library/server/wsf/wsf_session.ecf
+++ b/library/server/wsf/wsf_session.ecf
@@ -14,7 +14,7 @@
-
+
diff --git a/library/text/encoder/encoder-safe.ecf b/library/text/encoder/encoder-safe.ecf
index 7db8d66c..513e1e4e 100644
--- a/library/text/encoder/encoder-safe.ecf
+++ b/library/text/encoder/encoder-safe.ecf
@@ -1,5 +1,5 @@
-
+
@@ -7,7 +7,7 @@
/EIFGENs$
/.svn$
-
@@ -17,12 +17,12 @@
/tests$
/spec$
-
+
-
+
diff --git a/library/text/encoder/encoder.ecf b/library/text/encoder/encoder.ecf
index 5c3184fc..71732816 100644
--- a/library/text/encoder/encoder.ecf
+++ b/library/text/encoder/encoder.ecf
@@ -7,7 +7,7 @@
/EIFGENs$
/.svn$
-
diff --git a/library/utility/general/error/error-safe.ecf b/library/utility/general/error/error-safe.ecf
index b5eb8493..e6da0b5a 100644
--- a/library/utility/general/error/error-safe.ecf
+++ b/library/utility/general/error/error-safe.ecf
@@ -7,7 +7,7 @@
/EIFGENs$
/.svn$
-
diff --git a/library/utility/general/error/error.ecf b/library/utility/general/error/error.ecf
index ea7b6080..f21ea9b9 100644
--- a/library/utility/general/error/error.ecf
+++ b/library/utility/general/error/error.ecf
@@ -7,7 +7,7 @@
/EIFGENs$
/.svn$
-
diff --git a/tests/all-safe.ecf b/tests/all-safe.ecf
new file mode 100644
index 00000000..98fb312d
--- /dev/null
+++ b/tests/all-safe.ecf
@@ -0,0 +1,39 @@
+
+
+ compile many lib from EWF
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Compiling as Windows , on other platforms than Windows
+
+
+
+
+ Compiling as UNIX , on other platforms than Unix
+
+
+
+
+
diff --git a/tools/ise_wizard/install_ise_wizard.sh b/tools/ise_wizard/install_ise_wizard.sh
new file mode 100755
index 00000000..9b5496ea
--- /dev/null
+++ b/tools/ise_wizard/install_ise_wizard.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+mkdir tmp
+ecb -config ewf_ise_wizard-safe.ecf -target wizard -finalize -c_compile -project_path tmp
+mkdir -p spec/$ISE_PLATFORM
+mv tmp/EIFGENs/wizard/F_code/wizard spec/$ISE_PLATFORM/wizard
+rm -rf tmp
+
+WIZ_TARGET=$ISE_EIFFEL/studio/wizards/new_projects/ewf
+rm -rf $WIZ_TARGET
+mkdir $WIZ_TARGET
+cp -r resources $WIZ_TARGET/resources
+cp -r spec $WIZ_TARGET/spec
+cp ewf.dsc $WIZ_TARGET/../ewf.dsc
+rm -rf spec
diff --git a/tools/ise_wizard/install_ise_wizard_custom.sh b/tools/ise_wizard/install_ise_wizard_custom.sh
new file mode 100755
index 00000000..308e7d84
--- /dev/null
+++ b/tools/ise_wizard/install_ise_wizard_custom.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+mkdir tmp
+ecb -config ewf_ise_wizard-safe.ecf -target custom_wizard -finalize -c_compile -project_path tmp
+mkdir -p custom/spec/$ISE_PLATFORM
+mv tmp/EIFGENs/custom_wizard/F_code/wizard custom/spec/$ISE_PLATFORM/wizard
+rm -rf tmp
+
+WIZ_TARGET=$ISE_EIFFEL/studio/wizards/new_projects/ewf_custom
+rm -rf $WIZ_TARGET
+mkdir $WIZ_TARGET
+cp -r resources $WIZ_TARGET/resources
+cp -f custom/resources/* $WIZ_TARGET/resources
+cp -r custom/spec $WIZ_TARGET/spec
+cp custom/ewf.dsc $WIZ_TARGET/../ewf_custom.dsc
+rm -rf custom/spec
diff --git a/tools/ise_wizard/resources/ewf_application.e b/tools/ise_wizard/resources/ewf_application.e
index af64909d..929cd433 100644
--- a/tools/ise_wizard/resources/ewf_application.e
+++ b/tools/ise_wizard/resources/ewf_application.e
@@ -26,8 +26,6 @@ feature -- Execution
-- Default request handler if no other are relevant
local
mesg: WSF_HTML_PAGE_RESPONSE
- s: STRING_8
- l_user_name: READABLE_STRING_32
do
create mesg.make
mesg.set_title ("Hello World!")
@@ -44,9 +42,6 @@ feature {NONE} -- Initialization
--| If you don't need any custom options, you are not obliged to redefine `initialize'
Precursor
-
- --| Initialize router
- initialize_router
end
end
diff --git a/tools/ise_wizard/src/ewf_wizard.e b/tools/ise_wizard/src/ewf_wizard.e
index 9d6f08a6..09bcdd21 100644
--- a/tools/ise_wizard/src/ewf_wizard.e
+++ b/tools/ise_wizard/src/ewf_wizard.e
@@ -119,15 +119,14 @@ feature -- Form
tfn.add_extension ("ecf")
copy_resource_template ("template.ecf", tfn.string)
+ create res.make (tfn.string, d.name)
+
create tfn.make_from_string (dn.string)
tfn.set_file_name ("ewf")
tfn.add_extension ("ini")
copy_resource_template ("ewf.ini", tfn.string)
-
- create res.make (tfn.string, d.name)
-
create dn.make_from_string (pdn)
dn.extend (pn)
dn.extend ("src")