Merge branch 'master' into skeleton_router

This commit is contained in:
Colin Adams
2013-03-22 14:28:01 +00:00
16 changed files with 153 additions and 28 deletions

View File

@@ -14,6 +14,7 @@
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoder" location="..\..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="css" location="..\..\library\text\css\css-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
<library name="openid" location="..\..\..\library\security\openid\consumer\openid-safe.ecf" readonly="false"/>
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>

View File

@@ -15,6 +15,7 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="encoder" location="..\..\..\library\text\encoder\encoder.ecf" readonly="false"/>
<library name="css" location="..\..\library\text\css\css.ecf" readonly="false"/>
<library name="http" location="..\..\..\library\network\protocol\http\http.ecf" readonly="false"/>
<library name="openid" location="..\..\..\library\security\openid\consumer\openid.ecf" />
<library name="process" location="$ISE_LIBRARY\library\process\process.ecf"/>

View File

@@ -8,7 +8,7 @@ deferred class
feature -- Status report
css_style: detachable CMS_CSS_STYLE
css_style: detachable CSS_STYLE
feature -- Change

View File

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

View File

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

View File

@@ -1,15 +1,18 @@
note
description: "Summary description for {CMS_CSS_SELECTOR}."
description: "Summary description for {CSS_SELECTOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CMS_CSS_SELECTOR
CSS_SELECTOR
create
make_from_string
convert
make_from_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
feature {NONE} -- Initialization
make_from_string (s: READABLE_STRING_8)

View File

@@ -1,11 +1,11 @@
note
description: "Summary description for {CMS_CSS_STYLE}."
description: "Summary description for {CSS_STYLE}."
date: "$Date$"
revision: "$Revision$"
EIS: "name=CSS reference", "protocol=URI", "src=http://www.w3schools.com/cssref/"
class
CMS_CSS_STYLE
CSS_STYLE
inherit
ITERABLE [READABLE_STRING_8]
@@ -16,7 +16,7 @@ create
make_with_items
convert
make_with_string ({READABLE_STRING_8, STRING_8})
make_with_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
feature {NONE} -- Initialization
@@ -58,7 +58,7 @@ feature -- Access
feature -- Element change
plus alias "+" (a_other: CMS_CSS_STYLE): like Current
plus alias "+" (a_other: CSS_STYLE): like Current
-- <Precursor>
local
lst: ARRAYED_LIST [READABLE_STRING_8]
@@ -73,7 +73,7 @@ feature -- Element change
create Result.make_with_items (lst)
end
append (a_other: CMS_CSS_STYLE)
append (a_other: CSS_STYLE)
-- Append style from `a_other' into Current
do
across

View File

@@ -1,11 +1,11 @@
note
description: "Summary description for {CMS_CSS}."
description: "Summary description for {CSS_TEXT}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CMS_CSS
CSS_TEXT
create
make
@@ -19,11 +19,21 @@ feature {NONE} -- Initialization
feature -- Access
items: ARRAYED_LIST [TUPLE [selectors: ITERABLE [CMS_CSS_SELECTOR]; style: CMS_CSS_STYLE]]
items: ARRAYED_LIST [TUPLE [selectors: ITERABLE [CSS_SELECTOR]; style: CSS_STYLE]]
add_selector_style (a_selector: CSS_SELECTOR; a_style: CSS_STYLE)
do
items.force ([<<a_selector>>, a_style])
end
add_selectors_style (a_selectors: ITERABLE [CSS_SELECTOR]; a_style: CSS_STYLE)
do
items.force ([a_selectors, a_style])
end
feature -- Conversion
string: READABLE_STRING_8
string: STRING_8
local
s: STRING_8
do

View File

@@ -158,10 +158,18 @@ feature {WSF_RESPONSE} -- Output
if doc_url_supported then
l_description.append ("<a href=%""+ doc_url ("") + "%">Index</a><br/>")
end
if attached router.item_associated_with_resource (l_api_resource, Void) as l_api_item then
l_description.append ("<h2>Information related to <code>" + l_api_resource + "</code></h2><ul class=%"mapping%">")
append_documentation_to (l_description, l_api_item.mapping, l_api_item.request_methods)
l_description.append ("</ul>")
if
attached router.items_associated_with_resource (l_api_resource, Void) as l_api_items and then
not l_api_items.is_empty
then
l_description.append ("<h2>Information related to <code>" + l_api_resource + "</code></h2>")
across
l_api_items as c
loop
l_description.append ("<ul class=%"mapping%">")
append_documentation_to (l_description, c.item.mapping, c.item.request_methods)
l_description.append ("</ul>")
end
end
else
l_description.append ("<h2>Router</h2><ul class=%"mapping%">")
@@ -304,4 +312,14 @@ feature {NONE} -- Implementation
create Result
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

View File

@@ -14,10 +14,19 @@ feature -- Documentation
--| `m' and `a_request_methods' are useful to produce specific documentation when the handler is used for multiple mapping.
require
m_attached: m /= Void
a_request_methods_attached: a_request_methods /= Void
deferred
ensure
mapping_documentation_attached: Result /= Void
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

View File

