Merge branch 'master' of github.com:EiffelWebFramework/EWF
This commit is contained in:
@@ -8,12 +8,23 @@ class
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
-- Initialize current service.
|
||||
do
|
||||
set_service_option ("port", 9090)
|
||||
end
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
-- To send a response we need to setup, the status code and
|
||||
|
||||
@@ -24,6 +24,7 @@ feature {NONE} -- Initialization
|
||||
do
|
||||
router := a_router
|
||||
make (req)
|
||||
set_suggestion_only_method (True)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
@@ -36,6 +37,9 @@ feature -- Settings
|
||||
documentation_included: BOOLEAN
|
||||
-- Include self-documentation from `router' in the response?
|
||||
|
||||
suggestion_only_method: BOOLEAN
|
||||
-- Display only suggestion for `req' method ?
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_documentation_included (b: BOOLEAN)
|
||||
@@ -43,6 +47,14 @@ feature -- Change
|
||||
documentation_included := b
|
||||
end
|
||||
|
||||
set_suggestion_only_method (b: BOOLEAN)
|
||||
-- Set `suggestion_only_method' to `b'
|
||||
do
|
||||
suggestion_only_method := b
|
||||
ensure
|
||||
suggestion_only_method_set: suggestion_only_method = b
|
||||
end
|
||||
|
||||
feature {WSF_RESPONSE} -- Output
|
||||
|
||||
send_to (res: WSF_RESPONSE)
|
||||
@@ -138,10 +150,14 @@ feature {NONE} -- Implementation
|
||||
not_found_message (req: WSF_REQUEST): WSF_NOT_FOUND_RESPONSE
|
||||
local
|
||||
vis: WSF_ROUTER_AGENT_ITERATOR
|
||||
l_method: detachable READABLE_STRING_8
|
||||
do
|
||||
Result := Precursor (req)
|
||||
if documentation_included then
|
||||
create vis
|
||||
if suggestion_only_method then
|
||||
l_method := req.request_method
|
||||
end
|
||||
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
|
||||
@@ -174,7 +190,7 @@ feature {NONE} -- Implementation
|
||||
r.add_suggested_text (s, Void)
|
||||
end
|
||||
end
|
||||
end (?, Result, req.request_method))
|
||||
end (?, Result, l_method))
|
||||
vis.process_router (router)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -136,11 +136,11 @@ feature {WSF_RESPONSE} -- Output
|
||||
s.append (
|
||||
"[
|
||||
<style type="text/css">
|
||||
div#header {color: #fff; background-color: #000; padding: 20px; width: 100%; text-align: center; font-size: 2em; font-weight: bold;}
|
||||
div#message { margin: 40px; width: 100%; text-align: center; font-size: 1.5em; }
|
||||
div#header {color: #fff; background-color: #000; padding: 20px; text-align: center; font-size: 2em; font-weight: bold;}
|
||||
div#message { margin: 40px; text-align: center; font-size: 1.5em; }
|
||||
div#suggestions { margin: auto; width: 60%;}
|
||||
div#suggestions ul { }
|
||||
div#footer {color: #999; background-color: #eee; padding: 10px; width: 100%; text-align: center; }
|
||||
div#footer {color: #999; background-color: #eee; padding: 10px; text-align: center; }
|
||||
div#logo { float: right; margin: 20px; width: 60px height: auto; font-size: 0.8em; text-align: center; }
|
||||
div#logo div.outter { padding: 6px; width: 60px; border: solid 3px #500; background-color: #b00;}
|
||||
div#logo div.outter div.inner1 { display: block; margin: 10px 15px; width: 30px; height: 50px; color: #fff; background-color: #fff; border: solid 2px #900; }
|
||||
|
||||
@@ -81,11 +81,11 @@ feature {WSF_RESPONSE} -- Output
|
||||
s.append ("</title>%N")
|
||||
s.append ("[
|
||||
<style type="text/css">
|
||||
div#header {color: #fff; background-color: #000; padding: 20px; width: 100%; text-align: center; font-size: 2em; font-weight: bold;}
|
||||
div#message { margin: 40px; width: 100%; text-align: center; font-size: 1.5em; }
|
||||
div#header {color: #fff; background-color: #000; padding: 20px; text-align: center; font-size: 2em; font-weight: bold;}
|
||||
div#message { margin: 40px; text-align: center; font-size: 1.5em; }
|
||||
div#suggestions { margin: auto; width: 60%;}
|
||||
div#suggestions ul { }
|
||||
div#footer {color: #999; background-color: #eee; padding: 10px; width: 100%; text-align: center; }
|
||||
div#footer {color: #999; background-color: #eee; padding: 10px; text-align: center; }
|
||||
div#logo { float: right; margin: 20px; width: 60px height: auto; font-size: 0.8em; text-align: center; }
|
||||
div#logo div.outter { padding: 6px; width: 60px; border: solid 3px #500; background-color: #b00;}
|
||||
div#logo div.outter div.inner1 { display: block; margin: 10px 15px; width: 30px; height: 50px; color: #fff; background-color: #fff; border: solid 2px #900; }
|
||||
@@ -198,7 +198,7 @@ feature {WSF_RESPONSE} -- 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
|
||||
|
||||
@@ -66,9 +66,9 @@ feature {WSF_RESPONSE} -- Output
|
||||
s.append ("</title>%N")
|
||||
s.append ("[
|
||||
<style type="text/css">
|
||||
div#header {color: #fff; background-color: #000; padding: 20px; width: 100%; text-align: center; font-size: 2em; font-weight: bold;}
|
||||
div#message { margin: 40px; width: 100%; text-align: center; font-size: 1.5em; }
|
||||
div#footer {color: #999; background-color: #eee; padding: 10px; width: 100%; text-align: center; }
|
||||
div#header {color: #fff; background-color: #000; padding: 20px; text-align: center; font-size: 2em; font-weight: bold;}
|
||||
div#message { margin: 40px; text-align: center; font-size: 1.5em; }
|
||||
div#footer {color: #999; background-color: #eee; padding: 10px; text-align: center; }
|
||||
div#logo { float: right; margin: 20px; width: 60px height: auto; font-size: 0.8em; text-align: center; }
|
||||
div#logo div.outter { padding: 6px; width: 60px; border: solid 3px #500; background-color: #b00;}
|
||||
div#logo div.outter div.inner1 { display: block; margin: 10px 15px; width: 30px; height: 50px; color: #fff; background-color: #fff; border: solid 2px #900; }
|
||||
|
||||
Reference in New Issue
Block a user