Corrected remaining issue related to recent addition of REQUEST_ROUTER.make_with_base_url

And applied removal of format_name and format_id, and replaced by accepted_format_name, ...
This commit is contained in:
Jocelyn Fiat
2012-01-20 18:55:03 +01:00
parent da9fa4ecc2
commit c92c2a91b4
7 changed files with 12 additions and 50 deletions

View File

@@ -14,7 +14,8 @@ inherit
end end
create create
make make,
make_with_base_url
feature -- Mapping feature -- Mapping
@@ -28,7 +29,7 @@ feature -- Mapping
end end
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -14,14 +14,15 @@ inherit
end end
create create
make make,
make_with_base_url
feature {NONE} -- Routing feature {NONE} -- Routing
router: REST_REQUEST_URI_TEMPLATE_ROUTER router: REST_REQUEST_URI_TEMPLATE_ROUTER
;note ;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -62,7 +62,7 @@ feature -- Execution
l_format_id: INTEGER l_format_id: INTEGER
do do
content_type_supported := <<{HTTP_CONSTANTS}.application_json, {HTTP_CONSTANTS}.text_xml, {HTTP_CONSTANTS}.text_plain>> 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) l_format_id := ctx.request_accepted_format_id ("format", content_type_supported)
if authenticated (ctx) then if authenticated (ctx) then
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true") l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
if attached authenticated_identifier (ctx) as log then if attached authenticated_identifier (ctx) as log then

View File

@@ -55,7 +55,7 @@ feature -- Execution
-- ctx.request_format_id ("format", Void) -- ctx.request_format_id ("format", Void)
if attached ctx.request_format ("format", Void) as l_format then if attached ctx.request_accepted_format ("format", Void) as l_format then
s.append_string (" format=" + l_format + "%N") s.append_string (" format=" + l_format + "%N")
end end

View File

@@ -13,48 +13,7 @@ inherit
create create
make make
note
feature -- Format
get_format_id (a_format_variable_name: detachable READABLE_STRING_8; a_content_type_supported: detachable ARRAY [STRING_8])
do
if internal_format_id = 0 then
internal_format_id := request_format_id (a_format_variable_name, a_content_type_supported)
end
end
get_format_name (a_format_variable_name: detachable READABLE_STRING_8; a_content_type_supported: detachable ARRAY [STRING_8])
do
if internal_format_name = Void then
internal_format_name := request_format (a_format_variable_name, a_content_type_supported)
end
end
format_id: INTEGER
do
if internal_format_id = 0 then
get_format_id (Void, Void)
end
Result := internal_format_id
end
format_name: detachable READABLE_STRING_8
do
Result := internal_format_name
if Result = Void then
Result := request_format (Void, Void)
internal_format_name := Result
end
end
feature {NONE} -- Internal
internal_format_id: like format_id
internal_format_name: like format_name
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[

View File

@@ -20,7 +20,7 @@ feature -- Helpers
rep_data.headers.put_content_type_text_plain rep_data.headers.put_content_type_text_plain
create s.make_empty create s.make_empty
inspect ctx.format_id inspect ctx.accepted_format_id
when {HTTP_FORMAT_CONSTANTS}.json then when {HTTP_FORMAT_CONSTANTS}.json then
rep_data.headers.put_content_type_text_plain rep_data.headers.put_content_type_text_plain
s := "{%"application%": %"" + a_path + "%"" s := "{%"application%": %"" + a_path + "%""

View File

@@ -11,7 +11,8 @@ inherit
REST_REQUEST_URI_TEMPLATE_ROUTER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT] REST_REQUEST_URI_TEMPLATE_ROUTER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
create create
make make,
make_with_base_url
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2011, Eiffel Software and others"