@@ -59,7 +59,7 @@ feature -- Status
end
try (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
-- Return the handler if Current matches the request `req'.
-- <Precursor>
local
p: READABLE_STRING_8
s: like based_uri

View File

@@ -73,6 +73,7 @@ feature -- Status
end
try (req: WSF_REQUEST; res: WSF_RESPONSE; sess: WSF_ROUTER_SESSION; a_router: WSF_ROUTER)
-- <Precursor>
do
if is_mapping (req, a_router) then
sess.set_dispatched_handler (handler)

View File

@@ -228,7 +228,7 @@ feature -- Status report
end
item_associated_with_resource (a_resource: READABLE_STRING_8; rqst_methods: detachable WSF_REQUEST_METHODS): detachable WSF_ROUTER_ITEM
-- Handler and request methods for `a_resource', taking into account `rqst_methods'
-- First handler for `a_resource', taking into account `rqst_methods'
require
a_resource_attached: a_resource /= Void
local
@@ -259,6 +259,37 @@ feature -- Status report
end
end
items_associated_with_resource (a_resource: READABLE_STRING_8; rqst_methods: detachable WSF_REQUEST_METHODS): LIST [WSF_ROUTER_ITEM]
-- All handlers for `a_resource', taking into account `rqst_methods'
require
a_resource_attached: a_resource /= Void
local
m: WSF_ROUTER_MAPPING
ok: BOOLEAN
do
create {ARRAYED_LIST [WSF_ROUTER_ITEM]} Result.make (1)
across
mappings as c
loop
m := c.item.mapping
ok := True
if rqst_methods /= Void then
if attached c.item.request_methods as l_item_rqst_methods then
ok := across rqst_methods as mtd some is_matching_request_methods (mtd.item, l_item_rqst_methods) end
else
ok := True
end
end
if ok then
if attached {WSF_ROUTING_HANDLER} m.handler as l_routing then
Result.append (l_routing.router.items_associated_with_resource (a_resource, rqst_methods))
elseif m.associated_resource.same_string (a_resource) then
Result.force (c.item)
end
end
end
end
allowed_methods_for_request (req: WSF_REQUEST): WSF_REQUEST_METHODS
-- Allowed methods for `req'
require

View File

@@ -24,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
@@ -40,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
@@ -78,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

View File

@@ -120,33 +120,51 @@ feature {NONE} -- Implementation
Result := Precursor (req)
if documentation_included then
create vis
vis.on_item_actions.extend (agent (i: WSF_ROUTER_ITEM; r: WSF_NOT_FOUND_RESPONSE)
vis.on_item_actions.extend (agent (i: WSF_ROUTER_ITEM; r: WSF_NOT_FOUND_RESPONSE; m: detachable READABLE_STRING_8)
local
l_is_hidden: BOOLEAN
s: STRING_32
ok: BOOLEAN
do
if attached {WSF_SELF_DOCUMENTED_ROUTER_MAPPING} i.mapping as l_doc_mapping then
l_is_hidden := l_doc_mapping.documentation (i.request_methods).is_hidden
end
if not l_is_hidden then
ok := True
create s.make_from_string (i.mapping.associated_resource)
if attached i.request_methods as mtds then
ok := False
s.append (" [ ")
across
mtds as mtds_c
mtds as c
loop
s.append (mtds_c.item)
if m = Void or else m.is_case_insensitive_equal (c.item) then
ok := True
end
s.append (c.item)
s.append_character (' ')
end
s.append ("]")
else
s.append (" [*]")
end
r.add_suggested_text (s, Void)
if ok then
r.add_suggested_text (s, Void)
end
end
end (?, Result))
end (?, Result, req.request_method))
vis.process_router (router)
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

View File

@@ -15,6 +15,7 @@
<library name="connector_libfcgi" location="..\library\server\ewsgi\connectors\libfcgi\libfcgi-safe.ecf" readonly="false"/>
<library name="connector_nino" location="..\library\server\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/>
<library name="connector_null" location="..\library\server\ewsgi\connectors\null\null-safe.ecf" readonly="false"/>
<library name="encoder" location="..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="wsf_connector_nino" location="..\library\server\wsf\connector\nino-safe.ecf" readonly="false"/>
<library name="wsf_connector_openshift" location="..\library\server\wsf\connector\openshift-safe.ecf" readonly="false"/>
<library name="dft_connector_libfcgi" location="..\library\server\wsf\default\libfcgi-safe.ecf" readonly="false"/>
@@ -35,6 +36,8 @@
<library name="ex_restbuck" location="..\examples\restbucksCRUD\restbucks-safe.ecf" readonly="false"/>
<library name="ex_simple" location="..\examples\simple\simple.ecf" readonly="false"/>
<library name="ex_filter" location="..\examples\filter\filter-safe.ecf" readonly="false"/>
<library name="cms" location="..\draft\application\cms\cms-safe.ecf" readonly="false"/>
<library name="css" location="..\draft\library\text\css\css-safe.ecf" readonly="false"/>
</target>
<target name="all_windows" extends="all">
<description>Compiling as Windows , on other platforms than Windows</description>