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:
@@ -72,8 +72,11 @@ feature {NONE} -- Initialization
|
||||
if attached {READABLE_STRING_GENERAL} opts.option ("server_name") as l_server_name then
|
||||
server_name := l_server_name.to_string_8
|
||||
end
|
||||
if attached {READABLE_STRING_GENERAL} opts.option ("base") as l_base_str then
|
||||
base_url := l_base_str.as_string_8
|
||||
if
|
||||
attached {READABLE_STRING_GENERAL} opts.option ("base") as l_base_str and then
|
||||
l_base_str.is_valid_as_string_8
|
||||
then
|
||||
base_url := l_base_str.to_string_8
|
||||
end
|
||||
|
||||
verbose := opts.option_boolean_value ("verbose", verbose)
|
||||
@@ -130,6 +133,11 @@ feature {NONE} -- Initialization
|
||||
then
|
||||
secure_settings := [ssl_prot, opts.option_string_32_value ("ssl_ca_crt", Void), opts.option_string_32_value ("ssl_ca_key", Void)]
|
||||
end
|
||||
if is_secure then
|
||||
if opts.has_integer_option ("secure_port") then
|
||||
port_number := opts.option_integer_value ("secure_port", port_number)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
create conn.make
|
||||
|
||||
@@ -11,6 +11,15 @@ class
|
||||
inherit
|
||||
WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
|
||||
create
|
||||
default_create,
|
||||
make,
|
||||
make_from_array,
|
||||
make_from_iterable
|
||||
|
||||
convert
|
||||
make_from_array ({ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]})
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_secure_connection_supported: BOOLEAN
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
note
|
||||
description: "Filter implementing debug output in error stream, or `output' file."
|
||||
date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $"
|
||||
revision: "$Revision: 92585 $"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_DEBUG_FILTER
|
||||
@@ -72,7 +72,7 @@ feature -- Basic operations
|
||||
s.append (c.item.generating_type.name)
|
||||
s.append_character ('}')
|
||||
s.append_character ('=')
|
||||
s.append (c.item.debug_output.as_string_8)
|
||||
s.append ({UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (c.item.debug_output))
|
||||
s.append_character ('%N')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,7 +99,6 @@ feature -- Execution
|
||||
fut: FILE_UTILITIES
|
||||
proc: BASE_PROCESS
|
||||
l_input_env: STRING_TABLE [READABLE_STRING_GENERAL]
|
||||
l_input_header: detachable STRING
|
||||
l_input_buf: STRING
|
||||
l_output: STRING
|
||||
l_output_header_sent: BOOLEAN
|
||||
@@ -107,10 +106,6 @@ feature -- Execution
|
||||
s: STRING
|
||||
i, j, n: INTEGER
|
||||
do
|
||||
-- Header
|
||||
if attached req.raw_header_data as l_header then
|
||||
l_input_header := l_header
|
||||
end
|
||||
-- Input data
|
||||
create l_input_buf.make (req.content_length_value.to_integer_32)
|
||||
req.read_input_data_into (l_input_buf)
|
||||
@@ -126,7 +121,7 @@ feature -- Execution
|
||||
check supported: False end
|
||||
end
|
||||
end
|
||||
-- No need to import `l_input_header` in environment
|
||||
-- No need to import input_header in environment
|
||||
-- As current connector already did the job.
|
||||
if
|
||||
attached cgi_request_data (req) as d and then
|
||||
@@ -149,7 +144,7 @@ feature -- Execution
|
||||
if proc.launched then
|
||||
-- Do not send the header to CGI script
|
||||
-- value are passed via environment variables
|
||||
-- proc.put_string (l_input_header)
|
||||
-- proc.put_string (input_header)
|
||||
-- Send payload.
|
||||
proc.put_string (l_input_buf)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
note
|
||||
description: "Handler returning debug information."
|
||||
|
||||
date: "$Date: 2013-06-28 16:14:02 +0200 (ven., 28 juin 2013) $"
|
||||
revision: "$Revision: 92754 $"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_DEBUG_HANDLER
|
||||
|
||||
@@ -53,7 +53,11 @@ feature -- Helper
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
res.put_header ({HTTP_STATUS_CODE}.unsupported_media_type, << ["Content-Type", "text/plain"], ["Accept", accept_s]>>)
|
||||
res.put_header ({HTTP_STATUS_CODE}.unsupported_media_type,
|
||||
{ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<
|
||||
["Content-Type", "text/plain"], ["Accept", accept_s]
|
||||
>>
|
||||
)
|
||||
if accept_s /= Void then
|
||||
res.put_string ("Unsupported request content-type, Accept: " + accept_s + "%N")
|
||||
end
|
||||
@@ -76,7 +80,8 @@ feature -- Helper
|
||||
end
|
||||
s.append_string (c.item)
|
||||
end
|
||||
res.put_header ({HTTP_STATUS_CODE}.method_not_allowed, <<
|
||||
res.put_header ({HTTP_STATUS_CODE}.method_not_allowed,
|
||||
{ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<
|
||||
["Content-Type", {HTTP_MIME_TYPES}.text_plain],
|
||||
["Allow", s]
|
||||
>>)
|
||||
|
||||
@@ -100,7 +100,7 @@ feature -- Execution
|
||||
do
|
||||
a_output.append ("CGI variables:")
|
||||
a_output.append (eol)
|
||||
a_output.append (req.cgi_variables.debug_output)
|
||||
append_unicode (req.cgi_variables.debug_output, a_output)
|
||||
a_output.append (eol)
|
||||
a_output.append (eol)
|
||||
end
|
||||
|
||||
@@ -18,13 +18,13 @@ inherit
|
||||
|
||||
feature -- Url Query
|
||||
|
||||
script_absolute_url (req: WSF_REQUEST; a_path: STRING): STRING
|
||||
script_absolute_url (req: WSF_REQUEST; a_path: READABLE_STRING_8): READABLE_STRING_8
|
||||
-- Absolute Url for the script if any, extended by `a_path'
|
||||
do
|
||||
Result := req.absolute_script_url (a_path)
|
||||
end
|
||||
|
||||
script_url (req: WSF_REQUEST; a_path: STRING): STRING
|
||||
script_url (req: WSF_REQUEST; a_path: READABLE_STRING_8): READABLE_STRING_8
|
||||
-- Url relative to script name if any, extended by `a_path'
|
||||
require
|
||||
a_path_attached: a_path /= Void
|
||||
@@ -32,11 +32,12 @@ feature -- Url Query
|
||||
Result := req.script_url (a_path)
|
||||
end
|
||||
|
||||
url (req: WSF_REQUEST; a_path: STRING; args: detachable STRING; abs: BOOLEAN): STRING
|
||||
url (req: WSF_REQUEST; a_path: READABLE_STRING_8; args: detachable READABLE_STRING_8; abs: BOOLEAN): READABLE_STRING_8
|
||||
-- Associated url based on `path' and `args'
|
||||
-- if `abs' then return absolute url
|
||||
local
|
||||
s,t: detachable STRING
|
||||
s: detachable READABLE_STRING_8
|
||||
t: detachable STRING_8
|
||||
do
|
||||
s := args
|
||||
if s /= Void and then s.count > 0 then
|
||||
|
||||
@@ -24,19 +24,19 @@ feature -- Request
|
||||
|
||||
feature -- Url Query
|
||||
|
||||
script_absolute_url (a_path: STRING): STRING
|
||||
script_absolute_url (a_path: STRING): READABLE_STRING_8
|
||||
-- Absolute Url for the script if any, extended by `a_path'
|
||||
do
|
||||
Result := utility.script_absolute_url (request, a_path)
|
||||
end
|
||||
|
||||
script_url (a_path: STRING): STRING
|
||||
script_url (a_path: STRING): READABLE_STRING_8
|
||||
-- Url relative to script name if any, extended by `a_path'
|
||||
do
|
||||
Result := utility.script_url (request, a_path)
|
||||
end
|
||||
|
||||
url (args: detachable STRING; abs: BOOLEAN): STRING
|
||||
url (args: detachable STRING; abs: BOOLEAN): READABLE_STRING_8
|
||||
-- Associated url based on `path' and `args'
|
||||
-- if `abs' then return absolute url
|
||||
do
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ note
|
||||
description: "[
|
||||
Component to handle percent encoding
|
||||
]"
|
||||
date: "$Date: 2013-05-21 01:15:17 +0200 (mar., 21 mai 2013) $"
|
||||
revision: "$Revision: 92557 $"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
EIS: "name=Percent-encoding", "protocol=URI", "src=http://en.wikipedia.org/wiki/Percent-encoding"
|
||||
|
||||
class
|
||||
|
||||
@@ -26,7 +26,7 @@ feature -- Status report
|
||||
feature -- Execution
|
||||
|
||||
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable STRING_8])
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
|
||||
local
|
||||
l_content: READABLE_STRING_8
|
||||
n, p, i, j: INTEGER
|
||||
|
||||
@@ -16,7 +16,7 @@ feature -- Status report
|
||||
feature -- Execution
|
||||
|
||||
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable STRING_8])
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
|
||||
-- Handle MIME content from request `req', eventually fill the `a_vars' (not yet available from `req')
|
||||
-- and if `a_raw_data' is attached, store any read data inside `a_raw_data'
|
||||
require
|
||||
@@ -25,7 +25,7 @@ feature -- Execution
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -31,9 +31,9 @@ feature -- Status report
|
||||
feature -- Execution
|
||||
|
||||
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable STRING_8])
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
|
||||
local
|
||||
s: like full_input_data
|
||||
s: READABLE_STRING_8
|
||||
do
|
||||
s := full_input_data (req)
|
||||
if a_raw_data /= Void then
|
||||
|
||||
@@ -57,8 +57,7 @@ feature -- Query
|
||||
-- if possible
|
||||
do
|
||||
if attached value as v then
|
||||
-- FIXME: in the future, use the new `{TYPE}.name_32`
|
||||
Result := generating_type.name.to_string_32
|
||||
Result := generating_type.name_32
|
||||
else
|
||||
Result := {STRING_32} "Void"
|
||||
end
|
||||
|
||||
@@ -64,7 +64,7 @@ feature -- Status report
|
||||
Result.append ("%"")
|
||||
|
||||
Result.append (" content-type=%"")
|
||||
Result.append (content_type)
|
||||
Result.append_string_general (content_type)
|
||||
Result.append ("%"")
|
||||
|
||||
Result.append (" size=%"")
|
||||
@@ -121,7 +121,7 @@ feature -- Access: Uploaded File
|
||||
Result := ut.safe_filename (filename)
|
||||
end
|
||||
|
||||
content_type: STRING
|
||||
content_type: READABLE_STRING_8
|
||||
-- Content type
|
||||
|
||||
size: INTEGER
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author: jfiat $"
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ feature -- Content-type related
|
||||
create m_map.make_default
|
||||
m := m_map.mime_type (file_extension (file_path).as_lower)
|
||||
if m = Void then
|
||||
m := {HTTP_MIME_TYPES}.application_force_download
|
||||
m := {HTTP_MIME_TYPES}.application_octet_stream
|
||||
end
|
||||
content_type := m
|
||||
end
|
||||
|
||||
@@ -93,9 +93,9 @@ feature {WSF_RESPONSE} -- Output
|
||||
|
||||
send_to (res: WSF_RESPONSE)
|
||||
local
|
||||
s, l_html_error_code_text: STRING
|
||||
s: STRING
|
||||
l_text: detachable READABLE_STRING_GENERAL
|
||||
l_loc: detachable READABLE_STRING_8
|
||||
l_html_error_code_text, l_loc: detachable READABLE_STRING_8
|
||||
h: like header
|
||||
l_messages: HTTP_STATUS_CODE_MESSAGES
|
||||
do
|
||||
@@ -219,7 +219,8 @@ feature {WSF_RESPONSE} -- Output
|
||||
|
||||
h.put_content_type_text_html
|
||||
else
|
||||
s := l_html_error_code_text + ": the request method "
|
||||
create s.make_from_string (l_html_error_code_text)
|
||||
s.append (": the request method ")
|
||||
s.append (request.request_method)
|
||||
s.append (" is inappropriate for the URL for '" + html_encoder.general_encoded_string (request.request_uri) + "'.%N")
|
||||
if attached suggested_methods as lst and then not lst.is_empty then
|
||||
@@ -327,7 +328,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
|
||||
|
||||
@@ -17,7 +17,7 @@ create
|
||||
make_with_body
|
||||
|
||||
convert
|
||||
make_with_body ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
|
||||
make_with_body ({STRING_8})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
@@ -27,7 +27,9 @@ feature {NONE} -- Initialization
|
||||
create header.make
|
||||
end
|
||||
|
||||
make_with_body (a_body: READABLE_STRING_8)
|
||||
make_with_body (a_body: STRING_8)
|
||||
-- Initialize `body` with `a_body`.
|
||||
-- Note: it mays not be the same object.
|
||||
do
|
||||
make
|
||||
body := a_body
|
||||
@@ -105,7 +107,7 @@ feature {WSF_RESPONSE} -- Output
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, 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
|
||||
|
||||
@@ -7,8 +7,8 @@ note
|
||||
base: base_url (very specific to standalone server)
|
||||
verbose: to display verbose output, useful for Standalone
|
||||
]"
|
||||
date: "$Date: 2016-08-06 13:34:52 +0200 (sam., 06 août 2016) $"
|
||||
revision: "$Revision: 99106 $"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
|
||||
@@ -392,7 +392,7 @@ feature -- Helper
|
||||
--| Based on header "Accept:" that can be for instance
|
||||
--| text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
||||
do
|
||||
if attached (create {SERVER_MEDIA_TYPE_NEGOTIATION}.make (a_content_type.as_string_8)).preference (<<a_content_type.as_string_8>>, http_accept) as l_variants then
|
||||
if attached (create {SERVER_MEDIA_TYPE_NEGOTIATION}.make (a_content_type.to_string_8)).preference (<<a_content_type.to_string_8>>, http_accept) as l_variants then
|
||||
Result := l_variants.is_acceptable
|
||||
end
|
||||
end
|
||||
@@ -503,6 +503,7 @@ feature -- Access: global variables
|
||||
local
|
||||
i: INTEGER
|
||||
n: INTEGER
|
||||
s: STRING_32
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
@@ -511,7 +512,11 @@ feature -- Access: global variables
|
||||
until
|
||||
i = 0
|
||||
loop
|
||||
if attached {WSF_STRING} a_item_fct.item ([a_name + "[" + i.out + "]"]) as v then
|
||||
create s.make_from_string_general (a_name)
|
||||
s.append_character ('[')
|
||||
s.append_integer (i)
|
||||
s.append_character (']')
|
||||
if attached {WSF_STRING} a_item_fct.item ([s]) as v then
|
||||
Result.force (v.value, n)
|
||||
n := n + 1
|
||||
i := i + 1
|
||||
@@ -1804,14 +1809,14 @@ feature -- URL Utility
|
||||
Result := s
|
||||
end
|
||||
|
||||
absolute_script_url (a_path: STRING): STRING
|
||||
absolute_script_url (a_path: READABLE_STRING_8): STRING
|
||||
-- Absolute Url for the script if any, extended by `a_path'
|
||||
do
|
||||
Result := script_url (a_path)
|
||||
Result.prepend (server_url)
|
||||
end
|
||||
|
||||
script_url (a_path: STRING): STRING
|
||||
script_url (a_path: READABLE_STRING_8): STRING
|
||||
-- Url relative to script name if any, extended by `a_path'
|
||||
local
|
||||
l_base_url: like internal_url_base
|
||||
@@ -1854,7 +1859,7 @@ feature -- URL Utility
|
||||
end
|
||||
end
|
||||
if l_base_url = Void then
|
||||
create l_base_url.make_empty
|
||||
create {STRING_8} l_base_url.make_empty
|
||||
end
|
||||
internal_url_base := l_base_url
|
||||
end
|
||||
@@ -1867,7 +1872,7 @@ feature {NONE} -- Implementation: URL Utility
|
||||
internal_server_url: detachable like server_url
|
||||
-- Server url
|
||||
|
||||
internal_url_base: detachable STRING
|
||||
internal_url_base: detachable READABLE_STRING_8
|
||||
-- URL base of potential script
|
||||
|
||||
internal_percent_encoded_path_info: detachable like percent_encoded_path_info
|
||||
@@ -1912,7 +1917,7 @@ feature {WSF_MIME_HANDLER} -- Temporary File handling
|
||||
end
|
||||
end
|
||||
|
||||
save_uploaded_file (a_up_file: WSF_UPLOADED_FILE; a_content: STRING)
|
||||
save_uploaded_file (a_up_file: WSF_UPLOADED_FILE; a_content: READABLE_STRING_8)
|
||||
-- Save uploaded file content `a_content' into `a_filename'.
|
||||
local
|
||||
dn: PATH
|
||||
|
||||
Reference in New Issue
Block a user