diff --git a/doc/how-to-include-ewf-in-my-git-repository.txt b/doc/how-to-include-ewf-in-my-git-repository.txt
new file mode 100644
index 00000000..1b54b051
--- /dev/null
+++ b/doc/how-to-include-ewf-in-my-git-repository.txt
@@ -0,0 +1,15 @@
+GOAL: include EWF into your own git repository
+For instance, let's put it under lib/EWF
+
+ git remote add -f _ewf https://github.com/EiffelWebFramework/EWF.git
+ git merge --squash -s ours --no-commit _ewf/master
+ git read-tree --prefix=lib/EWF/ -u _ewf/master
+ git commit -m "Imported EWF into subtree lib/EWF/"
+
+Then to update lib/EWF
+ git pull -X subtree=lib/EWF _ewf master
+
+From another git clone, reconnect this "import"
+ git remote add -f _ewf https://github.com/EiffelWebFramework/EWF.git
+ git merge -s ours --no-commit --squash _ewf/master
+ and then update lib/EWF as described before
diff --git a/examples/filter/filter-safe.ecf b/examples/filter/filter-safe.ecf
index a1b5c3fd..0495befc 100644
--- a/examples/filter/filter-safe.ecf
+++ b/examples/filter/filter-safe.ecf
@@ -13,10 +13,12 @@
+
+
diff --git a/examples/filter/src/filter_server.e b/examples/filter/src/filter_server.e
index 1c7a257c..92b579c4 100644
--- a/examples/filter/src/filter_server.e
+++ b/examples/filter/src/filter_server.e
@@ -10,12 +10,22 @@ class
inherit
ANY
- WSF_FILTERED_SERVICE
-
WSF_HANDLER_HELPER
WSF_DEFAULT_SERVICE
+ WSF_ROUTED_SERVICE
+ rename
+ execute as execute_router
+ end
+
+ WSF_FILTERED_SERVICE
+
+ WSF_FILTER
+ rename
+ execute as execute_router
+ end
+
SHARED_EJSON
create
@@ -24,29 +34,29 @@ create
feature {NONE} -- Initialization
make
+ local
+ l_message: STRING
+ l_factory: INET_ADDRESS_FACTORY
do
+ initialize_router
initialize_filter
initialize_json
- set_service_option ("port", 9090)
+ set_service_option ("port", port)
+ create l_message.make_empty
+ l_message.append_string ("Launching filter server at ")
+ create l_factory
+ l_message.append_string (l_factory.create_localhost.host_name)
+ l_message.append_string (" port ")
+ l_message.append_integer (port)
+ io.put_string (l_message)
+ io.put_new_line
make_and_launch
end
create_filter
-- Create `filter'
- local
- l_authentication_filter_hdl: AUTHENTICATION_FILTER
- l_user_filter: USER_HANDLER
- l_routing_filter: WSF_ROUTING_FILTER
do
- create router.make (1)
- create l_authentication_filter_hdl
- create l_user_filter
- l_authentication_filter_hdl.set_next (l_user_filter)
-
- router.handle_with_request_methods ("/user/{userid}", l_authentication_filter_hdl, router.methods_get)
- create l_routing_filter.make (router)
- l_routing_filter.set_execute_default_action (agent execute_default)
- filter := l_routing_filter
+ create {WSF_CORS_FILTER} filter
end
setup_filter
@@ -56,6 +66,28 @@ feature {NONE} -- Initialization
do
create l_logging_filter
filter.set_next (l_logging_filter)
+ l_logging_filter.set_next (Current)
+ end
+
+ setup_router
+ -- Setup `router'
+ local
+ l_options_filter: WSF_CORS_OPTIONS_FILTER
+ l_authentication_filter: AUTHENTICATION_FILTER
+ l_user_filter: USER_HANDLER
+ l_methods: WSF_REQUEST_METHODS
+ do
+ create l_options_filter.make (router)
+ create l_authentication_filter
+ create l_user_filter
+
+ l_options_filter.set_next (l_authentication_filter)
+ l_authentication_filter.set_next (l_user_filter)
+
+ create l_methods
+ l_methods.enable_options
+ l_methods.enable_get
+ router.handle_with_request_methods ("/user/{userid}", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent l_options_filter.execute), l_methods)
end
initialize_json
@@ -64,26 +96,10 @@ feature {NONE} -- Initialization
json.add_converter (create {JSON_USER_CONVERTER}.make)
end
-feature -- Basic operations
-
- execute (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- filter.execute (req, res)
- end
-
- execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
- local
- l_message: WSF_DEFAULT_ROUTER_RESPONSE
- do
- create l_message.make_with_router (req, router)
- l_message.set_documentation_included (True)
- res.send (l_message)
- end
-
feature {NONE} -- Implementation
- router: WSF_ROUTER;
- -- Router
+ port: INTEGER = 9090
+ -- Port number
note
copyright: "2011-2013, Olivier Ligot, Jocelyn Fiat and others"
diff --git a/library/network/protocol/http/src/http_header.e b/library/network/protocol/http/src/http_header.e
index e1bb19a7..aa1f89c0 100644
--- a/library/network/protocol/http/src/http_header.e
+++ b/library/network/protocol/http/src/http_header.e
@@ -504,6 +504,32 @@ feature -- Content-type helpers
put_content_type_multipart_encrypted do put_content_type ({HTTP_MIME_TYPES}.multipart_encrypted) end
put_content_type_application_x_www_form_encoded do put_content_type ({HTTP_MIME_TYPES}.application_x_www_form_encoded) end
+feature -- Cross-Origin Resource Sharing
+
+ put_access_control_allow_origin (s: READABLE_STRING_8)
+ -- Put "Access-Control-Allow-Origin" header.
+ do
+ put_header_key_value ({HTTP_HEADER_NAMES}.header_access_control_allow_origin, s)
+ end
+
+ put_access_control_allow_all_origin
+ -- Put "Access-Control-Allow-Origin: *" header.
+ do
+ put_access_control_allow_origin ("*")
+ end
+
+ put_access_control_allow_methods (a_methods: ITERABLE [READABLE_STRING_8])
+ -- If `a_methods' is not empty, put `Access-Control-Allow-Methods' header with list `a_methods' of methods
+ do
+ put_header_key_values ({HTTP_HEADER_NAMES}.header_access_control_allow_methods, a_methods, Void)
+ end
+
+ put_access_control_allow_headers (s: READABLE_STRING_8)
+ -- Put "Access-Control-Allow-Headers" header.
+ do
+ put_header_key_value ({HTTP_HEADER_NAMES}.header_access_control_allow_headers, s)
+ end
+
feature -- Method related
put_allow (a_methods: ITERABLE [READABLE_STRING_8])
diff --git a/library/network/protocol/http/src/http_header_names.e b/library/network/protocol/http/src/http_header_names.e
index 8d679ea9..4bab76e8 100644
--- a/library/network/protocol/http/src/http_header_names.e
+++ b/library/network/protocol/http/src/http_header_names.e
@@ -194,6 +194,23 @@ feature -- Response header name
-- Indicates the authentication scheme that should be used to access the requested entity.
--| Example: WWW-Authenticate: Basic
+feature -- Cross-Origin Resource Sharing
+
+ header_access_control_allow_origin: STRING = "Access-Control-Allow-Origin"
+ -- Indicates whether a resource can be shared based by returning
+ -- the value of the Origin request header in the response.
+ -- | Example: Access-Control-Allow-Origin: http://example.org
+
+ header_access_control_allow_methods: STRING = "Access-Control-Allow-Methods"
+ -- Indicates, as part of the response to a preflight request,
+ -- which methods can be used during the actual request.
+ -- | Example: Access-Control-Allow-Methods: PUT, DELETE
+
+ header_access_control_allow_headers: STRING = "Access-Control-Allow-Headers"
+ -- Indicates, as part of the response to a preflight request,
+ -- which header field names can be used during the actual request.
+ -- | Example: Access-Control-Allow-Headers: Authorization
+
feature -- Request or Response header name
header_cache_control: STRING = "Cache-Control"
@@ -248,7 +265,7 @@ feature -- MIME related
header_content_transfer_encoding: STRING = "Content-Transfer-Encoding"
note
- copyright: "2011-2012, Jocelyn Fiat, Eiffel Software and others"
+ copyright: "2011-2013, Jocelyn Fiat, 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/authentication/http_authorization/src/http_authorization.e b/library/server/authentication/http_authorization/src/http_authorization.e
index 6d1877a7..9e00dc70 100644
--- a/library/server/authentication/http_authorization/src/http_authorization.e
+++ b/library/server/authentication/http_authorization/src/http_authorization.e
@@ -92,5 +92,19 @@ feature -- Access
http_authorization: detachable IMMUTABLE_STRING_8
+feature -- Status report
+
+ is_basic: BOOLEAN
+ -- Is Basic authorization?
+ do
+ if attached type as t then
+ Result := t.same_string ("basic")
+ end
+ end
+
+invariant
+
+ type_is_lower: attached type as t implies t.same_string (t.as_lower)
+
end
diff --git a/library/server/ewsgi/specification/request/wgi_meta_names.e b/library/server/ewsgi/specification/request/wgi_meta_names.e
index 4b2f10b8..7eeb913e 100644
--- a/library/server/ewsgi/specification/request/wgi_meta_names.e
+++ b/library/server/ewsgi/specification/request/wgi_meta_names.e
@@ -50,6 +50,8 @@ feature -- Access
http_transfer_encoding: STRING = "HTTP_TRANSFER_ENCODING"
+ http_access_control_request_headers: STRING = "HTTP_ACCESS_CONTROL_REQUEST_HEADERS"
+
gateway_interface: STRING = "GATEWAY_INTERFACE"
auth_type: STRING = "AUTH_TYPE"
diff --git a/library/server/ewsgi/specification/request/wgi_request.e b/library/server/ewsgi/specification/request/wgi_request.e
index 1dccd709..86e1e489 100644
--- a/library/server/ewsgi/specification/request/wgi_request.e
+++ b/library/server/ewsgi/specification/request/wgi_request.e
@@ -598,6 +598,12 @@ feature -- HTTP_*
deferred
end
+ http_access_control_request_headers: detachable READABLE_STRING_8
+ -- Indicates which headers will be used in the actual request
+ -- as part of the preflight request
+ deferred
+ end
+
feature -- Extra CGI environment variables
request_uri: READABLE_STRING_8
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 2bfa00d6..79fb3007 100644
--- a/library/server/ewsgi/src/implementation/wgi_request_from_table.e
+++ b/library/server/ewsgi/src/implementation/wgi_request_from_table.e
@@ -241,6 +241,13 @@ feature -- Access: HTTP_* CGI meta parameters - 1.1
Result := meta_string_variable ({WGI_META_NAMES}.http_transfer_encoding)
end
+ http_access_control_request_headers: detachable READABLE_STRING_8
+ -- Indicates which headers will be used in the actual request
+ -- as part of the preflight request
+ do
+ Result := meta_string_variable ({WGI_META_NAMES}.http_access_control_request_headers)
+ end
+
feature -- Access: Extension to CGI meta parameters - 1.1
request_uri: READABLE_STRING_8
diff --git a/library/server/wsf/router/filter/wsf_cors_filter.e b/library/server/wsf/router/filter/wsf_cors_filter.e
new file mode 100644
index 00000000..75db6afe
--- /dev/null
+++ b/library/server/wsf/router/filter/wsf_cors_filter.e
@@ -0,0 +1,37 @@
+note
+ description: "Cross-Origin Resource Sharing filter."
+ author: "Olivier Ligot"
+ date: "$Date$"
+ revision: "$Revision$"
+ EIS: "name=Cross-Origin Resource Sharing", "src=http://www.w3.org/TR/cors/", "tag=W3C"
+
+class
+ WSF_CORS_FILTER
+
+inherit
+ WSF_FILTER
+
+feature -- Basic operations
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ -- Execute the filter.
+ local
+ l_header: HTTP_HEADER
+ do
+ create l_header.make
+ l_header.put_access_control_allow_all_origin
+ res.put_header_text (l_header.string)
+ execute_next (req, res)
+ end
+
+note
+ copyright: "2011-2013, 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/filter/wsf_cors_options_filter.e b/library/server/wsf/router/filter/wsf_cors_options_filter.e
new file mode 100644
index 00000000..9b2ad468
--- /dev/null
+++ b/library/server/wsf/router/filter/wsf_cors_options_filter.e
@@ -0,0 +1,57 @@
+note
+ description: "Filter that handles an OPTIONS request, with Cross-Origin Resource Sharing support."
+ author: "Olvier Ligot"
+ date: "$Date$"
+ revision: "$Revision$"
+ EIS: "name=Cross-Origin Resource Sharing", "src=http://www.w3.org/TR/cors/", "tag=W3C"
+
+class
+ WSF_CORS_OPTIONS_FILTER
+
+inherit
+ WSF_FILTER
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (a_router: like router)
+ -- Initialize Current with `a_router'.
+ do
+ router := a_router
+ ensure
+ router_set: router = a_router
+ end
+
+feature -- Access
+
+ router: WSF_ROUTER
+ -- Associated router
+
+feature -- Basic operations
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ -- Execute the filter.
+ local
+ msg: WSF_CORS_OPTIONS_RESPONSE
+ do
+ if req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) then
+ create msg.make (req, router)
+ res.send (msg)
+ else
+ execute_next (req, res)
+ end
+ end
+
+note
+ copyright: "2011-2013, 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/filter/wsf_filter.e b/library/server/wsf/router/filter/wsf_filter.e
index 7b6e5136..9e4ea502 100644
--- a/library/server/wsf/router/filter/wsf_filter.e
+++ b/library/server/wsf/router/filter/wsf_filter.e
@@ -14,7 +14,7 @@ feature -- Access
feature -- Element change
- set_next (a_next: WSF_FILTER)
+ set_next (a_next: like next)
-- Set `next' to `a_next'
do
next := a_next
@@ -26,6 +26,9 @@ feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter.
+ require
+ req_attached: req /= Void
+ res_attached: res /= Void
deferred
end
@@ -33,6 +36,9 @@ feature {NONE} -- Implementation
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the `next' filter.
+ require
+ req_attached: req /= Void
+ res_attached: res /= Void
do
if attached next as n then
n.execute (req, res)
@@ -40,7 +46,7 @@ feature {NONE} -- Implementation
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/filter/wsf_filter_handler.e b/library/server/wsf/router/filter/wsf_filter_handler.e
index 7fc63ca1..0fa0ccbb 100644
--- a/library/server/wsf/router/filter/wsf_filter_handler.e
+++ b/library/server/wsf/router/filter/wsf_filter_handler.e
@@ -8,14 +8,14 @@ note
revision: "$Revision$"
deferred class
- WSF_FILTER_HANDLER
+ WSF_FILTER_HANDLER [G -> WSF_HANDLER]
inherit
WSF_HANDLER
feature -- Access
- next: detachable WSF_HANDLER
+ next: detachable G
-- Next handler
feature -- Element change
@@ -29,7 +29,7 @@ feature -- Element change
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/filter/wsf_filtered_service.e b/library/server/wsf/router/filter/wsf_filtered_service.e
index f60740e0..f7cb826d 100644
--- a/library/server/wsf/router/filter/wsf_filtered_service.e
+++ b/library/server/wsf/router/filter/wsf_filtered_service.e
@@ -35,8 +35,15 @@ feature -- Access
filter: WSF_FILTER
-- Filter
+feature -- Execution
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ filter.execute (req, res)
+ end
+
;note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/filter/wsf_handler_filter_wrapper.e b/library/server/wsf/router/filter/wsf_handler_filter_wrapper.e
new file mode 100644
index 00000000..f0a312e2
--- /dev/null
+++ b/library/server/wsf/router/filter/wsf_handler_filter_wrapper.e
@@ -0,0 +1,53 @@
+note
+ description: "[
+ Handler wrapping a filter
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WSF_HANDLER_FILTER_WRAPPER
+
+inherit
+ WSF_HANDLER
+
+create
+ make_with_filter
+
+feature {NONE} -- Initialization
+
+ make_with_filter (f: WSF_FILTER)
+ -- Build Current with `f'.
+ require
+ f_attached: f /= Void
+ do
+ filter := f
+ ensure
+ filter_set: filter = f
+ end
+
+feature -- Access
+
+ filter: WSF_FILTER
+ -- Associated filter.
+
+feature -- Execution
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ -- Execute handler for `req' and respond in `res'
+ -- by passing through filter `filter'
+ do
+ filter.execute (req, res)
+ end
+
+note
+ copyright: "2011-2013, 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/filter/wsf_routing_filter.e b/library/server/wsf/router/filter/wsf_routing_filter.e
index d1018610..7f398ef4 100644
--- a/library/server/wsf/router/filter/wsf_routing_filter.e
+++ b/library/server/wsf/router/filter/wsf_routing_filter.e
@@ -44,10 +44,12 @@ feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
+ local
+ sess: WSF_ROUTER_SESSION
do
- if attached router.dispatch_and_return_handler (req, res) then
- check router.is_dispatched end
- else
+ create sess
+ router.dispatch (req, res, sess)
+ if not sess.dispatched then
execute_default (req, res)
end
execute_next (req, res)
@@ -63,7 +65,7 @@ feature -- Basic operations
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e b/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e
index fe3c15c8..3fd11575 100644
--- a/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e
+++ b/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e
@@ -8,18 +8,10 @@ deferred class
WSF_STARTS_WITH_FILTER_HANDLER
inherit
- WSF_FILTER_HANDLER
- redefine
- next
- end
+ WSF_FILTER_HANDLER [WSF_STARTS_WITH_HANDLER]
WSF_STARTS_WITH_HANDLER
-feature -- Access
-
- next: detachable WSF_STARTS_WITH_FILTER_HANDLER
- -- Next handler
-
feature -- Execution
execute_next (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -30,7 +22,7 @@ feature -- Execution
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping_i.e b/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping_i.e
index 7618171c..63774e5f 100644
--- a/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping_i.e
+++ b/library/server/wsf/router/support/starts_with/wsf_starts_with_mapping_i.e
@@ -58,7 +58,7 @@ feature -- Status
Result := p.starts_with (s)
end
- routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
+ try (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
-- Return the handler if Current matches the request `req'.
local
p: READABLE_STRING_8
@@ -67,7 +67,7 @@ feature -- Status
p := path_from_request (req)
s := based_uri (uri, a_router)
if p.starts_with (s) then
- Result := handler
+ sess.set_dispatched_handler (handler)
a_router.execute_before (Current)
execute_handler (handler, s, req, res)
a_router.execute_after (Current)
@@ -113,7 +113,7 @@ invariant
uri_attached: uri /= Void
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_agent_handler.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_agent_handler.e
index 9750cc81..03a28fdd 100644
--- a/library/server/wsf/router/support/uri/helpers/wsf_uri_agent_handler.e
+++ b/library/server/wsf/router/support/uri/helpers/wsf_uri_agent_handler.e
@@ -20,6 +20,8 @@ feature {NONE} -- Initialization
action := a_action
end
+feature -- Access
+
action: PROCEDURE [ANY, TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
feature -- Execution
@@ -30,7 +32,7 @@ feature -- Execution
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e
index 79ae3970..2758c84a 100644
--- a/library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e
+++ b/library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e
@@ -8,18 +8,10 @@ deferred class
WSF_URI_FILTER_HANDLER
inherit
- WSF_FILTER_HANDLER
- redefine
- next
- end
+ WSF_FILTER_HANDLER [WSF_URI_HANDLER]
WSF_URI_HANDLER
-feature -- Access
-
- next: detachable WSF_URI_FILTER_HANDLER
- -- Next handler
-
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -30,7 +22,7 @@ feature -- Execution
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e
index cbb68d28..f57ee2c2 100644
--- a/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e
+++ b/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e
@@ -7,35 +7,15 @@ note
deferred class
WSF_URI_ROUTED_SERVICE
+obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_ROUTER_HELPER [2013-mar-19]"
+
inherit
WSF_ROUTED_SERVICE
-feature -- Mapping helper: uri
-
- map_uri (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER)
- do
- map_uri_with_request_methods (a_uri, h, Void)
- end
-
- map_uri_with_request_methods (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
- do
- router.map_with_request_methods (create {WSF_URI_MAPPING}.make (a_uri, h), rqst_methods)
- end
-
-feature -- Mapping helper: uri agent
-
- map_uri_agent (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
- do
- map_uri_agent_with_request_methods (a_uri, proc, Void)
- end
-
- map_uri_agent_with_request_methods (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
- do
- map_uri_with_request_methods (a_uri, create {WSF_URI_AGENT_HANDLER}.make (proc), rqst_methods)
- end
+ WSF_URI_ROUTER_HELPER
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_router_helper.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_router_helper.e
new file mode 100644
index 00000000..607e5bb8
--- /dev/null
+++ b/library/server/wsf/router/support/uri/helpers/wsf_uri_router_helper.e
@@ -0,0 +1,50 @@
+note
+ description: "Summary description for {WSF_URI_ROUTER_HELPER}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_URI_ROUTER_HELPER
+
+feature -- Access
+
+ router: WSF_ROUTER
+ deferred
+ end
+
+feature -- Mapping helper: uri
+
+ map_uri (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER)
+ do
+ map_uri_with_request_methods (a_uri, h, Void)
+ end
+
+ map_uri_with_request_methods (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
+ do
+ router.map_with_request_methods (create {WSF_URI_MAPPING}.make (a_uri, h), rqst_methods)
+ end
+
+feature -- Mapping helper: uri agent
+
+ map_uri_agent (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
+ do
+ map_uri_agent_with_request_methods (a_uri, proc, Void)
+ end
+
+ map_uri_agent_with_request_methods (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
+ do
+ map_uri_with_request_methods (a_uri, create {WSF_URI_AGENT_HANDLER}.make (proc), rqst_methods)
+ 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)"
+ 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/support/uri/wsf_uri_mapping_i.e b/library/server/wsf/router/support/uri/wsf_uri_mapping_i.e
index cac518fd..aa69a860 100644
--- a/library/server/wsf/router/support/uri/wsf_uri_mapping_i.e
+++ b/library/server/wsf/router/support/uri/wsf_uri_mapping_i.e
@@ -72,10 +72,10 @@ feature -- Status
end
end
- routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
+ try (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
do
if is_mapping (req, a_router) then
- Result := handler
+ sess.set_dispatched_handler (handler)
a_router.execute_before (Current)
execute_handler (handler, req, res)
a_router.execute_after (Current)
@@ -105,7 +105,7 @@ feature {NONE} -- Implementation
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_agent_handler.e b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_agent_handler.e
index 477e0545..cfe05c53 100644
--- a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_agent_handler.e
+++ b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_agent_handler.e
@@ -20,6 +20,8 @@ feature {NONE} -- Initialization
action := a_action
end
+feature -- Access
+
action: PROCEDURE [ANY, TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
feature -- Execution
@@ -30,7 +32,7 @@ feature -- Execution
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e
index e6a1d02a..8762a0e2 100644
--- a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e
+++ b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e
@@ -8,18 +8,10 @@ deferred class
WSF_URI_TEMPLATE_FILTER_HANDLER
inherit
- WSF_FILTER_HANDLER
- redefine
- next
- end
+ WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
WSF_URI_TEMPLATE_HANDLER
-feature -- Access
-
- next: detachable WSF_URI_TEMPLATE_HANDLER
- -- Next handler
-
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -30,7 +22,7 @@ feature -- Execution
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e
index 51b27375..d595c3e4 100644
--- a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e
+++ b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e
@@ -6,11 +6,14 @@ note
deferred class WSF_URI_TEMPLATE_ROUTED_SERVICE
+obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_ROUTER_HELPER [2013-mar-19]"
+
inherit
-
+
WSF_ROUTED_SERVICE
- WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE
+ WSF_URI_TEMPLATE_ROUTER_HELPER
+
note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
diff --git a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_router_helper.e b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_router_helper.e
new file mode 100644
index 00000000..cf60b7f0
--- /dev/null
+++ b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_router_helper.e
@@ -0,0 +1,66 @@
+note
+ description: "Summary description for {WSF_URI_TEMPLATE_ROUTER_HELPER}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_URI_TEMPLATE_ROUTER_HELPER
+
+feature -- Access
+
+ router: WSF_ROUTER
+ deferred
+ end
+
+feature -- Mapping helper: uri
+
+ map_uri_template (a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER)
+ -- Map `h' as handler for `a_tpl'
+ require
+ a_tpl_attached: a_tpl /= Void
+ h_attached: h /= Void
+ do
+ map_uri_template_with_request_methods (a_tpl, h, Void)
+ end
+
+ map_uri_template_with_request_methods (a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
+ -- Map `h' as handler for `a_tpl' for request methods `rqst_methods'.
+ require
+ a_tpl_attached: a_tpl /= Void
+ h_attached: h /= Void
+ do
+ router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, h), rqst_methods)
+ end
+
+feature -- Mapping helper: uri agent
+
+ map_uri_template_agent (a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
+ -- Map `proc' as handler for `a_tpl'
+ require
+ a_tpl_attached: a_tpl /= Void
+ proc_attached: proc /= Void
+ do
+ map_uri_template_agent_with_request_methods (a_tpl, proc, Void)
+ end
+
+ map_uri_template_agent_with_request_methods (a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
+ -- Map `proc' as handler for `a_tpl' for request methods `rqst_methods'.
+ require
+ a_tpl_attached: a_tpl /= Void
+ proc_attached: proc /= Void
+ do
+ map_uri_template_with_request_methods (a_tpl, create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (proc), rqst_methods)
+ end
+
+note
+ copyright: "2011-2013, 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/support/uri_template/wsf_uri_template_mapping_i.e b/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping_i.e
index 0a047949..f1430fa0 100644
--- a/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping_i.e
+++ b/library/server/wsf/router/support/uri_template/wsf_uri_template_mapping_i.e
@@ -24,7 +24,7 @@ feature {NONE} -- Initialization
-- Create with `h' as the handler for resources matching `tpl'
require
tpl_attached: tpl /= Void
- h_attached: h /= Void
+ h_attached: h /= Void
do
template := tpl
set_handler (h)
@@ -68,7 +68,7 @@ feature -- Status
Result := tpl.match (p) /= Void
end
- routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
+ try (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
--
local
tpl: URI_TEMPLATE
@@ -78,7 +78,7 @@ feature -- Status
p := path_from_request (req)
tpl := based_uri_template (template, a_router)
if attached tpl.match (p) as tpl_res then
- Result := handler
+ sess.set_dispatched_handler (handler)
a_router.execute_before (Current)
--| Applied the context to the request
--| in practice, this will fill the {WSF_REQUEST}.path_parameters
@@ -126,7 +126,7 @@ feature {NONE} -- Implementation
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/wsf_handler.e b/library/server/wsf/router/wsf_handler.e
index 3d15e03f..ae258233 100644
--- a/library/server/wsf/router/wsf_handler.e
+++ b/library/server/wsf/router/wsf_handler.e
@@ -1,6 +1,7 @@
note
- description: "Summary description for {WSF_HANDLER}."
- author: ""
+ description: "[
+ Represents the ancestor of all the WSF_ROUTER handler.
+ ]"
date: "$Date$"
revision: "$Revision$"
@@ -27,7 +28,7 @@ feature {WSF_ROUTER} -- Mapping
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/wsf_routed_service.e b/library/server/wsf/router/wsf_routed_service.e
index 22f7a0c1..9c112317 100644
--- a/library/server/wsf/router/wsf_routed_service.e
+++ b/library/server/wsf/router/wsf_routed_service.e
@@ -40,10 +40,12 @@ feature -- Execution
require
req_attached: req /= Void
res_attached: res /= Void
+ local
+ sess: WSF_ROUTER_SESSION
do
- if attached router.dispatch_and_return_handler (req, res) as p then
- -- executed
- else
+ create sess
+ router.dispatch (req, res, sess)
+ if not sess.dispatched then
execute_default (req, res)
end
ensure
diff --git a/library/server/wsf/router/wsf_router.e b/library/server/wsf/router/wsf_router.e
index 30785eb7..786d853a 100644
--- a/library/server/wsf/router/wsf_router.e
+++ b/library/server/wsf/router/wsf_router.e
@@ -112,75 +112,84 @@ feature -- Mapping handler
map_with_request_methods (f.new_mapping (a_resource), rqst_methods)
end
-feature -- Access
-
- is_dispatched: BOOLEAN
- -- `dispatch' set `is_dispatched' to True
- -- if mapping was found, and associated handler executed
-
feature -- Basic operations
- dispatch (req: WSF_REQUEST; res: WSF_RESPONSE)
+ dispatch (req: WSF_REQUEST; res: WSF_RESPONSE; sess: detachable WSF_ROUTER_SESSION)
-- Dispatch request `req' among the `mappings'.
- -- Set `is_dispatched' if the request were dispatched.
+ -- Set `sess' if the request were dispatched and `sess' attached.
require
req_attached: req /= Void
res_attached: res /= Void
+ local
+ l_sess: detachable WSF_ROUTER_SESSION
do
- if attached dispatch_and_return_handler (req, res) then
- check is_dispatched: is_dispatched end
+ l_sess := sess
+ if l_sess = Void then
+ create l_sess
end
+ router_dispatch (req, res, l_sess)
end
dispatch_and_return_handler (req: WSF_REQUEST; res: WSF_RESPONSE): detachable WSF_HANDLER
-- Dispatch request `req' among the `mappings'
-- And return the associated handler if mapping found and handler executed.
--| Violates CQS
+ obsolete
+ "Use `dispatch' [2013-mar-21]"
require
req_attached: req /= Void
res_attached: res /= Void
+ local
+ sess: WSF_ROUTER_SESSION
+ do
+ create sess
+ router_dispatch (req, res, sess)
+ Result := sess.dispatched_handler
+ end
+
+feature {NONE} -- Dispatch implementation
+
+ router_dispatch (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION)
+ require
+ req_attached: req /= Void
+ res_attached: res /= Void
+ sess_attached: sess /= Void
+ sess_not_dispatched: not sess.dispatched
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
+ router_dispatch_for_request_method (req, res, sess, l_req_method)
+ if not sess.dispatched and l_req_method = {HTTP_REQUEST_METHODS}.method_head then
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)
+ router_dispatch_for_request_method (req, head_res, sess, {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
+ router_dispatch_for_request_method (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_request_method: READABLE_STRING_8)
-- Dispatch request `req' among the `mappings'
-- And return the associated handler if mapping found and handler executed.
--| Violates CQS
require
req_attached: req /= Void
res_attached: res /= Void
+ sess_attached: sess /= Void
+ sess_not_dispatched: not sess.dispatched
a_request_method_attached: a_request_method /= Void
local
m: WSF_ROUTER_MAPPING
do
- is_dispatched := False
-
across
mappings as c
until
- Result /= Void
+ sess.dispatched
loop
if attached c.item as l_info 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
- Result := r
- end
+ m.try (req, res, sess, Current)
end
end
end
diff --git a/library/server/wsf/router/wsf_router_mapping.e b/library/server/wsf/router/wsf_router_mapping.e
index 89f53303..6f7b4605 100644
--- a/library/server/wsf/router/wsf_router_mapping.e
+++ b/library/server/wsf/router/wsf_router_mapping.e
@@ -1,6 +1,7 @@
note
- description: "Summary description for {WSF_ROUTER_MAPPING}."
- author: ""
+ description: "[
+ Describes a route or mapping for the WSF_ROUTER
+ ]"
date: "$Date$"
revision: "$Revision$"
@@ -23,14 +24,14 @@ feature {NONE} -- Initialization
feature -- Access
associated_resource: READABLE_STRING_8
- -- Name (URI, or URI template or regular expression or ...) of handled resource
+ -- Name (URI, or URI template or regular expression or ...) of handled resource.
deferred
ensure
assciated_resource_not_void: Result /= Void
end
handler: WSF_HANDLER
- -- Handler associated with `Current' mapping
+ -- Handler associated with `Current' mapping.
deferred
ensure
handler_attached: Result /= Void
@@ -39,7 +40,7 @@ feature -- Access
feature -- Documentation
description: READABLE_STRING_32
- -- Short description of associated mapping
+ -- Short description of associated mapping.
deferred
ensure
description_attached: Result /= Void
@@ -63,11 +64,13 @@ feature -- Status
deferred
end
- routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
- -- Handler when `Current' matches the request `req'
+ try (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
+ -- Try using `Current' mapping and if it matches request `req'
+ -- execute associated handler and set this handler in session `sess'.
require
req_attached: req /= Void
res_attached: res /= Void
+ sess_attached: sess /= Void
a_router_attached: a_router /= Void
deferred
end
@@ -75,7 +78,7 @@ feature -- Status
feature -- Helper
path_from_request (req: WSF_REQUEST): READABLE_STRING_32
- -- Path used by `Current' to check that mapping matches request `req'
+ -- Path used by `Current' to check that mapping matches request `req'.
require
req_attached: req /= Void
do
diff --git a/library/server/wsf/router/wsf_router_session.e b/library/server/wsf/router/wsf_router_session.e
new file mode 100644
index 00000000..e5af83d0
--- /dev/null
+++ b/library/server/wsf/router/wsf_router_session.e
@@ -0,0 +1,46 @@
+note
+ description: "[
+ This class represents the processing of a request via a WSF_ROUTER.
+
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WSF_ROUTER_SESSION
+
+feature -- Status report
+
+ dispatched: BOOLEAN
+ -- Handler dispatched?
+ do
+ Result := dispatched_handler /= Void
+ ensure
+ Result implies dispatched_handler /= Void
+ end
+
+feature -- Access
+
+ dispatched_handler: detachable WSF_HANDLER
+ -- Handler dispatched
+
+feature -- Change
+
+ set_dispatched_handler (h: like dispatched_handler)
+ do
+ dispatched_handler := h
+ ensure
+ h_set: dispatched_handler = h
+ end
+
+note
+ copyright: "2011-2013, 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_routing_handler.e b/library/server/wsf/router/wsf_routing_handler.e
index 94b97fed..5aa855e5 100644
--- a/library/server/wsf/router/wsf_routing_handler.e
+++ b/library/server/wsf/router/wsf_routing_handler.e
@@ -54,16 +54,18 @@ feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
+ local
+ sess: WSF_ROUTER_SESSION
do
- if attached router.dispatch_and_return_handler (req, res) as h then
- check is_dispatched: router.is_dispatched end
- else
+ create sess
+ router.dispatch (req, res, sess)
+ if not sess.dispatched then
res.put_header ({HTTP_STATUS_CODE}.not_found, <<[{HTTP_HEADER_NAMES}.header_content_length, "0"]>>)
end
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/support/starts_with/context_helpers/wsf_starts_with_agent_context_handler.e b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_agent_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/starts_with/context_helpers/wsf_starts_with_agent_context_handler.e
rename to library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_agent_context_handler.e
diff --git a/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_routed_service.e b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_routed_service.e
new file mode 100644
index 00000000..c7b8245e
--- /dev/null
+++ b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_routed_service.e
@@ -0,0 +1,27 @@
+note
+ description: "Summary description for {WSF_STARTS_WITH_CONTEXT_ROUTED_SERVICE}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_STARTS_WITH_CONTEXT_ROUTED_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
+
+obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_STARTS_WITH_CONTEXT_ROUTER_HELPER [2013-mar-19]"
+
+inherit
+ WSF_ROUTED_SERVICE
+
+ WSF_STARTS_WITH_CONTEXT_ROUTER_HELPER [C]
+
+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/support/starts_with/context_helpers/wsf_starts_with_context_routed_service.e b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e
similarity index 92%
rename from library/server/wsf/router/support/starts_with/context_helpers/wsf_starts_with_context_routed_service.e
rename to library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e
index 19480c41..32fd3f62 100644
--- a/library/server/wsf/router/support/starts_with/context_helpers/wsf_starts_with_context_routed_service.e
+++ b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e
@@ -5,10 +5,13 @@ note
revision: "$Revision$"
deferred class
- WSF_STARTS_WITH_CONTEXT_ROUTED_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
+ WSF_STARTS_WITH_CONTEXT_ROUTER_HELPER [C -> WSF_HANDLER_CONTEXT create make end]
-inherit
- WSF_ROUTED_SERVICE
+feature -- Access
+
+ router: WSF_ROUTER
+ deferred
+ end
feature -- Mapping helper: starts_with
diff --git a/library/server/wsf/router/support/starts_with/context_helpers/wsf_starts_with_routing_context_handler.e b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_routing_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/starts_with/context_helpers/wsf_starts_with_routing_context_handler.e
rename to library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_routing_context_handler.e
diff --git a/library/server/wsf/router/support/starts_with/wsf_starts_with_context_handler.e b/library/server/wsf/router_context/support/starts_with/wsf_starts_with_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/starts_with/wsf_starts_with_context_handler.e
rename to library/server/wsf/router_context/support/starts_with/wsf_starts_with_context_handler.e
diff --git a/library/server/wsf/router/support/starts_with/wsf_starts_with_context_mapping.e b/library/server/wsf/router_context/support/starts_with/wsf_starts_with_context_mapping.e
similarity index 100%
rename from library/server/wsf/router/support/starts_with/wsf_starts_with_context_mapping.e
rename to library/server/wsf/router_context/support/starts_with/wsf_starts_with_context_mapping.e
diff --git a/library/server/wsf/router/support/uri/context_helpers/wsf_uri_agent_context_handler.e b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_agent_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/uri/context_helpers/wsf_uri_agent_context_handler.e
rename to library/server/wsf/router_context/support/uri/helpers/wsf_uri_agent_context_handler.e
diff --git a/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_routed_service.e b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_routed_service.e
new file mode 100644
index 00000000..46be558a
--- /dev/null
+++ b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_routed_service.e
@@ -0,0 +1,28 @@
+note
+ description: "Summary description for {WSF_URI_CONTEXT_ROUTED_SERVICE}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_URI_CONTEXT_ROUTED_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
+
+obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_CONTEXT_ROUTER_HELPER [2013-mar-19]"
+
+inherit
+ WSF_ROUTED_SERVICE
+
+ WSF_URI_CONTEXT_ROUTER_HELPER [C]
+
+
+note
+ copyright: "2011-2013, 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/support/uri/context_helpers/wsf_uri_context_routed_service.e b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e
similarity index 87%
rename from library/server/wsf/router/support/uri/context_helpers/wsf_uri_context_routed_service.e
rename to library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e
index e0e2220b..db9734cf 100644
--- a/library/server/wsf/router/support/uri/context_helpers/wsf_uri_context_routed_service.e
+++ b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e
@@ -1,14 +1,17 @@
note
- description: "Summary description for {WSF_URI_CONTEXT_ROUTED_SERVICE}."
+ description: "Summary description for {WSF_URI_CONTEXT_ROUTER_HELPER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
- WSF_URI_CONTEXT_ROUTED_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
+ WSF_URI_CONTEXT_ROUTER_HELPER [C -> WSF_HANDLER_CONTEXT create make end]
-inherit
- WSF_ROUTED_SERVICE
+feature -- Access
+
+ router: WSF_ROUTER
+ deferred
+ end
feature -- Mapping helper: uri
diff --git a/library/server/wsf/router/support/uri/context_helpers/wsf_uri_routing_context_handler.e b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_routing_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/uri/context_helpers/wsf_uri_routing_context_handler.e
rename to library/server/wsf/router_context/support/uri/helpers/wsf_uri_routing_context_handler.e
diff --git a/library/server/wsf/router/support/uri/wsf_uri_context_handler.e b/library/server/wsf/router_context/support/uri/wsf_uri_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/uri/wsf_uri_context_handler.e
rename to library/server/wsf/router_context/support/uri/wsf_uri_context_handler.e
diff --git a/library/server/wsf/router/support/uri/wsf_uri_context_mapping.e b/library/server/wsf/router_context/support/uri/wsf_uri_context_mapping.e
similarity index 100%
rename from library/server/wsf/router/support/uri/wsf_uri_context_mapping.e
rename to library/server/wsf/router_context/support/uri/wsf_uri_context_mapping.e
diff --git a/library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_agent_context_handler.e b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_agent_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_agent_context_handler.e
rename to library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_agent_context_handler.e
diff --git a/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_routed_service.e b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_routed_service.e
new file mode 100644
index 00000000..e6ef848b
--- /dev/null
+++ b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_routed_service.e
@@ -0,0 +1,27 @@
+note
+ description: "Summary description for {WSF_URI_TEMPLATE_CONTEXT_ROUTED_SERVICE}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ WSF_URI_TEMPLATE_CONTEXT_ROUTED_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
+
+obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_TEMPLATE_CONTEXT_ROUTER_HELPER [2013-mar-19]"
+
+inherit
+ WSF_ROUTED_SERVICE
+
+ WSF_URI_TEMPLATE_CONTEXT_ROUTER_HELPER [C]
+
+note
+ copyright: "2011-2013, 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/support/uri_template/context_helpers/wsf_uri_template_context_routed_service.e b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e
similarity index 90%
rename from library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_context_routed_service.e
rename to library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e
index 45f698b9..d67c4db2 100644
--- a/library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_context_routed_service.e
+++ b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e
@@ -1,14 +1,17 @@
note
- description: "Summary description for {WSF_URI_TEMPLATE_CONTEXT_ROUTED_SERVICE}."
+ description: "Summary description for {WSF_URI_TEMPLATE_CONTEXT_ROUTER_HELPER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
- WSF_URI_TEMPLATE_CONTEXT_ROUTED_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
+ WSF_URI_TEMPLATE_CONTEXT_ROUTER_HELPER [C -> WSF_HANDLER_CONTEXT create make end]
-inherit
- WSF_ROUTED_SERVICE
+feature -- Access
+
+ router: WSF_ROUTER
+ deferred
+ end
feature -- Mapping helper: uri
diff --git a/library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_filter_context_handler.e- b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_filter_context_handler.e-
similarity index 100%
rename from library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_filter_context_handler.e-
rename to library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_filter_context_handler.e-
diff --git a/library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_routing_context_handler.e b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_routing_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/uri_template/context_helpers/wsf_uri_template_routing_context_handler.e
rename to library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_routing_context_handler.e
diff --git a/library/server/wsf/router/support/uri_template/wsf_uri_template_context_handler.e b/library/server/wsf/router_context/support/uri_template/wsf_uri_template_context_handler.e
similarity index 100%
rename from library/server/wsf/router/support/uri_template/wsf_uri_template_context_handler.e
rename to library/server/wsf/router_context/support/uri_template/wsf_uri_template_context_handler.e
diff --git a/library/server/wsf/router/support/uri_template/wsf_uri_template_context_mapping.e b/library/server/wsf/router_context/support/uri_template/wsf_uri_template_context_mapping.e
similarity index 100%
rename from library/server/wsf/router/support/uri_template/wsf_uri_template_context_mapping.e
rename to library/server/wsf/router_context/support/uri_template/wsf_uri_template_context_mapping.e
diff --git a/library/server/wsf/router/context/wsf_agent_context_handler.e b/library/server/wsf/router_context/wsf_agent_context_handler.e
similarity index 100%
rename from library/server/wsf/router/context/wsf_agent_context_handler.e
rename to library/server/wsf/router_context/wsf_agent_context_handler.e
diff --git a/library/server/wsf/router/context/wsf_context_handler.e b/library/server/wsf/router_context/wsf_context_handler.e
similarity index 100%
rename from library/server/wsf/router/context/wsf_context_handler.e
rename to library/server/wsf/router_context/wsf_context_handler.e
diff --git a/library/server/wsf/router/context/wsf_filter_context_handler.e b/library/server/wsf/router_context/wsf_filter_context_handler.e
similarity index 79%
rename from library/server/wsf/router/context/wsf_filter_context_handler.e
rename to library/server/wsf/router_context/wsf_filter_context_handler.e
index 761d509f..b137e066 100644
--- a/library/server/wsf/router/context/wsf_filter_context_handler.e
+++ b/library/server/wsf/router_context/wsf_filter_context_handler.e
@@ -8,18 +8,10 @@ deferred class
WSF_FILTER_CONTEXT_HANDLER [C -> WSF_HANDLER_CONTEXT create make end]
inherit
- WSF_FILTER_HANDLER
- redefine
- next
- end
+ WSF_FILTER_HANDLER [WSF_CONTEXT_HANDLER [C]]
WSF_CONTEXT_HANDLER [C]
-feature -- Access
-
- next: detachable WSF_CONTEXT_HANDLER [C]
- -- Next handler
-
feature {NONE} -- Implementation
execute_next (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -30,7 +22,7 @@ feature {NONE} -- Implementation
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/context/wsf_handler_context.e b/library/server/wsf/router_context/wsf_handler_context.e
similarity index 93%
rename from library/server/wsf/router/context/wsf_handler_context.e
rename to library/server/wsf/router_context/wsf_handler_context.e
index 7babdb27..91eaf745 100644
--- a/library/server/wsf/router/context/wsf_handler_context.e
+++ b/library/server/wsf/router_context/wsf_handler_context.e
@@ -31,7 +31,7 @@ feature -- Access
-- Associated mapping
;note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/router/context/wsf_router_context_mapping.e b/library/server/wsf/router_context/wsf_router_context_mapping.e
similarity index 100%
rename from library/server/wsf/router/context/wsf_router_context_mapping.e
rename to library/server/wsf/router_context/wsf_router_context_mapping.e
diff --git a/library/server/wsf/router/context/wsf_routing_context_handler.e b/library/server/wsf/router_context/wsf_routing_context_handler.e
similarity index 100%
rename from library/server/wsf/router/context/wsf_routing_context_handler.e
rename to library/server/wsf/router_context/wsf_routing_context_handler.e
diff --git a/library/server/wsf/src/response/wsf_cors_options_response.e b/library/server/wsf/src/response/wsf_cors_options_response.e
new file mode 100644
index 00000000..0c928e2a
--- /dev/null
+++ b/library/server/wsf/src/response/wsf_cors_options_response.e
@@ -0,0 +1,68 @@
+note
+ description: "Response to an OPTIONS request, with Cross-Origin Resource Sharing support."
+ author: "Olivier Ligt"
+ date: "$Date$"
+ revision: "$Revision$"
+ EIS: "name=Cross-Origin Resource Sharing", "src=http://www.w3.org/TR/cors/", "tag=W3C"
+
+class
+ WSF_CORS_OPTIONS_RESPONSE
+
+inherit
+ WSF_RESPONSE_MESSAGE
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (req: WSF_REQUEST; a_router: like router)
+ do
+ request := req
+ router := a_router
+ create header.make
+ end
+
+feature -- Access
+
+ request: WSF_REQUEST
+ -- Associated request
+
+ router: WSF_ROUTER
+ -- Associated router
+
+ header: HTTP_HEADER
+ -- Response' header
+
+feature {WSF_RESPONSE} -- Output
+
+ send_to (res: WSF_RESPONSE)
+ local
+ l_methods: WSF_REQUEST_METHODS
+ do
+ res.set_status_code ({HTTP_STATUS_CODE}.Ok)
+ header.put_content_type ({HTTP_MIME_TYPES}.text_plain)
+ header.put_current_date
+ header.put_content_length (0)
+ if attached request.http_access_control_request_headers as l_headers then
+ header.put_access_control_allow_headers (l_headers)
+ end
+ l_methods := router.allowed_methods_for_request (request)
+ if not l_methods.is_empty then
+ header.put_allow (l_methods)
+ header.put_access_control_allow_methods (l_methods)
+ end
+ res.put_header_text (header.string)
+ end
+
+note
+ copyright: "2011-2013, 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/response/wsf_download_response.e b/library/server/wsf/src/response/wsf_download_response.e
index aa8b7f3f..fada53f8 100644
--- a/library/server/wsf/src/response/wsf_download_response.e
+++ b/library/server/wsf/src/response/wsf_download_response.e
@@ -19,6 +19,7 @@ feature {NONE} -- Initialization
make (a_file_name: READABLE_STRING_8)
do
+ set_status_code ({HTTP_STATUS_CODE}.ok)
file_name := a_file_name
base_name := basename (a_file_name)
get_content_type
@@ -28,6 +29,7 @@ feature {NONE} -- Initialization
make_with_content_type (a_content_type: READABLE_STRING_8; a_filename: READABLE_STRING_8)
-- Initialize `Current'.
do
+ set_status_code ({HTTP_STATUS_CODE}.ok)
file_name := a_filename
base_name := basename (a_filename)
content_type := a_content_type
@@ -54,6 +56,14 @@ feature {NONE} -- Initialization
feature -- Element change
+ set_base_name (n: like base_name)
+ do
+ base_name := n
+ header.put_content_disposition ("attachment", "filename=%""+ n +"%"")
+ ensure
+ base_name_set: n.same_string (base_name)
+ end
+
set_expires (t: INTEGER)
do
header.put_expires (t)
@@ -91,7 +101,7 @@ feature -- Element change
set_status_code (c: like status_code)
-- Set `status_code' to `c'.
require
- valid_status_code: status_code > 0
+ valid_status_code: c > 0
do
status_code := c
ensure
@@ -207,8 +217,11 @@ feature -- Implementation: output
f.close
end
+invariant
+ status_code_set: status_code /= 0
+
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/src/response/wsf_file_response.e b/library/server/wsf/src/response/wsf_file_response.e
index 790cd944..8d00455b 100644
--- a/library/server/wsf/src/response/wsf_file_response.e
+++ b/library/server/wsf/src/response/wsf_file_response.e
@@ -19,6 +19,7 @@ feature {NONE} -- Initialization
make (a_file_name: READABLE_STRING_8)
do
+ set_status_code ({HTTP_STATUS_CODE}.ok)
file_name := a_file_name
get_content_type
initialize
@@ -27,6 +28,7 @@ feature {NONE} -- Initialization
make_with_content_type (a_content_type: READABLE_STRING_8; a_filename: READABLE_STRING_8)
-- Initialize `Current'.
do
+ set_status_code ({HTTP_STATUS_CODE}.ok)
file_name := a_filename
content_type := a_content_type
initialize
@@ -279,7 +281,7 @@ feature {NONE} -- Implementation: output
end
note
- copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ copyright: "2011-2013, 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
diff --git a/library/server/wsf/src/response/wsf_not_implemented_response.e b/library/server/wsf/src/response/wsf_not_implemented_response.e
new file mode 100644
index 00000000..d97388d1
--- /dev/null
+++ b/library/server/wsf/src/response/wsf_not_implemented_response.e
@@ -0,0 +1,81 @@
+note
+ description: "[
+ This class is used to report a 501 not implemented
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WSF_NOT_IMPLEMENTED_RESPONSE
+
+inherit
+ WSF_RESPONSE_MESSAGE
+
+ SHARED_HTML_ENCODER
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (req: WSF_REQUEST)
+ do
+ create header.make
+ request := req
+ end
+
+feature -- Header
+
+ header: HTTP_HEADER
+ -- Response' header
+
+ request: WSF_REQUEST
+ -- Associated request.
+
+ body: detachable READABLE_STRING_8
+ -- Optional body
+ -- Displayed as extra content
+
+feature -- Element change
+
+ set_body (b: like body)
+ -- Set `body' to `b'
+ do
+ body := b
+ end
+
+feature {WSF_RESPONSE} -- Output
+
+ send_to (res: WSF_RESPONSE)
+ local
+ s: STRING
+ h: like header
+ do
+ h := header
+ res.set_status_code ({HTTP_STATUS_CODE}.not_implemented)
+
+ s := "Error 501 Not Implemented ! "
+ s.append (request.request_uri)
+ if attached body as b then
+ s.append ("%N")
+ s.append (b)
+ s.append ("%N")
+ end
+ h.put_content_type_text_plain
+ h.put_content_length (s.count)
+ res.put_header_text (h.string)
+ res.put_string (s)
+ res.flush
+ end
+
+note
+ copyright: "2011-2013, 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 129c9937..bc755715 100644
--- a/library/server/wsf/src/wsf_request.e
+++ b/library/server/wsf/src/wsf_request.e
@@ -1041,6 +1041,13 @@ feature -- HTTP_*
Result := wgi_request.http_transfer_encoding
end
+ http_access_control_request_headers: detachable READABLE_STRING_8
+ -- Indicates which headers will be used in the actual request
+ -- as part of the preflight request
+ do
+ Result := wgi_request.http_access_control_request_headers
+ end
+
feature -- Extra CGI environment variables
request_uri: READABLE_STRING_8
diff --git a/library/server/wsf/wsf_extension-safe.ecf b/library/server/wsf/wsf_extension-safe.ecf
index 7bfa4489..5a46b2b5 100644
--- a/library/server/wsf/wsf_extension-safe.ecf
+++ b/library/server/wsf/wsf_extension-safe.ecf
@@ -12,7 +12,8 @@
-
+
+
diff --git a/library/server/wsf/wsf_extension.ecf b/library/server/wsf/wsf_extension.ecf
index cef881de..b9ce417f 100644
--- a/library/server/wsf/wsf_extension.ecf
+++ b/library/server/wsf/wsf_extension.ecf
@@ -13,6 +13,7 @@
+
diff --git a/library/server/wsf/wsf_router_context-safe.ecf b/library/server/wsf/wsf_router_context-safe.ecf
new file mode 100644
index 00000000..91b84d36
--- /dev/null
+++ b/library/server/wsf/wsf_router_context-safe.ecf
@@ -0,0 +1,16 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
diff --git a/library/server/wsf/wsf_router_context.ecf b/library/server/wsf/wsf_router_context.ecf
new file mode 100644
index 00000000..7dd0f8de
--- /dev/null
+++ b/library/server/wsf/wsf_router_context.ecf
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
diff --git a/tests/all-safe.ecf b/tests/all-safe.ecf
index 16747e1a..c7d6efe5 100644
--- a/tests/all-safe.ecf
+++ b/tests/all-safe.ecf
@@ -31,6 +31,7 @@
+
diff --git a/tools/install_ewf.bat b/tools/install_ewf.bat
index 0b8c344f..87f82c80 100644
--- a/tools/install_ewf.bat
+++ b/tools/install_ewf.bat
@@ -77,6 +77,11 @@ echo Install library: http
echo Install library: http_authorization
%SAFE_MD% %TMP_CONTRIB_DIR%\library\network\authentication
%COPYCMD% %TMP_DIR%\library\server\authentication\http_authorization %TMP_CONTRIB_DIR%\library\network\authentication\http_authorization
+
+echo Install library: openid
+%SAFE_MD% %TMP_CONTRIB_DIR%\library\security
+%COPYCMD% %TMP_DIR%\library\security\openid %TMP_CONTRIB_DIR%\library\security\openid
+
echo Install library: uri_template
%COPYCMD% %TMP_DIR%\library\text\parser\uri_template %TMP_CONTRIB_DIR%\library\text\parser\uri_template
diff --git a/tools/install_ewf.sh b/tools/install_ewf.sh
index 1275abb6..b36c5bfd 100644
--- a/tools/install_ewf.sh
+++ b/tools/install_ewf.sh
@@ -70,6 +70,9 @@ COPYCMD $TMP_DIR/library/network/protocol/http $TMP_CONTRIB_DIR/library/network/
echo Install library: http_authorization
mkdir -p $TMP_CONTRIB_DIR/library/network/authentication
COPYCMD $TMP_DIR/library/server/authentication/http_authorization $TMP_CONTRIB_DIR/library/network/authentication/http_authorization
+echo Install library: openid
+mkdir -p $TMP_CONTRIB_DIR/library/security/openid
+COPYCMD $TMP_DIR/library/security/openid $TMP_CONTRIB_DIR/library/security/openid
echo Install library: uri_template
mkdir -p $TMP_CONTRIB_DIR/library/text/parser
COPYCMD $TMP_DIR/library/text/parser/uri_template $TMP_CONTRIB_DIR/library/text/parser/uri_template
diff --git a/tools/uninstall_ewf.bat b/tools/uninstall_ewf.bat
index 6f76a298..5bee1b31 100644
--- a/tools/uninstall_ewf.bat
+++ b/tools/uninstall_ewf.bat
@@ -54,10 +54,14 @@ echo Uninstall library: http_client
%RDCMD% %TMP_CONTRIB_DIR%\library\network\http_client
echo Uninstall library: http
%RDCMD% %TMP_CONTRIB_DIR%\library\network\protocol\http
+echo Uninstall library: http_authorization
+%RDCMD% %TMP_CONTRIB_DIR%\library\network\authentication\http_authorization
+echo Uninstall library: security\openid
+%RDCMD% %TMP_CONTRIB_DIR%\library\security\openid
echo Uninstall library: uri_template
%RDCMD% %TMP_CONTRIB_DIR%\library\text\parser\uri_template
echo Uninstall contrib library: nino
-%RDCMD% %TMP_CONTRIB_DIR%\contrib\library\network\server\nino
+%RDCMD% %TMP_CONTRIB_DIR%\library\network\server\nino
:end