First try to get a limited WGI_ and use WSF_ as default framework

This commit is contained in:
Jocelyn Fiat
2011-10-19 00:34:30 +02:00
parent eaa99c9c61
commit aec0136739
51 changed files with 2756 additions and 1082 deletions

View File

@@ -7,12 +7,13 @@
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all"/>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf"/>
<library name="wsf" location="..\..\wsf\wsf-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
<library name="router" location="..\..\request\router\router-safe.ecf" readonly="false"/>
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf"/>
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
<cluster name="contrib" location=".\src\contrib\" recursive="true">
<file_rule>
<exclude>/html$</exclude>

View File

@@ -9,7 +9,7 @@
</file_rule>
<option warning="true" full_class_checking="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="ewsgi" location="..\..\ewsgi\ewsgi.ecf"/>
<library name="wsf" location="..\..\wsf\wsf.ecf"/>
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
<library name="router" location="..\..\request\router\router.ecf" readonly="false"/>
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>

View File

@@ -31,7 +31,7 @@ feature {NONE} -- Initialization
feature -- Access
headers: EWF_HEADER
headers: WSF_HEADER
feature -- Recycle
@@ -155,7 +155,7 @@ feature -- Output
Result := o
end
send (buf: WGI_RESPONSE_BUFFER)
send (buf: WSF_RESPONSE)
do
buf.set_status_code (200)
buf.write_headers_string (header_string)

View File

@@ -30,13 +30,13 @@ feature {NONE} -- Access: Implementation
feature -- Access
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
do
end
feature -- Execution
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
rep: like new_html_page
s: STRING
@@ -50,7 +50,7 @@ feature -- Execution
create s.make_empty
if
attached {WGI_STRING_VALUE} ctx.path_parameter ("resource") as l_resource_value and then
attached {WSF_STRING_VALUE} ctx.path_parameter ("resource") as l_resource_value and then
attached l_resource_value.string as l_resource
then
from
@@ -114,7 +114,7 @@ feature -- Execution
rep.recycle
end
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_dft_format: detachable STRING)
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; a_dft_format: detachable STRING)
local
l_dft_format_name: detachable STRING
s: STRING

View File

@@ -32,7 +32,7 @@ feature -- Recycle
feature -- Access
headers: EWF_HEADER
headers: WSF_HEADER
api: STRING
-- Associated api query string.
@@ -129,7 +129,7 @@ feature -- Output
Result := o
end
send (res: WGI_RESPONSE_BUFFER)
send (res: WSF_RESPONSE)
do
compute
res.set_status_code (200)

View File

@@ -23,7 +23,7 @@ create
feature -- status
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end

View File

@@ -15,7 +15,7 @@ inherit
feature -- Access
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
-- Is authentication required
-- might depend on the request environment
-- or the associated resources
@@ -35,7 +35,7 @@ feature -- Element change
feature -- Execution
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
local
rescued: BOOLEAN
@@ -60,24 +60,24 @@ feature -- Execution
retry
end
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
pre_execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
pre_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
end
post_execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
post_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
end
rescue_execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
rescue_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
post_execute (ctx, req, res)
end
execute_unauthorized (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_unauthorized (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
res.write_header ({HTTP_STATUS_CODE}.unauthorized, Void)

View File

@@ -18,7 +18,7 @@ create
feature -- Mapping
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
local
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]

View File

@@ -25,7 +25,7 @@ create
feature -- Status report
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
@@ -36,12 +36,12 @@ feature {NONE} -- Implementation
feature -- Execution
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
Precursor {REQUEST_URI_ROUTING_HANDLER_I} (ctx, req, res)
end
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
check should_not_occur: False end
end

View File

@@ -18,7 +18,7 @@ create
feature -- Mapping
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
local
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]

View File

