Added routing condition mapping.
Added WSF_EXECUTE_HANDLER as common ancestor for handler with `execute (WSF_REQUEST, WSF_RESPONSE) ..` routine. Made more flexible a few routine by accepting ITERABLE instead of ARRAY, and READABLE_STRING_GENERAL when possible.
This commit is contained in:
@@ -221,17 +221,19 @@ feature {WSF_RESPONSE} -- Output
|
||||
|
||||
l_url := Void
|
||||
s.append ("<li>")
|
||||
if attached m.associated_resource as l_associated_resource then
|
||||
s.append ("<code>")
|
||||
if doc_url_supported then
|
||||
s.append ("<a class=%"mappingresource%" href=%"")
|
||||
s.append (doc_url (m.associated_resource))
|
||||
s.append (doc_url (l_associated_resource))
|
||||
s.append ("%">")
|
||||
s.append (m.associated_resource)
|
||||
s.append (l_associated_resource)
|
||||
s.append ("</a>")
|
||||
else
|
||||
s.append (m.associated_resource)
|
||||
s.append (l_associated_resource)
|
||||
end
|
||||
s.append ("</code>")
|
||||
end
|
||||
|
||||
if meths /= Void then
|
||||
s.append (" [")
|
||||
@@ -291,7 +293,11 @@ feature {WSF_RESPONSE} -- Output
|
||||
s.append ("</li>%N")
|
||||
else
|
||||
debug
|
||||
s.append ("<li>" + m.associated_resource + " is HIDDEN</li>%N")
|
||||
if attached m.associated_resource as l_associated_resource then
|
||||
s.append ("<li>" + l_associated_resource + " is HIDDEN</li>%N")
|
||||
else
|
||||
s.append ("<li>HIDDEN</li>%N")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTING_AGENT_CONDITION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTING_AGENT_CONDITION
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_CONDITION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (act: like condition)
|
||||
do
|
||||
condition := act
|
||||
end
|
||||
|
||||
condition: FUNCTION [TUPLE [request: WSF_REQUEST], BOOLEAN]
|
||||
|
||||
feature -- Status report
|
||||
|
||||
accepted (req: WSF_REQUEST): BOOLEAN
|
||||
-- Does `req` satisfy Current condition?
|
||||
do
|
||||
Result := condition (req)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,44 @@
|
||||
note
|
||||
description: "[
|
||||
Request path info ends with one of the specified extensions.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTING_EXTENSION_CONDITION
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_CONDITION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Creation
|
||||
|
||||
make (a_extension_list: ITERABLE [READABLE_STRING_GENERAL])
|
||||
do
|
||||
extension_list := a_extension_list
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
extension_list: ITERABLE [READABLE_STRING_GENERAL]
|
||||
|
||||
feature -- Status report
|
||||
|
||||
accepted (req: WSF_REQUEST): BOOLEAN
|
||||
-- Does `req` satisfy Current condition?
|
||||
local
|
||||
l_path: READABLE_STRING_GENERAL
|
||||
i: INTEGER
|
||||
do
|
||||
l_path := req.percent_encoded_path_info
|
||||
i := l_path.last_index_of ('.', l_path.count)
|
||||
if i > 0 then
|
||||
i := i + 1
|
||||
Result := across extension_list as ic some ic.item.same_caseless_characters (l_path, i, l_path.count, 1) end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
note
|
||||
description: "[
|
||||
Request path info is associated with existing file.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTING_FILE_EXISTS_CONDITION
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_PATH_EXISTS_CONDITION
|
||||
redefine
|
||||
path_exists
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Status report
|
||||
|
||||
path_exists (p: PATH): BOOLEAN
|
||||
local
|
||||
fut: FILE_UTILITIES
|
||||
do
|
||||
Result := fut.file_path_exists (p)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,64 @@
|
||||
note
|
||||
description: "[
|
||||
Request path info is associated with existing file or folder.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTING_PATH_EXISTS_CONDITION
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_CONDITION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Creation
|
||||
|
||||
make (a_parent_location: PATH)
|
||||
do
|
||||
parent_location := a_parent_location
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
parent_location: PATH
|
||||
|
||||
feature -- Status report
|
||||
|
||||
path_exists (p: PATH): BOOLEAN
|
||||
local
|
||||
fut: FILE_UTILITIES
|
||||
do
|
||||
Result := fut.file_path_exists (p) or fut.directory_path_exists (p)
|
||||
end
|
||||
|
||||
accepted (req: WSF_REQUEST): BOOLEAN
|
||||
-- Does `req` satisfy Current condition?
|
||||
local
|
||||
l_path: READABLE_STRING_GENERAL
|
||||
p: PATH
|
||||
fut: FILE_UTILITIES
|
||||
do
|
||||
l_path := req.path_info
|
||||
if not l_path.is_empty then
|
||||
if l_path[1] = '/' then
|
||||
l_path := l_path.substring (2, l_path.count)
|
||||
end
|
||||
p := parent_location.extended (l_path)
|
||||
Result := path_exists (p)
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,43 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTING_AND_CONDITION}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTING_AND_CONDITION
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_CONDITION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Creation
|
||||
|
||||
make (a_left, a_right: WSF_ROUTING_CONDITION)
|
||||
do
|
||||
left := a_left
|
||||
right := a_right
|
||||
end
|
||||
|
||||
left, right: WSF_ROUTING_CONDITION
|
||||
|
||||
feature -- Status report
|
||||
|
||||
accepted (req: WSF_REQUEST): BOOLEAN
|
||||
-- Does `req` satisfy Current condition?
|
||||
do
|
||||
Result := left.accepted (req) and then right.accepted (req)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,39 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTING_CONDITION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_ROUTING_CONDITION
|
||||
|
||||
feature -- Status report
|
||||
|
||||
accepted (req: WSF_REQUEST): BOOLEAN
|
||||
-- Does `req` satisfy Current condition?
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Factory
|
||||
|
||||
conjuncted alias "and" (cond: WSF_ROUTING_CONDITION): WSF_ROUTING_AND_CONDITION
|
||||
do
|
||||
create Result.make (Current, cond)
|
||||
end
|
||||
|
||||
disjuncted alias "or" (cond: WSF_ROUTING_CONDITION): WSF_ROUTING_OR_CONDITION
|
||||
do
|
||||
create Result.make (Current, cond)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,43 @@
|
||||
note
|
||||
description: "Summary description for {WSF_ROUTING_OR_CONDITION}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_ROUTING_OR_CONDITION
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_CONDITION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Creation
|
||||
|
||||
make (a_left, a_right: WSF_ROUTING_CONDITION)
|
||||
do
|
||||
left := a_left
|
||||
right := a_right
|
||||
end
|
||||
|
||||
left, right: WSF_ROUTING_CONDITION
|
||||
|
||||
feature -- Status report
|
||||
|
||||
accepted (req: WSF_REQUEST): BOOLEAN
|
||||
-- Does `req` satisfy Current condition?
|
||||
do
|
||||
Result := left.accepted (req) or else right.accepted (req)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,22 @@
|
||||
note
|
||||
description: "Summary description for {WSF_WITH_CONDITION_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_WITH_CONDITION_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,44 @@
|
||||
note
|
||||
description: "Summary description for WSF_WITH_CONDITION_MAPPING."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_WITH_CONDITION_MAPPING
|
||||
|
||||
inherit
|
||||
WSF_WITH_CONDITION_MAPPING_I
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Access
|
||||
|
||||
handler: WSF_EXECUTE_HANDLER
|
||||
|
||||
feature -- change
|
||||
|
||||
set_handler (h: like handler)
|
||||
do
|
||||
handler := h
|
||||
end
|
||||
|
||||
feature {NONE} -- Execution
|
||||
|
||||
execute_handler (h: like handler; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute handler `h' with `req' and `res' for Current mapping
|
||||
do
|
||||
h.execute (req, res)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,109 @@
|
||||
note
|
||||
description: "Summary description for WSF_WITH_CONDITION_MAPPING_I."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_WITH_CONDITION_MAPPING_I
|
||||
|
||||
inherit
|
||||
WSF_ROUTER_MAPPING
|
||||
|
||||
WSF_SELF_DOCUMENTED_ROUTER_MAPPING
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_condition: like condition; h: like handler)
|
||||
do
|
||||
set_handler (h)
|
||||
condition := a_condition
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
condition: WSF_ROUTING_CONDITION
|
||||
|
||||
associated_resource: READABLE_STRING_8
|
||||
-- Name (URI, or URI template or regular expression or ...) of handled resource
|
||||
do
|
||||
if attached condition_description as desc and then desc.is_valid_as_string_8 then
|
||||
Result := desc.to_string_8
|
||||
else
|
||||
Result := description
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
condition_description: detachable READABLE_STRING_32
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_condition_description (desc: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if desc = Void then
|
||||
condition_description := Void
|
||||
else
|
||||
condition_description := desc.as_string_32
|
||||
end
|
||||
end
|
||||
|
||||
set_handler (h: like handler)
|
||||
-- Set `handler' to `h'.
|
||||
require
|
||||
h_attached: h /= Void
|
||||
deferred
|
||||
ensure
|
||||
h_aliased: handler = h
|
||||
end
|
||||
|
||||
feature -- Documentation
|
||||
|
||||
description: STRING_32 = "With-Condition"
|
||||
|
||||
feature -- Status
|
||||
|
||||
is_mapping (a_path: READABLE_STRING_8; req: WSF_REQUEST; a_router: WSF_ROUTER): BOOLEAN
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := condition.accepted (req)
|
||||
end
|
||||
|
||||
try (a_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
|
||||
-- <Precursor>
|
||||
do
|
||||
if condition.accepted (req) then
|
||||
sess.set_dispatched_handler (handler)
|
||||
a_router.execute_before (Current)
|
||||
execute_handler (handler, req, res)
|
||||
a_router.execute_after (Current)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Execution
|
||||
|
||||
execute_handler (h: like handler; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute handler `h' with `req' and `res' for Current mapping.
|
||||
require
|
||||
h_attached: h /= Void
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
path_validate_condition: condition.accepted (req)
|
||||
deferred
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
condition_attached: condition /= Void
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,45 @@
|
||||
note
|
||||
description: "Summary description for {WSF_EXECUTE_AGENT_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_EXECUTE_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_HANDLER
|
||||
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_action: like action)
|
||||
do
|
||||
action := a_action
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: PROCEDURE [TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
action (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
|
||||
@@ -0,0 +1,34 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_EXECUTE_FILTER_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_FILTER_HANDLER [WSF_EXECUTE_HANDLER]
|
||||
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
if attached next as n then
|
||||
n.execute (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
|
||||
@@ -0,0 +1,44 @@
|
||||
note
|
||||
description: "Summary description for {WSF_EXECUTE_RESPONSE_AGENT_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_EXECUTE_RESPONSE_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_RESPONSE_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (act: like action)
|
||||
do
|
||||
action := act
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: FUNCTION [TUPLE [req: WSF_REQUEST], WSF_RESPONSE_MESSAGE]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
do
|
||||
Result := action.item ([req])
|
||||
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
|
||||
@@ -0,0 +1,40 @@
|
||||
note
|
||||
description: "Summary description for {WSF_EXECUTE_RESPONSE_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_EXECUTE_RESPONSE_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
require
|
||||
is_valid_context: is_valid_context (req)
|
||||
deferred
|
||||
ensure
|
||||
Result_attached: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
do
|
||||
res.send (response (req))
|
||||
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
|
||||
@@ -0,0 +1,28 @@
|
||||
note
|
||||
description: "Summary description for {WSF_EXECUTE_ROUTING_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_EXECUTE_ROUTING_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_ROUTING_HANDLER
|
||||
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
|
||||
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
|
||||
@@ -0,0 +1,61 @@
|
||||
note
|
||||
description: "Summary description for {WSF_SELF_DOCUMENTED_EXECUTE_AGENT_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_SELF_DOCUMENTED_EXECUTE_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_AGENT_HANDLER
|
||||
rename
|
||||
make as make_handler
|
||||
end
|
||||
|
||||
WSF_SELF_DOCUMENTED_AGENT_HANDLER
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_descriptions,
|
||||
make_hidden
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_action: like action; a_self_doc: like self_documentation_builder)
|
||||
-- <Precursor>
|
||||
-- and using `a_self_doc' function to build the `mapping_documentation'.
|
||||
do
|
||||
set_self_documentation_builder (a_self_doc)
|
||||
make_handler (a_action)
|
||||
end
|
||||
|
||||
make_with_descriptions (a_action: like action; a_descriptions: ITERABLE [READABLE_STRING_GENERAL])
|
||||
do
|
||||
across
|
||||
a_descriptions as c
|
||||
loop
|
||||
add_description (c.item)
|
||||
end
|
||||
make_handler (a_action)
|
||||
end
|
||||
|
||||
make_hidden (a_action: like action)
|
||||
-- <Precursor>
|
||||
-- and using `a_self_doc' function to build the `mapping_documentation'
|
||||
-- mark it as `hidden'.
|
||||
do
|
||||
is_hidden := True
|
||||
make (a_action, Void)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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
|
||||
@@ -0,0 +1,34 @@
|
||||
note
|
||||
description: "[
|
||||
Represents the ancestor of all the WSF_ROUTER handlers with `execute (WSF_REQUEST, WSF_RESPONSE)` routine.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_HANDLER
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute `req' responding in `res'.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, 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,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {WSF_SELF_DOCUMENTED_URI_AGENT_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -50,7 +49,7 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,31 +8,14 @@ class
|
||||
WSF_URI_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_AGENT_HANDLER
|
||||
WSF_URI_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_action: like action)
|
||||
do
|
||||
action := a_action
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: PROCEDURE [TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
action.call ([req, res])
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,21 +8,12 @@ deferred class
|
||||
WSF_URI_FILTER_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_FILTER_HANDLER [WSF_URI_HANDLER]
|
||||
WSF_EXECUTE_FILTER_HANDLER
|
||||
|
||||
WSF_URI_HANDLER
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
if attached next as n then
|
||||
n.execute (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,31 +8,15 @@ class
|
||||
WSF_URI_RESPONSE_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_RESPONSE_AGENT_HANDLER
|
||||
|
||||
WSF_URI_RESPONSE_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (act: like action)
|
||||
do
|
||||
action := act
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: FUNCTION [TUPLE [req: WSF_REQUEST], WSF_RESPONSE_MESSAGE]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
do
|
||||
Result := action.item ([req])
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,28 +8,12 @@ deferred class
|
||||
WSF_URI_RESPONSE_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
WSF_URI_HANDLER
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
require
|
||||
is_valid_context: is_valid_context (req)
|
||||
deferred
|
||||
ensure
|
||||
Result_attached: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
do
|
||||
res.send (response (req))
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,20 +8,10 @@ deferred class
|
||||
WSF_URI_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_HANDLER
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
WSF_ROUTER_MAPPING_FACTORY
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute handler for `req' and respond in `res'.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {WSF_ROUTER} -- Mapping
|
||||
|
||||
new_mapping (a_uri: READABLE_STRING_8): WSF_ROUTER_MAPPING
|
||||
@@ -30,7 +20,7 @@ feature {WSF_ROUTER} -- Mapping
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,6 +8,8 @@ class
|
||||
WSF_URI_TEMPLATE_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_AGENT_HANDLER
|
||||
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
|
||||
create
|
||||
@@ -16,26 +18,8 @@ create
|
||||
convert
|
||||
make ({PROCEDURE [WSF_REQUEST, WSF_RESPONSE]})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_action: like action)
|
||||
do
|
||||
action := a_action
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: PROCEDURE [TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
action.call ([req, res])
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,21 +8,12 @@ deferred class
|
||||
WSF_URI_TEMPLATE_FILTER_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
|
||||
WSF_EXECUTE_FILTER_HANDLER
|
||||
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
if attached next as n then
|
||||
n.execute (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,31 +8,15 @@ class
|
||||
WSF_URI_TEMPLATE_RESPONSE_AGENT_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_RESPONSE_AGENT_HANDLER
|
||||
|
||||
WSF_URI_TEMPLATE_RESPONSE_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (act: like action)
|
||||
do
|
||||
action := act
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: FUNCTION [TUPLE [req: WSF_REQUEST], WSF_RESPONSE_MESSAGE]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
do
|
||||
Result := action.item ([req])
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,28 +8,12 @@ deferred class
|
||||
WSF_URI_TEMPLATE_RESPONSE_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_EXECUTE_RESPONSE_HANDLER
|
||||
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
require
|
||||
is_valid_context: is_valid_context (req)
|
||||
deferred
|
||||
ensure
|
||||
Result_attached: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
do
|
||||
res.send (response (req))
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -8,20 +8,10 @@ deferred class
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_HANDLER
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
WSF_ROUTER_MAPPING_FACTORY
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute `req' responding in `res'.
|
||||
require
|
||||
req_attached: req /= Void
|
||||
res_attached: res /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {WSF_ROUTER} -- Mapping
|
||||
|
||||
new_mapping (a_tpl: READABLE_STRING_8): WSF_ROUTER_MAPPING
|
||||
@@ -30,7 +20,7 @@ feature {WSF_ROUTER} -- Mapping
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2017, 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
|
||||
|
||||
@@ -103,7 +103,7 @@ feature -- Access
|
||||
-- Function to evaluate if a path is ignored or not during autoindex.
|
||||
-- If `index_ignores' is Void and `index_ignores_function' is Void, use default ignore rules.
|
||||
|
||||
directory_index: detachable ARRAY [READABLE_STRING_8]
|
||||
directory_index: detachable ITERABLE [READABLE_STRING_GENERAL]
|
||||
-- File serve if a directory index is requested.
|
||||
|
||||
not_found_handler: detachable PROCEDURE [TUPLE [uri: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE]]
|
||||
@@ -130,7 +130,7 @@ feature -- Element change
|
||||
set_directory_index (idx: like directory_index)
|
||||
-- Set `directory_index' as `idx'
|
||||
do
|
||||
if idx = Void or else idx.is_empty then
|
||||
if idx = Void then
|
||||
directory_index := Void
|
||||
else
|
||||
directory_index := idx
|
||||
|
||||
@@ -11,16 +11,6 @@ deferred class
|
||||
inherit
|
||||
DEBUG_OUTPUT
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_resource: READABLE_STRING_8; h: like handler)
|
||||
-- Create mapping based on resource `a_resource' and handler `h'.
|
||||
require
|
||||
a_resource_attached: a_resource /= Void
|
||||
h_attached: h /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
associated_resource: READABLE_STRING_8
|
||||
|
||||
@@ -8,7 +8,7 @@ deferred class
|
||||
WSF_ROUTING_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_HANDLER
|
||||
WSF_EXECUTE_HANDLER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
|
||||
Reference in New Issue
Block a user