Files
EWF/library/server/wsf/extension/wsf_request_utility.e
Jocelyn Fiat 30a5e087ae 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)
2020-10-02 15:02:06 +02:00

113 lines
2.7 KiB
Plaintext

note
description: "Collection of utilities routines for WSF_REQUEST."
date: "$Date$"
revision: "$Revision$"
class
WSF_REQUEST_UTILITY
inherit
ANY
WSF_FORMAT_UTILITY
export
{NONE} all
end
WSF_VALUE_UTILITY
feature -- Url Query
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: READABLE_STRING_8): READABLE_STRING_8
-- Url relative to script name if any, extended by `a_path'
require
a_path_attached: a_path /= Void
do
Result := req.script_url (a_path)
end
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: detachable READABLE_STRING_8
t: detachable STRING_8
do
s := args
if s /= Void and then s.count > 0 then
create t.make_from_string (a_path)
if s[1] /= '/' and t[t.count] /= '/' then
t.append_character ('/')
t.append (s)
else
t.append (s)
end
s := t
else
s := a_path
end
if abs then
Result := script_absolute_url (req, s)
else
Result := script_url (req, s)
end
ensure
result_attached: Result /= Void
end
feature -- Query
request_accepted_content_type (req: WSF_REQUEST; a_supported_content_types: detachable ARRAY [READABLE_STRING_8]): detachable READABLE_STRING_8
-- Accepted content-type for the request, among the supported content types `a_supported_content_types'
local
s: detachable READABLE_STRING_8
i,n: INTEGER
do
if
attached accepted_content_types (req) as l_accept_lst and then
not l_accept_lst.is_empty
then
from
l_accept_lst.start
until
l_accept_lst.after or Result /= Void
loop
s := l_accept_lst.item
if a_supported_content_types /= Void then
from
i := a_supported_content_types.lower
n := a_supported_content_types.upper
until
i > n or Result /= Void
loop
if a_supported_content_types [i].same_string (s) then
Result := s
end
i := i + 1
end
else
Result := s
end
l_accept_lst.forth
end
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end