@@ -25,7 +25,7 @@ create
feature -- Status report
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
@@ -36,14 +36,14 @@ feature {NONE} -- Implementation
feature -- Execution
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
pre_execute (ctx, req, res)
Precursor {REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
post_execute (ctx, req, res)
end
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
check should_not_occur: False end
end

View File

@@ -12,7 +12,7 @@
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="rest" location="..\rest-safe.ecf" readonly="false"/>
<library name="ewsgi" location="..\..\..\ewsgi\ewsgi-safe.ecf" readonly="false"/>
<library name="wsf" location="..\..\..\wsf\wsf-safe.ecf" readonly="false"/>
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf" readonly="false"/>
</target>
<target name="sample_fcgi" extends="common">

View File

@@ -35,14 +35,14 @@ feature {NONE} -- Initialization
feature -- Access
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := True
end
feature -- Execution
execute_unauthorized (a_hdl_context: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_unauthorized (a_hdl_context: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING
lst: LIST [STRING]
@@ -52,16 +52,16 @@ feature -- Execution
res.write_string ("Unauthorized")
end
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_full: BOOLEAN
h: EWF_HEADER
h: WSF_HEADER
l_login: STRING_8
s: STRING
content_type_supported: ARRAY [STRING]
l_format_id: INTEGER
do
content_type_supported := <<{HTTP_CONSTANTS}.json_app, {HTTP_CONSTANTS}.xml_text, {HTTP_CONSTANTS}.plain_text>>
content_type_supported := <<{HTTP_CONSTANTS}.application_json, {HTTP_CONSTANTS}.text_xml, {HTTP_CONSTANTS}.text_plain>>
l_format_id := ctx.request_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")

View File

@@ -32,17 +32,17 @@ feature {NONE} -- Initialization
feature -- Access
authentication_required (req: WGI_REQUEST): BOOLEAN
authentication_required (req: WSF_REQUEST): BOOLEAN
do
end
feature -- Execution
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
local
s: STRING
h: EWF_HEADER
h: WSF_HEADER
do
create h.make
h.put_content_type_text_plain

View File

@@ -68,17 +68,17 @@ feature {NONE} -- Handlers
feature -- Execution
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
request_count := request_count + 1
Precursor (req, res)
end
execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
local
rqst_uri: detachable STRING
l_path_info: detachable STRING
h: EWF_HEADER
h: WSF_HEADER
s: STRING
l_redir_url: STRING
do
@@ -96,6 +96,8 @@ feature -- Execution
res.write_string (s)
end
request_count: INTEGER
-- execute_rescue (ctx: like new_request_context)
-- -- Execute the default rescue behavior
-- do
@@ -106,7 +108,7 @@ feature -- Implementation
-- execute_exception_trace (ctx: like new_request_context)
-- local
-- h: EWF_HEADER
-- h: WSF_HEADER
-- s: STRING
-- do
-- create h.make
@@ -121,7 +123,7 @@ feature -- Implementation
-- exit_with_code (-1)
-- end
execute_exit_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
execute_exit_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING
do

View File

@@ -2,7 +2,7 @@ deferred class
REST_APPLICATION_GATEWAY
inherit
WGI_APPLICATION
WSF_APPLICATION
feature -- Access

View File

@@ -2,7 +2,7 @@ deferred class
REST_APPLICATION_GATEWAY
inherit
WGI_APPLICATION
WSF_APPLICATION
feature -- Access

View File

@@ -2,7 +2,7 @@ deferred class
REST_APPLICATION_GATEWAY
inherit
WGI_APPLICATION
WSF_APPLICATION
feature -- Access

View File

@@ -23,7 +23,7 @@ feature {NONE} -- Initialization
feature {NONE} -- Implementation
wgi_value_iteration_to_string (v: ITERABLE [WGI_VALUE]; using_pre: BOOLEAN): STRING_8
wgi_value_iteration_to_string (v: ITERABLE [WSF_VALUE]; using_pre: BOOLEAN): STRING_8
do
create Result.make (100)
if using_pre then

View File

@@ -9,7 +9,7 @@ deferred class
feature -- Helpers
send_error (a_path: STRING; a_error_id: INTEGER; a_error_name: STRING; a_error_message: detachable STRING; ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
send_error (a_path: STRING; a_error_id: INTEGER; a_error_name: STRING; a_error_message: detachable STRING; ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING
i,nb: INTEGER