Adopted convention name and value or values for WSF_VALUE and descendant (WSF_STRING ...)

kept `key' as redirection, and also string as obsolete redirection.
Router: provide a way to pass the request methods without using manifest string, thanks to WSF_ROUTER_METHODS
  so instead of using manifest array or manifest strings, just create an instance of WSF_ROUTER_METHODS
  for convenience, WSF_ROUTER provides a few `methods_...' returning prebuilt WSF_ROUTER_METHODS objects
Improved code related to unicode handling in URL, and parameters (before the framework was doing too much)
This commit is contained in:
Jocelyn Fiat
2012-06-11 14:58:13 +02:00
parent 36ed6f525c
commit 8a58d62a7e
29 changed files with 790 additions and 198 deletions

View File

@@ -3,6 +3,7 @@ note
Summary description for {HTML_ENCODER}.
see: http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
see: http://en.wikipedia.org/wiki/Character_encodings_in_HTML
]"
legal: "See notice at end of class."
status: "See notice at end of class."
@@ -38,6 +39,7 @@ feature -- Encoder
local
i, n: INTEGER
uc: CHARACTER_32
l_code: INTEGER
c: CHARACTER_8
do
has_error := False
@@ -47,14 +49,31 @@ feature -- Encoder
uc := s.item (i)
if uc.is_character_8 then
c := uc.to_character_8
inspect c
when '%T', '%N', '%R' then
Result.extend (c)
when '%"' then Result.append_string (""")
when '&' then Result.append_string ("&")
when '%'' then Result.append_string ("'")
when '<' then Result.append_string ("&lt;")
when '>' then Result.append_string ("&gt;")
else
Result.extend (c)
l_code := c.code
if
l_code <= 31 or -- Hexa 1F
l_code = 127 -- Hexa 7F
then
-- Ignore (forbidden in HTML, even by reference
elseif l_code >= 128 then
--| Tolerated
Result.append ("&#")
Result.append (l_code.out)
Result.extend (';')
else
Result.extend (c)
end
end
else
Result.append ("&#")
@@ -134,7 +153,7 @@ feature {NONE} -- Implementation: decoder
do
sharp_code := ('#').natural_32_code
x_code := ('x').natural_32_code
x_code := (';').natural_32_code
semi_colon_code := (';').natural_32_code
i := cl_i.item
create s.make_empty

View File

@@ -45,11 +45,8 @@ feature -- Encoder
encoded_string (s: READABLE_STRING_32): STRING_8
-- URL-encoded value of `s'.
do
Result := Precursor (s)
if not has_error then
Result := utf32_to_utf8 (Result)
has_error := not last_conversion_successful
end
Result := utf32_to_utf8 (s)
Result := Precursor (Result)
end
partial_encoded_string (s: READABLE_STRING_32; a_ignore: ARRAY [CHARACTER]): READABLE_STRING_8
@@ -58,7 +55,6 @@ feature -- Encoder
Result := Precursor (s, a_ignore)
if not has_error then
Result := utf32_to_utf8 (Result)
has_error := not last_conversion_successful
end
end