From 6b2e256fa7e01776ec93dbf0244d0351b8c25f3b Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 27 Oct 2017 12:27:05 +0200 Subject: [PATCH] Use absolute URL for href value in webapi json response. --- src/service/response/json_webapi_response.e | 49 +-------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/src/service/response/json_webapi_response.e b/src/service/response/json_webapi_response.e index 0ff4050..5e4d05c 100644 --- a/src/service/response/json_webapi_response.e +++ b/src/service/response/json_webapi_response.e @@ -94,7 +94,7 @@ feature -- Links lnk.put_string (a_attname, "name") end - lnk.put_string (a_att_href, "href") + lnk.put_string (api.absolute_url (a_att_href, Void), "href") lnks.put (lnk, rel) end @@ -114,12 +114,11 @@ feature -- Links lnk.put_string (a_attname, "name") end - lnk.put_string (a_att_href, "href") + lnk.put_string (api.absolute_url (a_att_href, Void), "href") lnk.put_boolean (True, "templated") lnks.put (lnk, rel) end - feature -- Execution process @@ -152,50 +151,6 @@ feature {NONE} -- Implementation factory ctx.register_serializer (create {TABLE_ITERABLE_JSON_SERIALIZER [detachable ANY, READABLE_STRING_GENERAL]}, {TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]}) ctx.register_serializer (create {ITERABLE_JSON_SERIALIZER [detachable ANY]}, {ITERABLE [detachable ANY]}) Result := l_serializer.to_json (a_value, ctx) --- if a_value = Void then --- create {JSON_NULL} Result --- elseif attached {READABLE_STRING_GENERAL} a_value as s then --- create {JSON_STRING} Result.make_from_string_general (s) --- elseif attached {BOOLEAN} a_value as b then --- create {JSON_BOOLEAN} Result.make (b) --- elseif attached {NUMERIC} a_value as num then ----- if attached {INTEGER_64} num as i64 then ----- add_integer_64_field (a_name, i64) ----- elseif attached {INTEGER_32} num as i32 then ----- add_integer_64_field (a_name, i32.as_integer_64) ----- elseif attached {INTEGER_16} num as i16 then ----- add_integer_64_field (a_name, i16.as_integer_64) ----- elseif attached {INTEGER_8} num as i8 then ----- add_integer_64_field (a_name, i8.as_integer_64) ----- elseif attached {NATURAL_64} num as n64 then ----- add_natural_64_field (a_name, n64) ----- elseif attached {NATURAL_32} num as n32 then ----- add_natural_64_field (a_name, n32.as_natural_64) ----- elseif attached {NATURAL_16} num as n16 then ----- add_natural_64_field (a_name, n16.as_natural_64) ----- elseif attached {NATURAL_8} num as n8 then ----- add_natural_64_field (a_name, n8.as_natural_64) ----- elseif attached {REAL_64} num as r64 then ----- add_real_64_field (a_name, r64) ----- elseif attached {REAL_32} num as r32 then ----- add_real_64_field (a_name, r32.to_double ----- else ----- check is_basic_numeric_type: False end ----- add_string_field (a_name, num.out) ----- end --- elseif attached {CHARACTER_8} a_value as ch8 then ----- add_string_field (a_name, ch8.out) --- elseif attached {CHARACTER_32} a_value as ch32 then ----- add_string_field (a_name, ch32.out) --- elseif attached {POINTER} a_value as ptr then ----- add_string_field (a_name, ptr.out) --- elseif attached {ITERABLE [detachable ANY]} a_value as arr then ----- add_iterator_field (a_name, arr) --- elseif attached {TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]} a_value as tb then ----- add_table_iterator_field (a_name, tb) --- else --- check is_supported_type: False end --- end end invariant