Updated various indexing notes.
Removed a few obsolete classes. Cosmetics
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||
description: "Service using default connector launcher: CGI"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE_LAUNCHER}."
|
||||
author: ""
|
||||
description: "Launcher for default connector: CGI"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||
description: "Service using default connector launcher: libFCGI"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE_LAUNCHER}."
|
||||
author: ""
|
||||
description: "Launcher for default connector: libFCGI"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||
description: "Service using default connector launcher: Nino"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||
description: "Service using default connector launcher: openshift"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||
description: "Service using default connector launcher: Standalone"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEBUG_FILTER}."
|
||||
description: "Filter implementing debug output in error stream, or `output' file."
|
||||
date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $"
|
||||
revision: "$Revision: 92585 $"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEBUG_HANDLER}."
|
||||
author: ""
|
||||
description: "Handler returning debug information."
|
||||
|
||||
date: "$Date: 2013-06-28 16:14:02 +0200 (ven., 28 juin 2013) $"
|
||||
revision: "$Revision: 92754 $"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_REQUEST_UTILITY}."
|
||||
author: ""
|
||||
description: "Collection of utilities routines for WSF_REQUEST."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
note
|
||||
description: "Summary description for {WSF_REQUES_UTILITY_PROXY}."
|
||||
author: ""
|
||||
description: "[
|
||||
Proxy interface on WSF_REQUEST_UTILITY interface.
|
||||
Used to factorize code.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
note
|
||||
description: "Summary description for {WSF_VALUE_UTILITY}."
|
||||
description: "[
|
||||
Collection of utilities routines to factorize code related to WSF_VALUE manipulation.
|
||||
]"
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -146,7 +146,7 @@ feature -- Access
|
||||
Result := True
|
||||
-- redefine to return `False', so as to induce a Vary: * header
|
||||
end
|
||||
|
||||
|
||||
allowed_cross_origins (req: WSF_REQUEST): detachable STRING
|
||||
-- Value for Access-Control-Allow-Origin header;
|
||||
-- If supplied, should be a single URI, or the values "*" or "null".
|
||||
@@ -177,7 +177,7 @@ feature -- Access
|
||||
req_attached: req /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
|
||||
last_modified (req: WSF_REQUEST): detachable DATE_TIME
|
||||
-- When representation of resource selected in `req' was last modified;
|
||||
-- SHOULD be set whenever it can reasonably be determined.
|
||||
@@ -503,7 +503,7 @@ feature -- Execution
|
||||
a_helper_attached: a_helper /= Void
|
||||
do
|
||||
a_helper.handle_content_negotiation (req, res, Current)
|
||||
if not res.status_is_set or else res.status_code /= {HTTP_STATUS_CODE}.Not_acceptable then
|
||||
if res.status_code /= {HTTP_STATUS_CODE}.Not_acceptable then
|
||||
check_resource_exists (req, a_helper)
|
||||
if a_helper.resource_exists then
|
||||
a_helper.execute_existing_resource (req, res, Current)
|
||||
@@ -538,7 +538,7 @@ feature -- Execution
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
handle_invalid_content_range (res: WSF_RESPONSE)
|
||||
-- Write "Bad Request" response to `res' for Content-Range header present in PUT request.
|
||||
require
|
||||
@@ -560,7 +560,7 @@ feature {NONE} -- Implementation
|
||||
status_is_service_unavailable: res.status_code = {HTTP_STATUS_CODE}.internal_server_error
|
||||
body_sent: res.message_committed and then res.transfered_content_length > 0
|
||||
end
|
||||
|
||||
|
||||
handle_internal_server_error (res: WSF_RESPONSE)
|
||||
-- Write "Internal Server Error" response to `res'.
|
||||
require
|
||||
@@ -584,7 +584,7 @@ feature {NONE} -- Implementation
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Colin Adams, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2014, Colin Adams, 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
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_FILTERED_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_FILTERED_SERVICE
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize_filter
|
||||
-- Initialize `filter'
|
||||
do
|
||||
create_filter
|
||||
setup_filter
|
||||
end
|
||||
|
||||
create_filter
|
||||
-- Create `filter'
|
||||
deferred
|
||||
ensure
|
||||
filter_created: filter /= Void
|
||||
end
|
||||
|
||||
setup_filter
|
||||
-- Setup `filter'
|
||||
require
|
||||
filter_created: filter /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
filter: WSF_FILTER
|
||||
-- Filter
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
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
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTED_SKELETON_EXECUTION}."
|
||||
description: "Skeleton execution based on router."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTED_SKELETON_SERVICE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_ROUTED_SKELETON_SERVICE
|
||||
|
||||
inherit
|
||||
WSF_ROUTED_SERVICE
|
||||
redefine
|
||||
execute
|
||||
end
|
||||
|
||||
WSF_SYSTEM_OPTIONS_ACCESS_POLICY
|
||||
|
||||
WSF_PROXY_USE_POLICY
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- If the service is available, and request URI is not too long, dispatch the request
|
||||
-- and if handler is not found, execute the default procedure `execute_default'.
|
||||
local
|
||||
l_sess: WSF_ROUTER_SESSION
|
||||
do
|
||||
--| When we reach here, the request has already passed check for 400 (Bad request),
|
||||
--| which is implemented in WSF_REQUEST.make_from_wgi (when it calls `analyze').
|
||||
if unavailable then
|
||||
handle_unavailable (res)
|
||||
elseif requires_proxy (req) then
|
||||
handle_use_proxy (req, res)
|
||||
elseif
|
||||
maximum_uri_length > 0 and then
|
||||
req.request_uri.count.to_natural_32 > maximum_uri_length
|
||||
then
|
||||
handle_request_uri_too_long (res)
|
||||
elseif
|
||||
req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) and then
|
||||
req.request_uri.same_string ("*")
|
||||
then
|
||||
handle_server_options (req, res)
|
||||
else
|
||||
create l_sess
|
||||
router.dispatch (req, res, l_sess)
|
||||
if not l_sess.dispatched then
|
||||
execute_default (req, res)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Measurement
|
||||
|
||||
maximum_uri_length: NATURAL
|
||||
-- Maximum length in characters (or zero for no limit) permitted
|
||||
-- for {WSF_REQUEST}.request_uri
|
||||
|
||||
feature -- Status report
|
||||
|
||||
unavailable: BOOLEAN
|
||||
-- Is service currently unavailable?
|
||||
|
||||
unavailablity_message: detachable READABLE_STRING_8
|
||||
-- Message to be included as text of response body for {HTTP_STATUS_CODE}.service_unavailable
|
||||
|
||||
unavailability_duration: NATURAL
|
||||
-- Delta seconds for service unavailability (0 if not known)
|
||||
|
||||
unavailable_until: detachable DATE_TIME
|
||||
-- Time at which service becomes available again (if known)
|
||||
|
||||
feature -- Status setting
|
||||
|
||||
set_available
|
||||
-- Set `unavailable' to `False'.
|
||||
do
|
||||
unavailable := False
|
||||
unavailablity_message := Void
|
||||
unavailable_until := Void
|
||||
ensure
|
||||
available: unavailable = False
|
||||
unavailablity_message_detached: unavailablity_message = Void
|
||||
unavailable_until_detached: unavailable_until = Void
|
||||
end
|
||||
|
||||
set_unavailable (a_message: READABLE_STRING_8; a_duration: NATURAL; a_until: detachable DATE_TIME)
|
||||
-- Set `unavailable' to `True'.
|
||||
require
|
||||
a_message_attached: a_message /= Void
|
||||
a_duration_xor_a_until: a_duration > 0 implies a_until = Void
|
||||
do
|
||||
unavailable := True
|
||||
unavailablity_message := a_message
|
||||
unavailability_duration := a_duration
|
||||
ensure
|
||||
unavailable: unavailable = True
|
||||
unavailablity_message_aliased: unavailablity_message = a_message
|
||||
unavailability_duration_set: unavailability_duration = a_duration
|
||||
unavailable_until_aliased: unavailable_until = a_until
|
||||
end
|
||||
|
||||
set_maximum_uri_length (a_len: NATURAL)
|
||||
-- Set `maximum_uri_length' to `a_len'.
|
||||
-- Can pass zero to mean no restrictions.
|
||||
do
|
||||
maximum_uri_length := a_len
|
||||
ensure
|
||||
maximum_uri_length_set: maximum_uri_length = a_len
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
handle_unavailable (res: WSF_RESPONSE)
|
||||
-- Write "Service unavailable" response to `res'.
|
||||
require
|
||||
unavailable: unavailable
|
||||
res_attached: res /= Void
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
check attached unavailablity_message as m then
|
||||
-- invariant `unavailability_message_attached' plus precondition `unavailable'
|
||||
h.put_content_length (m.count)
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.service_unavailable)
|
||||
if unavailability_duration > 0 then
|
||||
h.put_header_key_value ({HTTP_HEADER_NAMES}.header_retry_after, unavailability_duration.out)
|
||||
elseif attached unavailable_until as u then
|
||||
h.put_header_key_value ({HTTP_HEADER_NAMES}.header_retry_after,
|
||||
h.date_to_rfc1123_http_date_format (u))
|
||||
end
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (m)
|
||||
end
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
status_is_service_unavailable: res.status_code = {HTTP_STATUS_CODE}.service_unavailable
|
||||
body_sent: res.message_committed and then res.transfered_content_length > 0
|
||||
body_content_was_unavailablity_message: True -- doesn't seem to be any way to check
|
||||
end
|
||||
|
||||
handle_request_uri_too_long (res: WSF_RESPONSE)
|
||||
-- Write "Request URI too long" response into `res'.
|
||||
require
|
||||
res_attached: res /= Void
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
m: READABLE_STRING_8
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
h.put_current_date
|
||||
m := "Maximum permitted length for request URI is " + maximum_uri_length.out + " characters"
|
||||
h.put_content_length (m.count)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.request_uri_too_long)
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (m)
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
status_is_request_uri_too_long: res.status_code = {HTTP_STATUS_CODE}.request_uri_too_long
|
||||
body_sent: res.message_committed and then res.transfered_content_length > 0
|
||||
end
|
||||
|
||||
frozen handle_server_options (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Write response to OPTIONS * into `res'.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
method_is_options: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options)
|
||||
server_options_requested: req.request_uri.same_string ("*")
|
||||
do
|
||||
--| First check if forbidden.
|
||||
--| (N.B. authentication requires an absoluteURI (RFC3617 page 3), and so cannot be used for OPTIONS *.
|
||||
--| Otherwise construct an Allow response automatically from the router.
|
||||
if is_system_options_forbidden (req) then
|
||||
handle_system_options_forbidden (req, res)
|
||||
else
|
||||
handle_system_options (req, res)
|
||||
end
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
valid_response_code: res.status_code = {HTTP_STATUS_CODE}.forbidden or
|
||||
res.status_code = {HTTP_STATUS_CODE}.not_found or res.status_code = {HTTP_STATUS_CODE}.ok
|
||||
header_sent: res.header_committed and res.message_committed
|
||||
end
|
||||
|
||||
frozen handle_system_options_forbidden (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Write a 403 Forbidden or a 404 Not found response into `res'.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
method_is_options: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options)
|
||||
server_options_requested: req.request_uri.same_string ("*")
|
||||
local
|
||||
m: detachable READABLE_STRING_8
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
m := system_options_forbidden_text (req)
|
||||
if attached {READABLE_STRING_8} m as l_msg then
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
h.put_current_date
|
||||
h.put_content_length (l_msg.count)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.forbidden)
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (l_msg)
|
||||
else
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
h.put_current_date
|
||||
h.put_content_length (0)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.not_found)
|
||||
res.put_header_text (h.string)
|
||||
end
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
valid_response_code: res.status_code = {HTTP_STATUS_CODE}.forbidden or
|
||||
res.status_code = {HTTP_STATUS_CODE}.not_found
|
||||
header_sent: res.header_committed
|
||||
message_sent: res.message_committed
|
||||
end
|
||||
|
||||
handle_system_options (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Write response to OPTIONS * into `res'.
|
||||
-- This may be redefined by the user, but normally this will not be necessary.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
method_is_options: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options)
|
||||
server_options_requested: req.request_uri.same_string ("*")
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
h.put_current_date
|
||||
h.put_allow (router.all_allowed_methods)
|
||||
h.put_content_length (0)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||
res.put_header_text (h.string)
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
response_code_ok: res.status_code = {HTTP_STATUS_CODE}.ok
|
||||
header_sent: res.header_committed and res.message_committed
|
||||
empty_body: res.transfered_content_length = 0
|
||||
end
|
||||
|
||||
frozen handle_use_proxy (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Write Use Proxy response `res'.
|
||||
require
|
||||
res_attached: res /= Void
|
||||
req_attached: req /= Void
|
||||
proxy_required: requires_proxy (req)
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
h.put_current_date
|
||||
h.put_location (proxy_server (req).string)
|
||||
h.put_content_length (0)
|
||||
res.put_header_lines (h)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.use_proxy)
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
response_code_use_proxy: res.status_code = {HTTP_STATUS_CODE}.use_proxy
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
unavailability_message_attached: unavailable implies attached unavailablity_message as m and then
|
||||
m.count > 0
|
||||
unavailability_duration_xor_unavailable_until: unavailability_duration > 0 implies unavailable_until = Void
|
||||
|
||||
;note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, 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
|
||||
@@ -1,60 +0,0 @@
|
||||
note
|
||||
description: "Facilities inheritance to add URI base routing to a routed service"
|
||||
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class WSF_URI_HELPER_FOR_ROUTED_SERVICE
|
||||
|
||||
feature -- Access
|
||||
|
||||
router: WSF_ROUTER
|
||||
-- Router used to dispatch the request according to the WSF_REQUEST object
|
||||
-- and associated request methods;
|
||||
-- This should not be implemented by descendants. Instead, you gain an effective
|
||||
-- version by also inheriting from WSF_ROUTED_SERVICE, or one of it's descendants.
|
||||
deferred
|
||||
ensure
|
||||
router_not_void: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Mapping helper: uri
|
||||
|
||||
map_uri (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER)
|
||||
-- Map `h' as handler for `a_uri'
|
||||
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)
|
||||
-- Map `h' as handler for `a_uri' for request methods `rqst_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]])
|
||||
-- Map `proc' as handler for `a_uri'
|
||||
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)
|
||||
-- Map `proc' as handler for `a_uri' for request methods `rqst_methods'.
|
||||
do
|
||||
map_uri_with_request_methods (a_uri, create {WSF_URI_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
|
||||
@@ -1,73 +0,0 @@
|
||||
note
|
||||
|
||||
description: "Facilities inheritance to add URI template-base routing to a routed service"
|
||||
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE
|
||||
|
||||
feature -- Access
|
||||
|
||||
router: WSF_ROUTER
|
||||
-- Router used to dispatch the request according to the WSF_REQUEST object
|
||||
-- and associated request methods;
|
||||
-- This should not be implemented by descendants. Instead, you gain an effective
|
||||
-- version by also inheriting from WSF_ROUTED_SERVICE, or one of it's descendants.
|
||||
deferred
|
||||
ensure
|
||||
router_not_void: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Mapping helper: uri template
|
||||
|
||||
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 template 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
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTED_EXECUTION}."
|
||||
author: ""
|
||||
description: "Execution based on router."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTED_SERVICE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_ROUTED_SERVICE
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
initialize_router
|
||||
-- Initialize router
|
||||
do
|
||||
create_router
|
||||
setup_router
|
||||
end
|
||||
|
||||
create_router
|
||||
-- Create `router'
|
||||
--| could be redefine to initialize with proper capacity
|
||||
do
|
||||
create router.make (10)
|
||||
ensure
|
||||
router_created: router /= Void
|
||||
end
|
||||
|
||||
setup_router
|
||||
-- Setup `router'
|
||||
require
|
||||
router_created: router /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Dispatch the request
|
||||
-- and if handler is not found, execute the default procedure `execute_default'.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
local
|
||||
sess: WSF_ROUTER_SESSION
|
||||
do
|
||||
create sess
|
||||
router.dispatch (req, res, sess)
|
||||
if not sess.dispatched then
|
||||
execute_default (req, res)
|
||||
end
|
||||
ensure
|
||||
response_status_is_set: res.status_is_set
|
||||
end
|
||||
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Dispatch requests without a matching handler.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
local
|
||||
msg: WSF_DEFAULT_ROUTER_RESPONSE
|
||||
do
|
||||
create msg.make_with_router (req, router)
|
||||
msg.set_documentation_included (True)
|
||||
res.send (msg)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
router: WSF_ROUTER
|
||||
-- Router used to dispatch the request according to the WSF_REQUEST object
|
||||
-- and associated request methods
|
||||
|
||||
;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
|
||||
@@ -1,72 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Object that is use in relation with WSF_ROUTER, to precise which request methods is accepted.
|
||||
For convenience, `make_from_iterable' is available, so that you can use <<"GET", "POST">> for instance
|
||||
but remember manifest string are evil ...
|
||||
Since in HTTP you can use your own custom request method, this is not possible to catch any typo
|
||||
( for instance if you write "POST" instead of "P0ST" this is hard to find the error,
|
||||
but in one case it uses upper "o" and in the other case this is zero "0"
|
||||
)
|
||||
|
||||
The recommanded way to use is for instance
|
||||
create {WSF_ROUTER_METHODS}.make_get_post
|
||||
create methods; methods.enable_get; methods.enable_post
|
||||
|
||||
This sounds heavy, but this is much safer.
|
||||
|
||||
( note: in addition internally this first checks using reference comparison
|
||||
and then compare string value, so it brings optimization for accepted request methods.
|
||||
)
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTER_METHODS
|
||||
|
||||
obsolete
|
||||
"Use WSF_REQUEST_METHODS"
|
||||
|
||||
inherit
|
||||
WSF_REQUEST_METHODS
|
||||
redefine
|
||||
plus
|
||||
end
|
||||
|
||||
create
|
||||
default_create,
|
||||
make,
|
||||
make_from_iterable,
|
||||
make_from_string
|
||||
|
||||
convert
|
||||
to_array: {ARRAY [READABLE_STRING_8]},
|
||||
make_from_iterable ({ITERABLE [READABLE_STRING_8], ITERABLE [STRING_8], ARRAY [READABLE_STRING_8], ARRAY [STRING_8]}),
|
||||
make_from_string ({READABLE_STRING_8, STRING_8})
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
add (a_other: like plus): like plus
|
||||
obsolete "Use `plus' or `alias +'"
|
||||
do
|
||||
Result := plus (a_other)
|
||||
end
|
||||
|
||||
plus alias "+" (a_other: WSF_ROUTER_METHODS): WSF_ROUTER_METHODS
|
||||
-- Merge Current and a_other into Result
|
||||
do
|
||||
create Result.make_from_iterable (Current)
|
||||
Result.add_methods (a_other)
|
||||
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
|
||||
@@ -1,27 +0,0 @@
|
||||
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
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_STARTS_WITH_CONTEXT_ROUTED_SERVICE}."
|
||||
author: ""
|
||||
description: "Helper for routed execution with context."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
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
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_URI_CONTEXT_ROUTER_HELPER}."
|
||||
author: ""
|
||||
description: "Helper for exection based on router, and uri mapping context."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
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
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_URI_TEMPLATE_CONTEXT_ROUTER_HELPER}."
|
||||
author: ""
|
||||
description: "Helper for execution based on router and uri template mapping context."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ class
|
||||
WSF_COOKIE
|
||||
|
||||
inherit
|
||||
|
||||
HTTP_COOKIE
|
||||
|
||||
create
|
||||
|
||||
@@ -25,6 +25,7 @@ inherit
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||
-- Create Current execution with request `req' and response `res'.
|
||||
do
|
||||
Precursor (req, res)
|
||||
create request.make_from_wgi (wgi_request)
|
||||
@@ -39,7 +40,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
end
|
||||
|
||||
feature {NONE} -- Access
|
||||
feature -- Access
|
||||
|
||||
request: WSF_REQUEST
|
||||
-- Access to request data.
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_EXECUTION_FACTORY}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_EXECUTION_FACTORY
|
||||
|
||||
inherit
|
||||
WGI_EXECUTION_FACTORY
|
||||
redefine
|
||||
execution
|
||||
end
|
||||
|
||||
feature -- Factory
|
||||
|
||||
execution (req: WGI_REQUEST; res: WGI_RESPONSE): WSF_EXECUTION
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, 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
|
||||
Reference in New Issue
Block a user