Fixed some configuration files (ecf)
Fixed various compilation issue Fixed draft rest library (still experimental and should be removed in the future)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_extension" location="..\..\..\..\..\library\server\wsf_extension\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_extension" location="..\..\..\..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="../../../../../library/network/protocol/http/http-safe.ecf"/>
|
||||
<library name="uri_template" location="../../../../../library/text/parser/uri_template/uri_template-safe.ecf"/>
|
||||
<cluster name="contrib" location=".\src\contrib\" recursive="true">
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<option warning="true" full_class_checking="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\..\library\server\wsf\wsf.ecf"/>
|
||||
<library name="wsf_extension" location="..\..\..\..\..\library\server\wsf_extension\wsf_extension.ecf" readonly="false"/>
|
||||
<library name="wsf_extension" location="..\..\..\..\..\library\server\wsf\wsf_extension.ecf" readonly="false"/>
|
||||
<library name="http" location="../../../../../library/network/protocol/http/http.ecf"/>
|
||||
<library name="uri_template" location="../../../../../library/text/parser/uri_template/uri_template.ecf"/>
|
||||
<cluster name="contrib" location=".\src\contrib\" recursive="true">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class
|
||||
REST_REQUEST_AGENT_HANDLER
|
||||
REST_REQUEST_AGENT_HANDLER [C -> WSF_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
WSF_URI_TEMPLATE_AGENT_HANDLER
|
||||
WSF_URI_TEMPLATE_AGENT_CONTEXT_HANDLER [C]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -5,10 +5,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_HANDLER
|
||||
REST_REQUEST_HANDLER [C -> WSF_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
WSF_URI_TEMPLATE_CONTEXT_HANDLER [WSF_HANDLER_CONTEXT]
|
||||
WSF_URI_TEMPLATE_CONTEXT_HANDLER [C]
|
||||
|
||||
WSF_HANDLER_HELPER
|
||||
|
||||
@@ -34,7 +34,7 @@ feature -- Element change
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
do
|
||||
if request_method_name_supported (req.request_method) then
|
||||
@@ -52,26 +52,26 @@ feature -- Execution
|
||||
execute_rescue (ctx, req, res)
|
||||
end
|
||||
|
||||
execute_application (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
deferred
|
||||
end
|
||||
|
||||
pre_execute (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
pre_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
end
|
||||
|
||||
post_execute (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
post_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
end
|
||||
|
||||
execute_rescue (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
execute_rescue (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
post_execute (ctx, req, res)
|
||||
rescue
|
||||
--| Just in case, the rescue is raising other exceptions ...
|
||||
end
|
||||
|
||||
execute_unauthorized (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
execute_unauthorized (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
res.put_header ({HTTP_STATUS_CODE}.unauthorized, Void)
|
||||
res.put_string ("Unauthorized")
|
||||
@@ -79,7 +79,7 @@ feature -- Execution
|
||||
|
||||
feature -- Auth
|
||||
|
||||
authenticated (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT): BOOLEAN
|
||||
authenticated (ctx: C): BOOLEAN
|
||||
-- Is authenticated?
|
||||
do
|
||||
--| To redefine if needed
|
||||
|
||||
@@ -5,10 +5,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_SERVICE
|
||||
REST_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I
|
||||
REST_SERVICE_I [C]
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
|
||||
@@ -5,10 +5,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_SERVICE_I
|
||||
REST_SERVICE_I [C -> WSF_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
WSF_URI_TEMPLATE_ROUTED_SERVICE
|
||||
WSF_URI_TEMPLATE_CONTEXT_ROUTED_SERVICE [C]
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
|
||||
@@ -5,10 +5,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_REQUEST_URI_TEMPLATE_HANDLER
|
||||
REST_REQUEST_URI_TEMPLATE_HANDLER [C -> WSF_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REST_REQUEST_HANDLER
|
||||
REST_REQUEST_HANDLER [C]
|
||||
|
||||
|
||||
;note
|
||||
|
||||
@@ -5,10 +5,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
REST_URI_TEMPLATE_SERVICE
|
||||
REST_URI_TEMPLATE_SERVICE [C -> WSF_HANDLER_CONTEXT create make end]
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I
|
||||
REST_SERVICE_I [C]
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="rest" location="..\rest-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="..\..\..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_extension" location="..\..\..\..\..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="../../../../../../library/network/protocol/http/http-safe.ecf" readonly="false"/>
|
||||
</target>
|
||||
<target name="sample_fcgi" extends="common">
|
||||
|
||||
@@ -64,7 +64,7 @@ feature -- Execution
|
||||
content_type_supported := <<{HTTP_CONSTANTS}.application_json, {HTTP_CONSTANTS}.text_xml, {HTTP_CONSTANTS}.text_plain>>
|
||||
l_format_id := ctx.request_accepted_format_id ("format", content_type_supported)
|
||||
if authenticated (ctx) then
|
||||
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
|
||||
l_full := attached req.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
|
||||
if attached authenticated_identifier (ctx) as log then
|
||||
l_login := log.as_string_8
|
||||
|
||||
@@ -92,10 +92,10 @@ feature -- Execution
|
||||
res.put_string (s)
|
||||
end
|
||||
else
|
||||
send_error (ctx.path, 0, "User/password unknown", Void, ctx, req, res)
|
||||
send_error (req.path_info, 0, "User/password unknown", Void, ctx, req, res)
|
||||
end
|
||||
else
|
||||
send_error (ctx.path, 0, "Authentication rejected", Void, ctx, req, res)
|
||||
send_error (req.path_info, 0, "Authentication rejected", Void, ctx, req, res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -59,14 +59,14 @@ feature -- Execution
|
||||
s.append_string (" format=" + l_format + "%N")
|
||||
end
|
||||
|
||||
if attached ctx.string_item ("op") as l_op then
|
||||
if attached ctx.string_item (req, "op") as l_op then
|
||||
s.append_string (" op=" + l_op)
|
||||
if l_op.same_string ("crash") then
|
||||
(create {DEVELOPER_EXCEPTION}).raise
|
||||
elseif l_op.starts_with ("env") then
|
||||
s.append_string ("%N%NAll variables:")
|
||||
s.append (wgi_value_iteration_to_string (req.items, False))
|
||||
s.append_string ("<br/>script_url(%"" + req.path_info + "%")=" + ctx.script_url (req.path_info) + "%N")
|
||||
s.append_string ("<br/>script_url(%"" + req.path_info + "%")=" + req.script_url (req.path_info) + "%N")
|
||||
-- if attached ctx.http_authorization_login_password as t then
|
||||
-- s.append_string ("Check login=" + t.login + "<br/>%N")
|
||||
-- end
|
||||
@@ -75,8 +75,8 @@ feature -- Execution
|
||||
end
|
||||
end
|
||||
else
|
||||
s.append ("%N Try " + ctx.script_absolute_url (req.path_info + "?op=env") + " to display all variables%N")
|
||||
s.append ("%N Try " + ctx.script_absolute_url (req.path_info + "?op=crash") + " to demonstrate exception trace%N")
|
||||
s.append ("%N Try " + ctx.script_absolute_url (req, req.path_info + "?op=env") + " to display all variables%N")
|
||||
s.append ("%N Try " + ctx.script_absolute_url (req, req.path_info + "?op=crash") + " to demonstrate exception trace%N")
|
||||
end
|
||||
|
||||
res.set_status_code (200)
|
||||
|
||||
@@ -10,10 +10,12 @@ class
|
||||
inherit
|
||||
APP_SERVICE
|
||||
redefine
|
||||
create_router,
|
||||
execute
|
||||
end
|
||||
|
||||
REST_SERVICE_GATEWAY
|
||||
WSF_REQUEST_UTILITY
|
||||
|
||||
create
|
||||
make
|
||||
@@ -42,18 +44,17 @@ feature {NONE} -- Handlers
|
||||
gh: APP_REQUEST_ROUTING_HANDLER
|
||||
do
|
||||
create {APP_ACCOUNT_VERIFY_CREDENTIAL} h.make
|
||||
router.map ("/account/verify_credentials", h)
|
||||
router.map ("/account/verify_credentials.{format}", h)
|
||||
router.handle ("/account/verify_credentials.{format}", h)
|
||||
|
||||
|
||||
create {APP_TEST} h.make
|
||||
|
||||
create gh.make (4)
|
||||
router.map ("/test", gh)
|
||||
router.handle ("/test", gh)
|
||||
-- gh.map ("/test", h)
|
||||
gh.map ("/test/{op}", h)
|
||||
gh.map ("/test.{format}", h)
|
||||
gh.map ("/test.{format}/{op}", h)
|
||||
gh.router.handle ("/test/{op}", h)
|
||||
gh.router.handle ("/test.{format}", h)
|
||||
gh.router.handle ("/test.{format}/{op}", h)
|
||||
|
||||
|
||||
create rah.make (agent execute_exit_application)
|
||||
@@ -61,8 +62,8 @@ feature {NONE} -- Handlers
|
||||
h.set_description ("tell the REST server to exit (in FCGI context, this is used to reload the FCGI server)")
|
||||
h.enable_request_method_get
|
||||
h.enable_format_text
|
||||
router.map ("/debug/exit", h)
|
||||
router.map ("/debug/exit.{format}", h)
|
||||
router.handle ("/debug/exit", h)
|
||||
router.handle ("/debug/exit.{format}", h)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
@@ -131,7 +132,7 @@ feature -- Implementation
|
||||
|
||||
create s.make_empty
|
||||
s.append_string ("Exited")
|
||||
s.append_string (" <a href=%"" + ctx.script_url ("/") + "%">start again</a>%N")
|
||||
s.append_string (" <a href=%"" + req.script_url ("/") + "%">start again</a>%N")
|
||||
res.put_string (s)
|
||||
exit_with_code (0)
|
||||
end
|
||||
|
||||
@@ -9,18 +9,34 @@ class
|
||||
|
||||
inherit
|
||||
APP_REQUEST_HANDLER
|
||||
undefine
|
||||
execute, pre_execute, post_execute
|
||||
end
|
||||
-- undefine
|
||||
-- execute, pre_execute, post_execute
|
||||
-- end
|
||||
|
||||
REST_REQUEST_AGENT_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
|
||||
undefine
|
||||
authenticated
|
||||
execute
|
||||
-- authenticated
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Access
|
||||
|
||||
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
execute (ctx, req, res)
|
||||
end
|
||||
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
-- Is authentication required
|
||||
-- might depend on the request environment
|
||||
-- or the associated resources
|
||||
do
|
||||
Result := False
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {REST_REQUEST_URI_TEMPLATE_ROUTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_REQUEST_ROUTER
|
||||
|
||||
inherit
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_base_url
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
@@ -9,25 +9,32 @@ class
|
||||
|
||||
inherit
|
||||
APP_REQUEST_HANDLER
|
||||
rename
|
||||
execute as uri_template_execute
|
||||
undefine
|
||||
execute
|
||||
uri_template_execute
|
||||
end
|
||||
|
||||
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
|
||||
undefine
|
||||
authenticated,
|
||||
pre_execute,
|
||||
post_execute
|
||||
redefine
|
||||
router
|
||||
end
|
||||
WSF_URI_TEMPLATE_ROUTING_CONTEXT_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Routing
|
||||
feature -- Access
|
||||
|
||||
router: APP_REQUEST_ROUTER
|
||||
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||
-- Is authentication required
|
||||
-- might depend on the request environment
|
||||
-- or the associated resources
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
uri_template_execute (ctx, req, res)
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
|
||||
@@ -8,14 +8,8 @@ deferred class
|
||||
APP_SERVICE
|
||||
|
||||
inherit
|
||||
REST_SERVICE_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
|
||||
redefine
|
||||
router
|
||||
end
|
||||
REST_SERVICE_I [APP_REQUEST_HANDLER_CONTEXT]
|
||||
|
||||
feature {NONE} -- Router
|
||||
|
||||
router: APP_REQUEST_ROUTER
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
|
||||
@@ -18,7 +18,7 @@ feature -- Execution
|
||||
|
||||
feature {WSF_ROUTER} -- Mapping
|
||||
|
||||
new_mapping (a_resource: READABLE_STRING_8): WSF_ROUTER_CONTEXT_MAPPING [C]
|
||||
new_mapping (a_resource: READABLE_STRING_8): WSF_ROUTER_MAPPING
|
||||
-- New mapping built with Current as handler
|
||||
deferred
|
||||
end
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
<library name="http" location="../../network/protocol/http/http-safe.ecf"/>
|
||||
<library name="ewsgi" location="..\ewsgi\ewsgi-safe.ecf"/>
|
||||
<library name="wsf-safe" location="..\wsf\wsf-safe.ecf"/>
|
||||
<cluster name="extension" location=".extension" recursive="true"/>
|
||||
<cluster name="extension" location="./extension" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||
<assertions precondition="true"/>
|
||||
</option>
|
||||
<option warning="true" full_class_checking="true">
|
||||
<assertions precondition="true"/>
|
||||
</option>
|
||||
|
||||
Reference in New Issue
Block a user