Web form:

- Improvement about web form manipulation (remove a field, set a text value to input fields by name, ...)
 - Improved web form html generation, especially for select and type checkbox
 - Updated the date input field interface with a new set_date_value .

File response:
 - "application/force-download" is not a standard MIME content type, so use "application_octet_stream" instead as default.

Standalone connector:
 - Added expected creation procedure for the service launcher.
 - Added new "secure_port" configuration variable, for SSL standalone service.
   This way, if `is_secure` is True, the server will use `secure_port` (overrides `port` value).

Date:
 - Improved support for RFC 3339 (a profile of ISO 8601)

Removed obsolete and warnings:
 - removed usage of FILE_NAME
 - updated code to avoid implicit conversion from STRING_32 to STRING_8
 - avoid uneed conversion to STRING_8 (when possible)
This commit is contained in:
2020-10-02 15:02:06 +02:00
parent 75380a27fe
commit 30a5e087ae
80 changed files with 444 additions and 260 deletions

View File

@@ -51,7 +51,7 @@ feature {NONE} -- Initialization
router: WSF_ROUTER
resource: detachable STRING
resource: detachable READABLE_STRING_8
is_hidden: BOOLEAN
-- Current mapped handler should be hidden from self documentation

View File

@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
router := a_router
end
make_with_resource (req: WSF_REQUEST; a_router: WSF_ROUTER; a_resource: STRING)
make_with_resource (req: WSF_REQUEST; a_router: WSF_ROUTER; a_resource: READABLE_STRING_8)
-- Make Current for request `req' and router `a_router'
-- and use `a_resource' to also generate links to this documentation via `a_resource'
--| note: it could be "/doc" or "/api/doc" or ...
@@ -51,7 +51,7 @@ feature -- Access
router: WSF_ROUTER
resource: detachable STRING_8
resource: detachable READABLE_STRING_8
feature -- Properties
@@ -310,13 +310,13 @@ feature {NONE} -- Implementation
Result := resource /= Void
end
doc_url (a_api: STRING_8): STRING_8
doc_url (a_api: READABLE_STRING_8): STRING_8
-- URL to show the documentation related to `a_api'.
require
doc_url_supported: doc_url_supported
do
if attached resource as s then
Result := request.script_url (s) + "?api=" + url_encoder.encoded_string (a_api)
Result := request.script_url (s) + "?api=" + url_encoder.general_encoded_string (a_api)
else
Result := request.script_url ("")
end
@@ -333,7 +333,7 @@ feature {NONE} -- Implementation
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -1,7 +1,7 @@
note
description: "Summary description for {WSF_CUSTOM_HEADER_FILTER}."
date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $"
revision: "$Revision: 92585 $"
date: "$Date$"
revision: "$Revision$"
class
WSF_CUSTOM_HEADER_FILTER

View File

@@ -2,39 +2,42 @@ note
description: "Summary description for {WSF_FORMAT_UTILITY }."
author: ""
date: "$Date$"
revision: "$Revision$"
revision: "$Revision$"
class
WSF_FORMAT_UTILITY
feature -- Access
accepted_content_types (req: WSF_REQUEST): detachable ARRAYED_LIST [READABLE_STRING_8]
accepted_content_types (req: WSF_REQUEST): detachable ARRAYED_LIST [STRING_8]
local
s: STRING_8
q: READABLE_STRING_8
q,rs: READABLE_STRING_8
p: INTEGER
lst: LIST [READABLE_STRING_8]
qs: QUICK_SORTER [READABLE_STRING_8]
do
--TEST if attached ("text/html,application/xhtml+xml;q=0.6,application/xml;q=0.2,text/plain;q=0.5,*/*;q=0.8") as l_accept then
if attached req.http_accept as l_accept then
lst := l_accept.as_string_8.split (',')
lst := l_accept.split (',')
create Result.make (lst.count)
from
lst.start
until
lst.after
loop
s := lst.item
p := s.substring_index (";q=", 1)
rs := lst.item
p := rs.substring_index (";q=", 1)
if p > 0 then
q := s.substring (p + 3, s.count)
s := s.substring (1, p - 1)
q := rs.substring (p + 3, rs.count)
rs := rs.substring (1, p - 1)
else
q := "1.0"
end
Result.force (q + ":" + s)
create s.make_from_string (q)
s.append_character (':')
s.append (rs)
Result.force (s)
lst.forth
end
@@ -77,7 +80,7 @@ feature {NONE} -- Implementation
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -28,8 +28,10 @@ feature -- Access
do
if attached condition_description as desc and then desc.is_valid_as_string_8 then
Result := desc.to_string_8
elseif description.is_valid_as_string_8 then
Result := description.to_string_8
else
Result := description
Result := {UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (description)
end
end

View File

@@ -11,7 +11,7 @@ inherit
feature -- Mapping helper: uri template
map_uri_template (a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
map_uri_template (a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
-- Map `h' as handler for `a_tpl', according to `rqst_methods'.
require
a_tpl_attached: a_tpl /= Void

View File

@@ -254,7 +254,7 @@ feature -- Execution
if attached directory_index_file (d) as f then
process_file (f, req, res)
else
uri := a_uri
uri := a_uri.to_string_8
if not uri.is_empty and then uri [uri.count] /= '/' then
uri.append_character ('/')
end
@@ -376,7 +376,7 @@ feature -- Execution
ext := extension (f.path.name)
ct := extension_mime_mapping.mime_type (ext)
if ct = Void then
ct := {HTTP_MIME_TYPES}.application_force_download
ct := {HTTP_MIME_TYPES}.application_octet_stream
end
create fres.make_with_content_type_and_path (ct, f.path)
fres.set_status_code ({HTTP_STATUS_CODE}.ok)
@@ -654,7 +654,7 @@ feature {NONE} -- implementation: date time
end
note
copyright: "2011-2019, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -31,19 +31,19 @@ feature {NONE} -- Initialization
do
l_tokens := a_protocol.split ('/')
if l_tokens.count = 2 then
l_protocol_name := l_tokens [1].as_string_8
l_protocol_name := l_tokens [1].to_string_8
l_protocol_name.left_adjust
l_protocol_name.right_adjust
if l_protocol_name.is_case_insensitive_equal ({HTTP_CONSTANTS}.http_version_1_0.substring (1, 4)) then
l_protocol_version := l_tokens [2].as_string_8
l_protocol_version := l_tokens [2].to_string_8
l_protocol_version.left_adjust
l_protocol_version.right_adjust
l_tokens := l_protocol_version.split ('.')
if l_tokens.count = 2 then
l_major := l_tokens [1].as_string_8
l_major := l_tokens [1].to_string_8
l_major.left_adjust
l_major.right_adjust
l_minor := l_tokens [2].as_string_8
l_minor := l_tokens [2].to_string_8
l_minor.left_adjust
l_minor.right_adjust
if l_major.is_natural then

View File

@@ -106,9 +106,9 @@ feature {WSF_ROUTER} -- Mapping
debug ("router")
-- Display conflict in mapping
if has_item_associated_with_resource (l_mapping.associated_resource, a_item.request_methods) then
io.error.put_string ("Mapping: " + l_mapping.debug_output + ": conflict with existing mapping")
io.error.put_string_32 ({STRING_32} "Mapping: " + l_mapping.debug_output.to_string_32 + {STRING_32} ": conflict with existing mapping")
if attached item_associated_with_resource (l_mapping.associated_resource, a_item.request_methods) as l_conflicted then
io.error.put_string (": " + l_conflicted.debug_output)
io.error.put_string_32 ({STRING_32} ": " + l_conflicted.debug_output)
end
io.error.put_string ("%N")
end

View File

@@ -58,7 +58,10 @@ feature -- Execution
create sess
router.dispatch (req, res, sess)
if not sess.dispatched then
res.put_header ({HTTP_STATUS_CODE}.not_found, <<[{HTTP_HEADER_NAMES}.header_content_length, "0"]>>)
res.put_header ({HTTP_STATUS_CODE}.not_found,
{ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<
[{HTTP_HEADER_NAMES}.header_content_length, "0"]
>>)
end
end