First try to get a limited WGI_ and use WSF_ as default framework
This commit is contained in:
@@ -80,23 +80,16 @@ feature -- Access: Input
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access: extra values
|
|
||||||
|
|
||||||
request_time: detachable DATE_TIME
|
|
||||||
-- Request time (UTC)
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access: CGI meta variables
|
feature -- Access: CGI meta variables
|
||||||
|
|
||||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable WGI_STRING_VALUE
|
meta_variable (a_name: READABLE_STRING_8): detachable READABLE_STRING_8
|
||||||
-- Environment variable related to `a_name'
|
-- Environment variable related to `a_name'
|
||||||
require
|
require
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
meta_string_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
meta_string_variable (a_name: READABLE_STRING_8): detachable READABLE_STRING_8
|
||||||
-- Environment variable related to `a_name'
|
-- Environment variable related to `a_name'
|
||||||
require
|
require
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||||
@@ -106,7 +99,7 @@ feature -- Access: CGI meta variables
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
meta_variables: ITERABLE [WGI_STRING_VALUE]
|
meta_variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
|
||||||
-- These variables are specific to requests made with HTTP.
|
-- These variables are specific to requests made with HTTP.
|
||||||
-- Interpretation of these variables may depend on the value of
|
-- Interpretation of these variables may depend on the value of
|
||||||
-- SERVER_PROTOCOL.
|
-- SERVER_PROTOCOL.
|
||||||
@@ -138,7 +131,7 @@ feature -- Access: CGI meta variables
|
|||||||
|
|
||||||
feature -- Common Gateway Interface - 1.1 8 January 1996
|
feature -- Common Gateway Interface - 1.1 8 January 1996
|
||||||
|
|
||||||
auth_type: detachable READABLE_STRING_32
|
auth_type: detachable READABLE_STRING_8
|
||||||
-- This variable is specific to requests made via the "http"
|
-- This variable is specific to requests made via the "http"
|
||||||
-- scheme.
|
-- scheme.
|
||||||
--
|
--
|
||||||
@@ -160,7 +153,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
content_length: detachable READABLE_STRING_32
|
content_length: detachable READABLE_STRING_8
|
||||||
-- This metavariable is set to the size of the message-body
|
-- This metavariable is set to the size of the message-body
|
||||||
-- entity attached to the request, if any, in decimal number of
|
-- entity attached to the request, if any, in decimal number of
|
||||||
-- octets. If no data are attached, then this metavariable is
|
-- octets. If no data are attached, then this metavariable is
|
||||||
@@ -180,7 +173,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
content_type: detachable READABLE_STRING_32
|
content_type: detachable READABLE_STRING_8
|
||||||
-- If the request includes a message-body, CONTENT_TYPE is set to
|
-- If the request includes a message-body, CONTENT_TYPE is set to
|
||||||
-- the Internet Media Type [9] of the attached entity if the type
|
-- the Internet Media Type [9] of the attached entity if the type
|
||||||
-- was provided via a "Content-type" field in the request header,
|
-- was provided via a "Content-type" field in the request header,
|
||||||
@@ -223,7 +216,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
gateway_interface: READABLE_STRING_32
|
gateway_interface: READABLE_STRING_8
|
||||||
-- This metavariable is set to the dialect of CGI being used by
|
-- This metavariable is set to the dialect of CGI being used by
|
||||||
-- the server to communicate with the script. Syntax:
|
-- the server to communicate with the script. Syntax:
|
||||||
--
|
--
|
||||||
@@ -256,7 +249,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
path_info: READABLE_STRING_32
|
path_info: READABLE_STRING_8
|
||||||
-- The PATH_INFO metavariable specifies a path to be interpreted
|
-- The PATH_INFO metavariable specifies a path to be interpreted
|
||||||
-- by the CGI script. It identifies the resource or sub-resource
|
-- by the CGI script. It identifies the resource or sub-resource
|
||||||
-- to be returned by the CGI script, and it is derived from the
|
-- to be returned by the CGI script, and it is derived from the
|
||||||
@@ -287,7 +280,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
path_translated: detachable READABLE_STRING_32
|
path_translated: detachable READABLE_STRING_8
|
||||||
-- PATH_TRANSLATED is derived by taking any path-info component
|
-- PATH_TRANSLATED is derived by taking any path-info component
|
||||||
-- of the request URI (see section 6.1.6), decoding it (see
|
-- of the request URI (see section 6.1.6), decoding it (see
|
||||||
-- section 3.1), parsing it as a URI in its own right, and
|
-- section 3.1), parsing it as a URI in its own right, and
|
||||||
@@ -333,7 +326,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
query_string: READABLE_STRING_32
|
query_string: READABLE_STRING_8
|
||||||
-- A URL-encoded string; the <query> part of the Script-URI. (See
|
-- A URL-encoded string; the <query> part of the Script-URI. (See
|
||||||
-- section 3.2.)
|
-- section 3.2.)
|
||||||
--
|
--
|
||||||
@@ -350,7 +343,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
remote_addr: READABLE_STRING_32
|
remote_addr: READABLE_STRING_8
|
||||||
-- The IP address of the client sending the request to the
|
-- The IP address of the client sending the request to the
|
||||||
-- server. This is not necessarily that of the user agent (such
|
-- server. This is not necessarily that of the user agent (such
|
||||||
-- as if the request came through a proxy).
|
-- as if the request came through a proxy).
|
||||||
@@ -365,7 +358,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
remote_host: detachable READABLE_STRING_32
|
remote_host: detachable READABLE_STRING_8
|
||||||
-- The fully qualified domain name of the client sending the
|
-- The fully qualified domain name of the client sending the
|
||||||
-- request to the server, if available, otherwise NULL. (See
|
-- request to the server, if available, otherwise NULL. (See
|
||||||
-- section 6.1.9.) Fully qualified domain names take the form as
|
-- section 6.1.9.) Fully qualified domain names take the form as
|
||||||
@@ -376,7 +369,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
remote_ident: detachable READABLE_STRING_32
|
remote_ident: detachable READABLE_STRING_8
|
||||||
-- The identity information reported about the connection by a
|
-- The identity information reported about the connection by a
|
||||||
-- RFC 1413 [11] request to the remote agent, if available.
|
-- RFC 1413 [11] request to the remote agent, if available.
|
||||||
-- Servers MAY choose not to support this feature, or not to
|
-- Servers MAY choose not to support this feature, or not to
|
||||||
@@ -392,7 +385,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
remote_user: detachable READABLE_STRING_32
|
remote_user: detachable READABLE_STRING_8
|
||||||
-- If the request required authentication using the "Basic"
|
-- If the request required authentication using the "Basic"
|
||||||
-- mechanism (i.e., the AUTH_TYPE metavariable is set to
|
-- mechanism (i.e., the AUTH_TYPE metavariable is set to
|
||||||
-- "Basic"), then the value of the REMOTE_USER metavariable is
|
-- "Basic"), then the value of the REMOTE_USER metavariable is
|
||||||
@@ -408,7 +401,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
request_method: READABLE_STRING_32
|
request_method: READABLE_STRING_8
|
||||||
-- The REQUEST_METHOD metavariable is set to the method with
|
-- The REQUEST_METHOD metavariable is set to the method with
|
||||||
-- which the request was made, as described in section 5.1.1 of
|
-- which the request was made, as described in section 5.1.1 of
|
||||||
-- the HTTP/1.0 specification [3] and section 5.1.1 of the
|
-- the HTTP/1.0 specification [3] and section 5.1.1 of the
|
||||||
@@ -429,7 +422,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
script_name: READABLE_STRING_32
|
script_name: READABLE_STRING_8
|
||||||
-- The SCRIPT_NAME metavariable is set to a URL path that could
|
-- The SCRIPT_NAME metavariable is set to a URL path that could
|
||||||
-- identify the CGI script (rather than the script's output). The
|
-- identify the CGI script (rather than the script's output). The
|
||||||
-- syntax and semantics are identical to a decoded HTTP URL
|
-- syntax and semantics are identical to a decoded HTTP URL
|
||||||
@@ -447,7 +440,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
server_name: READABLE_STRING_32
|
server_name: READABLE_STRING_8
|
||||||
-- The SERVER_NAME metavariable is set to the name of the server,
|
-- The SERVER_NAME metavariable is set to the name of the server,
|
||||||
-- as derived from the <host> part of the Script-URI (see section
|
-- as derived from the <host> part of the Script-URI (see section
|
||||||
-- 3.2).
|
-- 3.2).
|
||||||
@@ -473,7 +466,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
server_protocol: READABLE_STRING_32
|
server_protocol: READABLE_STRING_8
|
||||||
-- The SERVER_PROTOCOL metavariable is set to the name and
|
-- The SERVER_PROTOCOL metavariable is set to the name and
|
||||||
-- revision of the information protocol with which the request
|
-- revision of the information protocol with which the request
|
||||||
-- arrived. This is not necessarily the same as the protocol
|
-- arrived. This is not necessarily the same as the protocol
|
||||||
@@ -501,7 +494,7 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
server_software: READABLE_STRING_32
|
server_software: READABLE_STRING_8
|
||||||
-- The SERVER_SOFTWARE metavariable is set to the name and
|
-- The SERVER_SOFTWARE metavariable is set to the name and
|
||||||
-- version of the information server software answering the
|
-- version of the information server software answering the
|
||||||
-- request (and running the gateway).
|
-- request (and running the gateway).
|
||||||
@@ -516,42 +509,42 @@ feature -- Common Gateway Interface - 1.1 8 January 1996
|
|||||||
|
|
||||||
feature -- HTTP_*
|
feature -- HTTP_*
|
||||||
|
|
||||||
http_accept: detachable READABLE_STRING_32
|
http_accept: detachable READABLE_STRING_8
|
||||||
-- Contents of the Accept: header from the current request, if there is one.
|
-- Contents of the Accept: header from the current request, if there is one.
|
||||||
-- Example: 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
-- Example: 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_accept_charset: detachable READABLE_STRING_32
|
http_accept_charset: detachable READABLE_STRING_8
|
||||||
-- Contents of the Accept-Charset: header from the current request, if there is one.
|
-- Contents of the Accept-Charset: header from the current request, if there is one.
|
||||||
-- Example: 'iso-8859-1,*,utf-8'.
|
-- Example: 'iso-8859-1,*,utf-8'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_accept_encoding: detachable READABLE_STRING_32
|
http_accept_encoding: detachable READABLE_STRING_8
|
||||||
-- Contents of the Accept-Encoding: header from the current request, if there is one.
|
-- Contents of the Accept-Encoding: header from the current request, if there is one.
|
||||||
-- Example: 'gzip'.
|
-- Example: 'gzip'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_accept_language: detachable READABLE_STRING_32
|
http_accept_language: detachable READABLE_STRING_8
|
||||||
-- Contents of the Accept-Language: header from the current request, if there is one.
|
-- Contents of the Accept-Language: header from the current request, if there is one.
|
||||||
-- Example: 'en'.
|
-- Example: 'en'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_connection: detachable READABLE_STRING_32
|
http_connection: detachable READABLE_STRING_8
|
||||||
-- Contents of the Connection: header from the current request, if there is one.
|
-- Contents of the Connection: header from the current request, if there is one.
|
||||||
-- Example: 'Keep-Alive'.
|
-- Example: 'Keep-Alive'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_host: detachable READABLE_STRING_32
|
http_host: detachable READABLE_STRING_8
|
||||||
-- Contents of the Host: header from the current request, if there is one.
|
-- Contents of the Host: header from the current request, if there is one.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_referer: detachable READABLE_STRING_32
|
http_referer: detachable READABLE_STRING_8
|
||||||
-- The address of the page (if any) which referred the user agent to the current page.
|
-- The address of the page (if any) which referred the user agent to the current page.
|
||||||
-- This is set by the user agent.
|
-- This is set by the user agent.
|
||||||
-- Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature.
|
-- Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature.
|
||||||
@@ -559,7 +552,7 @@ feature -- HTTP_*
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_user_agent: detachable READABLE_STRING_32
|
http_user_agent: detachable READABLE_STRING_8
|
||||||
-- Contents of the User-Agent: header from the current request, if there is one.
|
-- Contents of the User-Agent: header from the current request, if there is one.
|
||||||
-- This is a string denoting the user agent being which is accessing the page.
|
-- This is a string denoting the user agent being which is accessing the page.
|
||||||
-- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).
|
-- A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).
|
||||||
@@ -568,127 +561,23 @@ feature -- HTTP_*
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
http_authorization: detachable READABLE_STRING_32
|
http_authorization: detachable READABLE_STRING_8
|
||||||
-- Contents of the Authorization: header from the current request, if there is one.
|
-- Contents of the Authorization: header from the current request, if there is one.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Extra CGI environment variables
|
feature -- Extra CGI environment variables
|
||||||
|
|
||||||
request_uri: READABLE_STRING_32
|
request_uri: READABLE_STRING_8
|
||||||
-- The URI which was given in order to access this page; for instance, '/index.html'.
|
-- The URI which was given in order to access this page; for instance, '/index.html'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
orig_path_info: detachable READABLE_STRING_32
|
orig_path_info: detachable READABLE_STRING_8
|
||||||
-- Original version of `path_info' before processed by Current environment
|
-- Original version of `path_info' before processed by Current environment
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Query string Parameters
|
|
||||||
|
|
||||||
query_parameters: ITERABLE [WGI_VALUE]
|
|
||||||
-- Variables extracted from QUERY_STRING
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
|
||||||
-- Parameter for name `n'.
|
|
||||||
require
|
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Form fields and related
|
|
||||||
|
|
||||||
form_data_parameters: ITERABLE [WGI_VALUE]
|
|
||||||
-- Variables sent by POST request
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
|
||||||
-- Field for name `a_name'.
|
|
||||||
require
|
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
uploaded_files: HASH_TABLE [WGI_UPLOADED_FILE_DATA, READABLE_STRING_GENERAL]
|
|
||||||
-- Table of uploaded files information
|
|
||||||
--| name: original path from the user
|
|
||||||
--| type: content type
|
|
||||||
--| tmp_name: path to temp file that resides on server
|
|
||||||
--| tmp_base_name: basename of `tmp_name'
|
|
||||||
--| error: if /= 0 , there was an error : TODO ...
|
|
||||||
--| size: size of the file given by the http request
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Cookies
|
|
||||||
|
|
||||||
cookies: ITERABLE [WGI_VALUE]
|
|
||||||
-- Expanded cookies variable
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
cookie (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
|
||||||
-- Field for name `a_name'.
|
|
||||||
require
|
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access: all variables
|
|
||||||
|
|
||||||
parameters: like items
|
|
||||||
obsolete "use items"
|
|
||||||
do
|
|
||||||
Result := items
|
|
||||||
end
|
|
||||||
|
|
||||||
parameter (a_name: READABLE_STRING_GENERAL): like item
|
|
||||||
obsolete "use item"
|
|
||||||
do
|
|
||||||
Result := item (a_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
items: ITERABLE [WGI_VALUE]
|
|
||||||
-- Table containing all the various variables
|
|
||||||
-- Warning: this is computed each time, if you change the content of other containers
|
|
||||||
-- this won't update this Result's content, unless you query it again
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
item (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
|
||||||
-- Variable named `a_name' from any of the variables container
|
|
||||||
-- and following a specific order
|
|
||||||
-- execution, environment, get, post, cookies
|
|
||||||
require
|
|
||||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Uploaded File Handling
|
|
||||||
|
|
||||||
is_uploaded_file (a_filename: READABLE_STRING_GENERAL): BOOLEAN
|
|
||||||
-- Is `a_filename' a file uploaded via HTTP POST
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- URL Utility
|
|
||||||
|
|
||||||
absolute_script_url (a_path: STRING): STRING
|
|
||||||
-- Absolute Url for the script if any, extended by `a_path'
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
script_url (a_path: STRING): STRING
|
|
||||||
-- Url relative to script name if any, extended by `a_path'
|
|
||||||
require
|
|
||||||
a_path_attached: a_path /= Void
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
invariant
|
invariant
|
||||||
server_name_not_empty: not server_name.is_empty
|
server_name_not_empty: not server_name.is_empty
|
||||||
server_port_set: server_port /= 0
|
server_port_set: server_port /= 0
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,12 +7,13 @@
|
|||||||
<exclude>/\.git$</exclude>
|
<exclude>/\.git$</exclude>
|
||||||
<exclude>/\.svn$</exclude>
|
<exclude>/\.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all"/>
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||||
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf"/>
|
<library name="wsf" location="..\..\wsf\wsf-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||||
<library name="router" location="..\..\request\router\router-safe.ecf" readonly="false"/>
|
<library name="router" location="..\..\request\router\router-safe.ecf" readonly="false"/>
|
||||||
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf"/>
|
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
|
||||||
<cluster name="contrib" location=".\src\contrib\" recursive="true">
|
<cluster name="contrib" location=".\src\contrib\" recursive="true">
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/html$</exclude>
|
<exclude>/html$</exclude>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</file_rule>
|
</file_rule>
|
||||||
<option warning="true" full_class_checking="true"/>
|
<option warning="true" full_class_checking="true"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi.ecf"/>
|
<library name="wsf" location="..\..\wsf\wsf.ecf"/>
|
||||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||||
<library name="router" location="..\..\request\router\router.ecf" readonly="false"/>
|
<library name="router" location="..\..\request\router\router.ecf" readonly="false"/>
|
||||||
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>
|
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
headers: EWF_HEADER
|
headers: WSF_HEADER
|
||||||
|
|
||||||
feature -- Recycle
|
feature -- Recycle
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ feature -- Output
|
|||||||
Result := o
|
Result := o
|
||||||
end
|
end
|
||||||
|
|
||||||
send (buf: WGI_RESPONSE_BUFFER)
|
send (buf: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
buf.set_status_code (200)
|
buf.set_status_code (200)
|
||||||
buf.write_headers_string (header_string)
|
buf.write_headers_string (header_string)
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ feature {NONE} -- Access: Implementation
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
rep: like new_html_page
|
rep: like new_html_page
|
||||||
s: STRING
|
s: STRING
|
||||||
@@ -50,7 +50,7 @@ feature -- Execution
|
|||||||
create s.make_empty
|
create s.make_empty
|
||||||
|
|
||||||
if
|
if
|
||||||
attached {WGI_STRING_VALUE} ctx.path_parameter ("resource") as l_resource_value and then
|
attached {WSF_STRING_VALUE} ctx.path_parameter ("resource") as l_resource_value and then
|
||||||
attached l_resource_value.string as l_resource
|
attached l_resource_value.string as l_resource
|
||||||
then
|
then
|
||||||
from
|
from
|
||||||
@@ -114,7 +114,7 @@ feature -- Execution
|
|||||||
rep.recycle
|
rep.recycle
|
||||||
end
|
end
|
||||||
|
|
||||||
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_dft_format: detachable STRING)
|
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; a_dft_format: detachable STRING)
|
||||||
local
|
local
|
||||||
l_dft_format_name: detachable STRING
|
l_dft_format_name: detachable STRING
|
||||||
s: STRING
|
s: STRING
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ feature -- Recycle
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
headers: EWF_HEADER
|
headers: WSF_HEADER
|
||||||
|
|
||||||
api: STRING
|
api: STRING
|
||||||
-- Associated api query string.
|
-- Associated api query string.
|
||||||
@@ -129,7 +129,7 @@ feature -- Output
|
|||||||
Result := o
|
Result := o
|
||||||
end
|
end
|
||||||
|
|
||||||
send (res: WGI_RESPONSE_BUFFER)
|
send (res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
compute
|
compute
|
||||||
res.set_status_code (200)
|
res.set_status_code (200)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ create
|
|||||||
|
|
||||||
feature -- status
|
feature -- status
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := internal_authentication_required
|
Result := internal_authentication_required
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ inherit
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
-- Is authentication required
|
-- Is authentication required
|
||||||
-- might depend on the request environment
|
-- might depend on the request environment
|
||||||
-- or the associated resources
|
-- or the associated resources
|
||||||
@@ -35,7 +35,7 @@ feature -- Element change
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
local
|
local
|
||||||
rescued: BOOLEAN
|
rescued: BOOLEAN
|
||||||
@@ -60,24 +60,24 @@ feature -- Execution
|
|||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
pre_execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
pre_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|
||||||
post_execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
post_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
rescue_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
post_execute (ctx, req, res)
|
post_execute (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_unauthorized (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_unauthorized (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
||||||
res.write_header ({HTTP_STATUS_CODE}.unauthorized, Void)
|
res.write_header ({HTTP_STATUS_CODE}.unauthorized, Void)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ create
|
|||||||
|
|
||||||
feature -- Mapping
|
feature -- Mapping
|
||||||
|
|
||||||
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
|
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||||
local
|
local
|
||||||
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
|
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ create
|
|||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := internal_authentication_required
|
Result := internal_authentication_required
|
||||||
end
|
end
|
||||||
@@ -36,12 +36,12 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
Precursor {REQUEST_URI_ROUTING_HANDLER_I} (ctx, req, res)
|
Precursor {REQUEST_URI_ROUTING_HANDLER_I} (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
check should_not_occur: False end
|
check should_not_occur: False end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ create
|
|||||||
|
|
||||||
feature -- Mapping
|
feature -- Mapping
|
||||||
|
|
||||||
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
|
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||||
local
|
local
|
||||||
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ create
|
|||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := internal_authentication_required
|
Result := internal_authentication_required
|
||||||
end
|
end
|
||||||
@@ -36,14 +36,14 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
pre_execute (ctx, req, res)
|
pre_execute (ctx, req, res)
|
||||||
Precursor {REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
|
Precursor {REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
|
||||||
post_execute (ctx, req, res)
|
post_execute (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
check should_not_occur: False end
|
check should_not_occur: False end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<setting name="concurrency" value="thread"/>
|
<setting name="concurrency" value="thread"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="rest" location="..\rest-safe.ecf" readonly="false"/>
|
<library name="rest" location="..\rest-safe.ecf" readonly="false"/>
|
||||||
<library name="ewsgi" location="..\..\..\ewsgi\ewsgi-safe.ecf" readonly="false"/>
|
<library name="wsf" location="..\..\..\wsf\wsf-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf" readonly="false"/>
|
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf" readonly="false"/>
|
||||||
</target>
|
</target>
|
||||||
<target name="sample_fcgi" extends="common">
|
<target name="sample_fcgi" extends="common">
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := True
|
Result := True
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute_unauthorized (a_hdl_context: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_unauthorized (a_hdl_context: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
lst: LIST [STRING]
|
lst: LIST [STRING]
|
||||||
@@ -52,16 +52,16 @@ feature -- Execution
|
|||||||
res.write_string ("Unauthorized")
|
res.write_string ("Unauthorized")
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
l_full: BOOLEAN
|
l_full: BOOLEAN
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
l_login: STRING_8
|
l_login: STRING_8
|
||||||
s: STRING
|
s: STRING
|
||||||
content_type_supported: ARRAY [STRING]
|
content_type_supported: ARRAY [STRING]
|
||||||
l_format_id: INTEGER
|
l_format_id: INTEGER
|
||||||
do
|
do
|
||||||
content_type_supported := <<{HTTP_CONSTANTS}.json_app, {HTTP_CONSTANTS}.xml_text, {HTTP_CONSTANTS}.plain_text>>
|
content_type_supported := <<{HTTP_CONSTANTS}.application_json, {HTTP_CONSTANTS}.text_xml, {HTTP_CONSTANTS}.text_plain>>
|
||||||
l_format_id := ctx.request_format_id ("format", content_type_supported)
|
l_format_id := ctx.request_format_id ("format", content_type_supported)
|
||||||
if authenticated (ctx) then
|
if authenticated (ctx) then
|
||||||
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
|
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
|
||||||
|
|||||||
@@ -32,17 +32,17 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
authentication_required (req: WGI_REQUEST): BOOLEAN
|
authentication_required (req: WSF_REQUEST): BOOLEAN
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
h.put_content_type_text_plain
|
h.put_content_type_text_plain
|
||||||
|
|||||||
@@ -68,17 +68,17 @@ feature {NONE} -- Handlers
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
request_count := request_count + 1
|
request_count := request_count + 1
|
||||||
Precursor (req, res)
|
Precursor (req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
rqst_uri: detachable STRING
|
rqst_uri: detachable STRING
|
||||||
l_path_info: detachable STRING
|
l_path_info: detachable STRING
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
s: STRING
|
s: STRING
|
||||||
l_redir_url: STRING
|
l_redir_url: STRING
|
||||||
do
|
do
|
||||||
@@ -96,6 +96,8 @@ feature -- Execution
|
|||||||
res.write_string (s)
|
res.write_string (s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
request_count: INTEGER
|
||||||
|
|
||||||
-- execute_rescue (ctx: like new_request_context)
|
-- execute_rescue (ctx: like new_request_context)
|
||||||
-- -- Execute the default rescue behavior
|
-- -- Execute the default rescue behavior
|
||||||
-- do
|
-- do
|
||||||
@@ -106,7 +108,7 @@ feature -- Implementation
|
|||||||
|
|
||||||
-- execute_exception_trace (ctx: like new_request_context)
|
-- execute_exception_trace (ctx: like new_request_context)
|
||||||
-- local
|
-- local
|
||||||
-- h: EWF_HEADER
|
-- h: WSF_HEADER
|
||||||
-- s: STRING
|
-- s: STRING
|
||||||
-- do
|
-- do
|
||||||
-- create h.make
|
-- create h.make
|
||||||
@@ -121,7 +123,7 @@ feature -- Implementation
|
|||||||
-- exit_with_code (-1)
|
-- exit_with_code (-1)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
execute_exit_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_exit_application (ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ deferred class
|
|||||||
REST_APPLICATION_GATEWAY
|
REST_APPLICATION_GATEWAY
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WGI_APPLICATION
|
WSF_APPLICATION
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ deferred class
|
|||||||
REST_APPLICATION_GATEWAY
|
REST_APPLICATION_GATEWAY
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WGI_APPLICATION
|
WSF_APPLICATION
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ deferred class
|
|||||||
REST_APPLICATION_GATEWAY
|
REST_APPLICATION_GATEWAY
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WGI_APPLICATION
|
WSF_APPLICATION
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
wgi_value_iteration_to_string (v: ITERABLE [WGI_VALUE]; using_pre: BOOLEAN): STRING_8
|
wgi_value_iteration_to_string (v: ITERABLE [WSF_VALUE]; using_pre: BOOLEAN): STRING_8
|
||||||
do
|
do
|
||||||
create Result.make (100)
|
create Result.make (100)
|
||||||
if using_pre then
|
if using_pre then
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ deferred class
|
|||||||
|
|
||||||
feature -- Helpers
|
feature -- Helpers
|
||||||
|
|
||||||
send_error (a_path: STRING; a_error_id: INTEGER; a_error_name: STRING; a_error_message: detachable STRING; ctx: APP_REQUEST_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
send_error (a_path: STRING; a_error_id: INTEGER; a_error_name: STRING; a_error_message: detachable STRING; ctx: APP_REQUEST_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
i,nb: INTEGER
|
i,nb: INTEGER
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
||||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf" readonly="false"/>
|
<library name="wsf" location="..\..\wsf\wsf-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||||
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
|
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
|
||||||
<cluster name="src" location="src\" recursive="true"/>
|
<cluster name="src" location="src\" recursive="true"/>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
||||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi_spec-safe.ecf" readonly="false"/>
|
<library name="wsf" location="..\..\wsf\wsf_spec-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||||
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
|
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template-safe.ecf" readonly="false"/>
|
||||||
<cluster name="src" location="src\" recursive="true"/>
|
<cluster name="src" location="src\" recursive="true"/>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
||||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi.ecf"/>
|
<library name="wsf" location="..\..\wsf\wsf.ecf"/>
|
||||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||||
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>
|
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>
|
||||||
<cluster name="src" location="src\" recursive="true"/>
|
<cluster name="src" location="src\" recursive="true"/>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
||||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi.ecf"/>
|
<library name="wsf" location="..\..\wsf\wsf.ecf"/>
|
||||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||||
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>
|
<library name="uri_template" location="..\..\..\protocol\uri_template\uri_template.ecf"/>
|
||||||
<cluster name="src" location="src\" recursive="true"/>
|
<cluster name="src" location="src\" recursive="true"/>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
accepted_content_types (req: WGI_REQUEST): detachable ARRAYED_LIST [READABLE_STRING_8]
|
accepted_content_types (req: WSF_REQUEST): detachable ARRAYED_LIST [READABLE_STRING_8]
|
||||||
local
|
local
|
||||||
s: STRING_8
|
s: STRING_8
|
||||||
q: READABLE_STRING_8
|
q: READABLE_STRING_8
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class
|
|||||||
|
|
||||||
feature -- Execute template
|
feature -- Execute template
|
||||||
|
|
||||||
execute_methods (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_methods (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request and dispatch according to the request method
|
-- Execute request and dispatch according to the request method
|
||||||
local
|
local
|
||||||
m: READABLE_STRING_8
|
m: READABLE_STRING_8
|
||||||
@@ -41,7 +41,7 @@ feature -- Execute template
|
|||||||
|
|
||||||
feature -- Method Post
|
feature -- Method Post
|
||||||
|
|
||||||
execute_post (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
if req.content_length_value > 0 then
|
if req.content_length_value > 0 then
|
||||||
do_post (ctx, req, res)
|
do_post (ctx, req, res)
|
||||||
@@ -50,14 +50,14 @@ feature -- Method Post
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do_post (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method POST not implemented", ctx, req, res)
|
handle_not_implemented ("Method POST not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature-- Method Put
|
feature-- Method Put
|
||||||
|
|
||||||
execute_put (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
if req.content_length_value > 0 then
|
if req.content_length_value > 0 then
|
||||||
do_put (ctx, req, res)
|
do_put (ctx, req, res)
|
||||||
@@ -66,91 +66,91 @@ feature-- Method Put
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do_put (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method PUT not implemented", ctx, req, res)
|
handle_not_implemented ("Method PUT not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method Get
|
feature -- Method Get
|
||||||
|
|
||||||
execute_get (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_get (ctx, req, res)
|
do_get (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_get (ctx: C;req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_get (ctx: C;req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method HEAD not implemented", ctx, req, res)
|
handle_not_implemented ("Method HEAD not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method DELETE
|
feature -- Method DELETE
|
||||||
|
|
||||||
execute_delete (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_delete (ctx, req, res)
|
do_delete (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_delete (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method DELETE not implemented", ctx, req, res)
|
handle_not_implemented ("Method DELETE not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method CONNECT
|
feature -- Method CONNECT
|
||||||
|
|
||||||
execute_connect (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_connect (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_connect (ctx, req, res)
|
do_connect (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_connect (ctx: C;req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_connect (ctx: C;req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method CONNECT not implemented", ctx, req, res)
|
handle_not_implemented ("Method CONNECT not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method HEAD
|
feature -- Method HEAD
|
||||||
|
|
||||||
execute_head (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_head (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_head (ctx, req, res)
|
do_head (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_head (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_head (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method HEAD not implemented", ctx, req, res)
|
handle_not_implemented ("Method HEAD not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method OPTIONS
|
feature -- Method OPTIONS
|
||||||
|
|
||||||
execute_options (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_options (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_options (ctx, req, res)
|
do_options (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_options (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_options (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method OPTIONS not implemented", ctx, req, res)
|
handle_not_implemented ("Method OPTIONS not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method TRACE
|
feature -- Method TRACE
|
||||||
|
|
||||||
execute_trace (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_trace (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_trace (ctx, req, res)
|
do_trace (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_trace (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_trace (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method TRACE not implemented", ctx, req, res)
|
handle_not_implemented ("Method TRACE not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Method Extension Method
|
feature -- Method Extension Method
|
||||||
|
|
||||||
execute_extension_method (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_extension_method (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
do_extension_method (ctx, req, res)
|
do_extension_method (ctx, req, res)
|
||||||
end
|
end
|
||||||
|
|
||||||
do_extension_method (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
do_extension_method (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
handle_not_implemented ("Method extension-method not implemented", ctx, req, res)
|
handle_not_implemented ("Method extension-method not implemented", ctx, req, res)
|
||||||
end
|
end
|
||||||
@@ -164,9 +164,9 @@ feature -- Handle responses
|
|||||||
Result := Void
|
Result := Void
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_bad_request_response (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER )
|
handle_bad_request_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
|
||||||
local
|
local
|
||||||
h : EWF_HEADER
|
h : WSF_HEADER
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
h.put_status ({HTTP_STATUS_CODE}.bad_request)
|
h.put_status ({HTTP_STATUS_CODE}.bad_request)
|
||||||
@@ -182,9 +182,9 @@ feature -- Handle responses
|
|||||||
res.write_string (a_description)
|
res.write_string (a_description)
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_internal_server_error (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER )
|
handle_internal_server_error (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
|
||||||
local
|
local
|
||||||
h : EWF_HEADER
|
h : WSF_HEADER
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
h.put_status ({HTTP_STATUS_CODE}.internal_server_error)
|
h.put_status ({HTTP_STATUS_CODE}.internal_server_error)
|
||||||
@@ -202,9 +202,9 @@ feature -- Handle responses
|
|||||||
res.write_string (a_description)
|
res.write_string (a_description)
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_not_implemented (a_description: STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER )
|
handle_not_implemented (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
|
||||||
local
|
local
|
||||||
h : EWF_HEADER
|
h : WSF_HEADER
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
h.put_status ({HTTP_STATUS_CODE}.not_implemented)
|
h.put_status ({HTTP_STATUS_CODE}.not_implemented)
|
||||||
@@ -220,9 +220,9 @@ feature -- Handle responses
|
|||||||
res.write_string (a_description)
|
res.write_string (a_description)
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_resource_not_found_response (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
handle_resource_not_found_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
h : EWF_HEADER
|
h : WSF_HEADER
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
h.put_status ({HTTP_STATUS_CODE}.not_found)
|
h.put_status ({HTTP_STATUS_CODE}.not_found)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ inherit
|
|||||||
|
|
||||||
feature -- Helper
|
feature -- Helper
|
||||||
|
|
||||||
execute_content_type_not_allowed (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_content_types: detachable ARRAY [STRING]; a_uri_formats: detachable ARRAY [STRING])
|
execute_content_type_not_allowed (req: WSF_REQUEST; res: WSF_RESPONSE; a_content_types: detachable ARRAY [STRING]; a_uri_formats: detachable ARRAY [STRING])
|
||||||
local
|
local
|
||||||
accept_s, uri_s: detachable STRING
|
accept_s, uri_s: detachable STRING
|
||||||
i, n: INTEGER
|
i, n: INTEGER
|
||||||
@@ -62,7 +62,7 @@ feature -- Helper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_request_method_not_allowed (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_methods: ITERABLE [STRING])
|
execute_request_method_not_allowed (req: WSF_REQUEST; res: WSF_RESPONSE; a_methods: ITERABLE [STRING])
|
||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ feature -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
action: PROCEDURE [ANY, TUPLE [ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]
|
action: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
action.call ([ctx, req, res])
|
action.call ([ctx, req, res])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ feature -- Element change
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
local
|
local
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
s: STRING
|
s: STRING
|
||||||
uri: STRING
|
uri: STRING
|
||||||
do
|
do
|
||||||
@@ -68,7 +68,7 @@ feature -- Execution
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
process_uri (uri: READABLE_STRING_8; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
process_uri (uri: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
fn: READABLE_STRING_8
|
fn: READABLE_STRING_8
|
||||||
@@ -90,9 +90,9 @@ feature -- Execution
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_index (a_uri: READABLE_STRING_8; dn: READABLE_STRING_8; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
respond_index (a_uri: READABLE_STRING_8; dn: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
uri, s: STRING_8
|
uri, s: STRING_8
|
||||||
d: DIRECTORY
|
d: DIRECTORY
|
||||||
l_files: LIST [STRING_8]
|
l_files: LIST [STRING_8]
|
||||||
@@ -145,10 +145,10 @@ feature -- Execution
|
|||||||
d.close
|
d.close
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_file (f: FILE; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
respond_file (f: FILE; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
fn: READABLE_STRING_8
|
fn: READABLE_STRING_8
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
ext: READABLE_STRING_8
|
ext: READABLE_STRING_8
|
||||||
ct: detachable READABLE_STRING_8
|
ct: detachable READABLE_STRING_8
|
||||||
do
|
do
|
||||||
@@ -175,9 +175,9 @@ feature -- Execution
|
|||||||
res.flush
|
res.flush
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_not_found (uri: READABLE_STRING_8; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
respond_not_found (uri: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
s: STRING_8
|
s: STRING_8
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
@@ -191,9 +191,9 @@ feature -- Execution
|
|||||||
res.flush
|
res.flush
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_access_denied (uri: READABLE_STRING_8; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
respond_access_denied (uri: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
h: EWF_HEADER
|
h: WSF_HEADER
|
||||||
s: STRING_8
|
s: STRING_8
|
||||||
do
|
do
|
||||||
create h.make
|
create h.make
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ inherit
|
|||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
is_valid_context (req: WGI_REQUEST): BOOLEAN
|
is_valid_context (req: WSF_REQUEST): BOOLEAN
|
||||||
-- Is `req' valid context for current handler?
|
-- Is `req' valid context for current handler?
|
||||||
do
|
do
|
||||||
Result := True
|
Result := True
|
||||||
@@ -25,7 +25,7 @@ feature -- Status report
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
require
|
require
|
||||||
is_valid_context: is_valid_context (req)
|
is_valid_context: is_valid_context (req)
|
||||||
@@ -34,7 +34,7 @@ feature -- Execution
|
|||||||
|
|
||||||
feature -- Execution: report
|
feature -- Execution: report
|
||||||
|
|
||||||
url (req: WGI_REQUEST; a_base: detachable READABLE_STRING_8; args: detachable STRING; abs: BOOLEAN): STRING
|
url (req: WSF_REQUEST; a_base: detachable READABLE_STRING_8; args: detachable STRING; abs: BOOLEAN): STRING
|
||||||
-- Associated url based on `a_base' and `args'
|
-- Associated url based on `a_base' and `args'
|
||||||
-- if `abs' then return absolute url
|
-- if `abs' then return absolute url
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ inherit
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
request: WGI_REQUEST
|
request: WSF_REQUEST
|
||||||
-- Associated request
|
-- Associated request
|
||||||
|
|
||||||
path: READABLE_STRING_8
|
path: READABLE_STRING_8
|
||||||
@@ -71,12 +71,11 @@ feature -- Query
|
|||||||
|
|
||||||
request_content_type (content_type_supported: detachable ARRAY [READABLE_STRING_8]): detachable READABLE_STRING_8
|
request_content_type (content_type_supported: detachable ARRAY [READABLE_STRING_8]): detachable READABLE_STRING_8
|
||||||
local
|
local
|
||||||
s: detachable READABLE_STRING_32
|
s: detachable READABLE_STRING_8
|
||||||
i,n: INTEGER
|
i,n: INTEGER
|
||||||
do
|
do
|
||||||
s := request.content_type
|
if attached request.content_type as ct then
|
||||||
if s /= Void then
|
Result := ct
|
||||||
Result := s
|
|
||||||
else
|
else
|
||||||
if attached accepted_content_types (request) as l_accept_lst then
|
if attached accepted_content_types (request) as l_accept_lst then
|
||||||
from
|
from
|
||||||
@@ -108,18 +107,18 @@ feature -- Query
|
|||||||
|
|
||||||
feature -- Query
|
feature -- Query
|
||||||
|
|
||||||
path_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
path_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
-- Parameter value for path variable `a_name'
|
-- Parameter value for path variable `a_name'
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
-- Parameter value for query variable `a_name'
|
-- Parameter value for query variable `a_name'
|
||||||
--| i.e after the ? character
|
--| i.e after the ? character
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
-- Any parameter value for variable `a_name'
|
-- Any parameter value for variable `a_name'
|
||||||
-- URI template parameter and query parameters
|
-- URI template parameter and query parameters
|
||||||
do
|
do
|
||||||
@@ -131,9 +130,9 @@ feature -- Query
|
|||||||
|
|
||||||
feature -- String query
|
feature -- String query
|
||||||
|
|
||||||
string_from (a_value: detachable WGI_VALUE): detachable READABLE_STRING_32
|
string_from (a_value: detachable WSF_VALUE): detachable READABLE_STRING_32
|
||||||
do
|
do
|
||||||
if attached {WGI_STRING_VALUE} a_value as val then
|
if attached {WSF_STRING_VALUE} a_value as val then
|
||||||
Result := val.string
|
Result := val.string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ feature -- Mapping
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
map_agent (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]])
|
map_agent (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]])
|
||||||
do
|
do
|
||||||
map_agent_with_request_methods (a_resource, a_action, Void)
|
map_agent_with_request_methods (a_resource, a_action, Void)
|
||||||
end
|
end
|
||||||
|
|
||||||
map_agent_with_request_methods (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
|
map_agent_with_request_methods (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||||
local
|
local
|
||||||
rah: REQUEST_AGENT_HANDLER [C]
|
rah: REQUEST_AGENT_HANDLER [C]
|
||||||
@@ -65,14 +65,14 @@ feature -- Base url
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
dispatch (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER): BOOLEAN
|
dispatch (req: WSF_REQUEST; res: WSF_RESPONSE): BOOLEAN
|
||||||
-- Dispatch `req, res' to the associated handler
|
-- Dispatch `req, res' to the associated handler
|
||||||
-- And return True is handled, otherwise False
|
-- And return True is handled, otherwise False
|
||||||
do
|
do
|
||||||
Result := dispatch_and_return_handler (req, res) /= Void
|
Result := dispatch_and_return_handler (req, res) /= Void
|
||||||
end
|
end
|
||||||
|
|
||||||
dispatch_and_return_handler (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER): detachable H
|
dispatch_and_return_handler (req: WSF_REQUEST; res: WSF_RESPONSE): detachable H
|
||||||
-- Dispatch `req, res' to the associated handler
|
-- Dispatch `req, res' to the associated handler
|
||||||
-- And return this handler
|
-- And return this handler
|
||||||
-- If Result is Void, this means no handler was found.
|
-- If Result is Void, this means no handler was found.
|
||||||
@@ -108,13 +108,13 @@ feature -- Traversing
|
|||||||
|
|
||||||
feature {NONE} -- Access: Implementation
|
feature {NONE} -- Access: Implementation
|
||||||
|
|
||||||
source_uri (req: WGI_REQUEST): READABLE_STRING_32
|
source_uri (req: WSF_REQUEST): READABLE_STRING_32
|
||||||
-- URI to use to find handler.
|
-- URI to use to find handler.
|
||||||
do
|
do
|
||||||
Result := req.path_info
|
Result := req.path_info
|
||||||
end
|
end
|
||||||
|
|
||||||
handler (req: WGI_REQUEST): detachable TUPLE [handler: H; context: like default_handler_context]
|
handler (req: WSF_REQUEST): detachable TUPLE [handler: H; context: like default_handler_context]
|
||||||
-- Handler whose map matched with `req'
|
-- Handler whose map matched with `req'
|
||||||
require
|
require
|
||||||
req_valid: source_uri (req) /= Void
|
req_valid: source_uri (req) /= Void
|
||||||
@@ -179,7 +179,7 @@ feature {NONE} -- Implementation
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
default_handler_context (req: WGI_REQUEST): C
|
default_handler_context (req: WSF_REQUEST): C
|
||||||
-- Default handler context associated with `default_handler'
|
-- Default handler context associated with `default_handler'
|
||||||
require
|
require
|
||||||
has_default_handler: default_handler /= Void
|
has_default_handler: default_handler /= Void
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ inherit
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
local
|
local
|
||||||
hdl: detachable H
|
hdl: detachable H
|
||||||
@@ -49,12 +49,12 @@ feature -- Mapping
|
|||||||
router.map_with_request_methods (a_resource, h, rqst_methods)
|
router.map_with_request_methods (a_resource, h, rqst_methods)
|
||||||
end
|
end
|
||||||
|
|
||||||
map_agent (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]])
|
map_agent (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]])
|
||||||
do
|
do
|
||||||
router.map_agent (a_resource, a_action)
|
router.map_agent (a_resource, a_action)
|
||||||
end
|
end
|
||||||
|
|
||||||
map_agent_with_request_methods (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
|
map_agent_with_request_methods (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||||
do
|
do
|
||||||
router.map_agent_with_request_methods (a_resource, a_action, rqst_methods)
|
router.map_agent_with_request_methods (a_resource, a_action, rqst_methods)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ feature -- Setup
|
|||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
l_handled: BOOLEAN
|
l_handled: BOOLEAN
|
||||||
rescued: BOOLEAN
|
rescued: BOOLEAN
|
||||||
@@ -50,11 +50,11 @@ feature -- Execution
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_rescue (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
execute_rescue (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
do
|
do
|
||||||
if not res.header_committed then
|
if not res.header_committed then
|
||||||
res.write_header ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
res.write_header ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ create
|
|||||||
|
|
||||||
feature -- Mapping
|
feature -- Mapping
|
||||||
|
|
||||||
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
|
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||||
local
|
local
|
||||||
h: REQUEST_AGENT_HANDLER [REQUEST_URI_HANDLER_CONTEXT]
|
h: REQUEST_AGENT_HANDLER [REQUEST_URI_HANDLER_CONTEXT]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (req: WGI_REQUEST; p: like path)
|
make (req: WSF_REQUEST; p: like path)
|
||||||
do
|
do
|
||||||
request := req
|
request := req
|
||||||
path := p
|
path := p
|
||||||
@@ -23,11 +23,11 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Query
|
feature -- Query
|
||||||
|
|
||||||
path_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
path_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|
||||||
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
do
|
do
|
||||||
Result := request.query_parameter (a_name)
|
Result := request.query_parameter (a_name)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ feature -- Registration
|
|||||||
|
|
||||||
feature {NONE} -- Access: Implementation
|
feature {NONE} -- Access: Implementation
|
||||||
|
|
||||||
handler (req: WGI_REQUEST): detachable TUPLE [handler: H; context: like default_handler_context]
|
handler (req: WSF_REQUEST): detachable TUPLE [handler: H; context: like default_handler_context]
|
||||||
local
|
local
|
||||||
h: detachable H
|
h: detachable H
|
||||||
ctx: detachable like default_handler_context
|
ctx: detachable like default_handler_context
|
||||||
@@ -62,7 +62,7 @@ feature {NONE} -- Access: Implementation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
smart_handler (req: WGI_REQUEST): detachable TUPLE [path: READABLE_STRING_8; handler: H]
|
smart_handler (req: WSF_REQUEST): detachable TUPLE [path: READABLE_STRING_8; handler: H]
|
||||||
require
|
require
|
||||||
req_valid: req /= Void and then source_uri (req) /= Void
|
req_valid: req /= Void and then source_uri (req) /= Void
|
||||||
do
|
do
|
||||||
@@ -124,7 +124,7 @@ feature {NONE} -- Access: Implementation
|
|||||||
|
|
||||||
feature {NONE} -- Context factory
|
feature {NONE} -- Context factory
|
||||||
|
|
||||||
handler_context (p: detachable STRING; req: WGI_REQUEST): C
|
handler_context (p: detachable STRING; req: WSF_REQUEST): C
|
||||||
local
|
local
|
||||||
ctx: C
|
ctx: C
|
||||||
do
|
do
|
||||||
@@ -184,7 +184,7 @@ feature {NONE} -- Default: implementation
|
|||||||
default_handler := h
|
default_handler := h
|
||||||
end
|
end
|
||||||
|
|
||||||
default_handler_context (req: WGI_REQUEST): C
|
default_handler_context (req: WSF_REQUEST): C
|
||||||
do
|
do
|
||||||
Result := handler_context (Void, req)
|
Result := handler_context (Void, req)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ create
|
|||||||
|
|
||||||
feature -- Mapping
|
feature -- Mapping
|
||||||
|
|
||||||
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]];
|
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
|
||||||
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
rqst_methods: detachable ARRAY [READABLE_STRING_8])
|
||||||
local
|
local
|
||||||
h: REQUEST_AGENT_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
h: REQUEST_AGENT_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (req: WGI_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT; p: like path)
|
make (req: WSF_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT; p: like path)
|
||||||
do
|
do
|
||||||
request := req
|
request := req
|
||||||
uri_template := tpl
|
uri_template := tpl
|
||||||
@@ -31,17 +31,17 @@ feature -- Access
|
|||||||
|
|
||||||
feature -- Query
|
feature -- Query
|
||||||
|
|
||||||
path_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
path_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
do
|
do
|
||||||
if attached uri_template_match.url_decoded_path_variable (a_name) as s then
|
if attached uri_template_match.url_decoded_path_variable (a_name) as s then
|
||||||
create {WGI_STRING_VALUE} Result.make (a_name, s)
|
create {WSF_STRING_VALUE} Result.make (a_name, s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
do
|
do
|
||||||
if attached uri_template_match.url_decoded_query_variable (a_name) as s then
|
if attached uri_template_match.url_decoded_query_variable (a_name) as s then
|
||||||
create {WGI_STRING_VALUE} Result.make (a_name, s)
|
create {WSF_STRING_VALUE} Result.make (a_name, s)
|
||||||
else
|
else
|
||||||
Result := request.query_parameter (a_name)
|
Result := request.query_parameter (a_name)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ feature -- Registration
|
|||||||
|
|
||||||
feature {NONE} -- Access: Implementation
|
feature {NONE} -- Access: Implementation
|
||||||
|
|
||||||
handler (req: WGI_REQUEST): detachable TUPLE [handler: attached like default_handler; context: like default_handler_context]
|
handler (req: WSF_REQUEST): detachable TUPLE [handler: attached like default_handler; context: like default_handler_context]
|
||||||
local
|
local
|
||||||
l_handlers: like handlers
|
l_handlers: like handlers
|
||||||
t: STRING
|
t: STRING
|
||||||
@@ -94,7 +94,7 @@ feature {NONE} -- Access: Implementation
|
|||||||
|
|
||||||
feature {NONE} -- Context factory
|
feature {NONE} -- Context factory
|
||||||
|
|
||||||
handler_context (p: detachable STRING; req: WGI_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT): C
|
handler_context (p: detachable STRING; req: WSF_REQUEST; tpl: URI_TEMPLATE; tpl_res: URI_TEMPLATE_MATCH_RESULT): C
|
||||||
do
|
do
|
||||||
if p /= Void then
|
if p /= Void then
|
||||||
create Result.make (req, tpl, tpl_res, p)
|
create Result.make (req, tpl, tpl_res, p)
|
||||||
@@ -151,7 +151,7 @@ feature {NONE} -- Default: implementation
|
|||||||
default_handler := h
|
default_handler := h
|
||||||
end
|
end
|
||||||
|
|
||||||
default_handler_context (req: WGI_REQUEST): C
|
default_handler_context (req: WSF_REQUEST): C
|
||||||
do
|
do
|
||||||
Result := handler_context (Void, req, create {URI_TEMPLATE}.make ("/"), create {URI_TEMPLATE_MATCH_RESULT}.make_empty)
|
Result := handler_context (Void, req, create {URI_TEMPLATE}.make ("/"), create {URI_TEMPLATE_MATCH_RESULT}.make_empty)
|
||||||
end
|
end
|
||||||
|
|||||||
13
library/server/wsf/src/cgi_meta_names.e
Normal file
13
library/server/wsf/src/cgi_meta_names.e
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_META_NAMES}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CGI_META_NAMES
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WGI_META_NAMES
|
||||||
|
|
||||||
|
end
|
||||||
143
library/server/wsf/src/request/value/wsf_multiple_string_value.e
Normal file
143
library/server/wsf/src/request/value/wsf_multiple_string_value.e
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_MULTIPLE_STRING_VALUE}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_MULTIPLE_STRING_VALUE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_VALUE
|
||||||
|
|
||||||
|
ITERABLE [WSF_STRING_VALUE]
|
||||||
|
|
||||||
|
create
|
||||||
|
make_with_value,
|
||||||
|
make_with_array,
|
||||||
|
make_with_string
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make_with_value (a_value: WSF_VALUE)
|
||||||
|
do
|
||||||
|
name := a_value.name
|
||||||
|
create {LINKED_LIST [WSF_STRING_VALUE]} string_values.make
|
||||||
|
add_value (a_value)
|
||||||
|
end
|
||||||
|
|
||||||
|
make_with_array (arr: ARRAY [WSF_VALUE])
|
||||||
|
require
|
||||||
|
arr_not_empty: not arr.is_empty
|
||||||
|
all_same_name: across arr as c all c.item.name.same_string (arr[arr.lower].name) end
|
||||||
|
local
|
||||||
|
i,up: INTEGER
|
||||||
|
do
|
||||||
|
up := arr.upper
|
||||||
|
i := arr.lower
|
||||||
|
make_with_value (arr[i])
|
||||||
|
from
|
||||||
|
i := i + 1
|
||||||
|
until
|
||||||
|
i > up
|
||||||
|
loop
|
||||||
|
add_value (arr[i])
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
make_with_string (a_name: like name; a_string: READABLE_STRING_32)
|
||||||
|
do
|
||||||
|
make_with_value (create {WSF_STRING_VALUE}.make (a_name, a_string))
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
name: READABLE_STRING_32
|
||||||
|
|
||||||
|
string_values: LIST [WSF_STRING_VALUE]
|
||||||
|
|
||||||
|
first_string_value: WSF_STRING_VALUE
|
||||||
|
do
|
||||||
|
Result := string_values.first
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Traversing
|
||||||
|
|
||||||
|
new_cursor: ITERATION_CURSOR [WSF_STRING_VALUE]
|
||||||
|
do
|
||||||
|
Result := string_values.new_cursor
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Helper
|
||||||
|
|
||||||
|
same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
|
-- Does `a_other' represent the same string as `Current'?
|
||||||
|
do
|
||||||
|
if string_values.count = 1 then
|
||||||
|
Result := first_string_value.same_string (a_other)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN
|
||||||
|
-- Does `a_other' represent the same case insensitive string as `Current'?
|
||||||
|
do
|
||||||
|
if string_values.count = 1 then
|
||||||
|
Result := first_string_value.is_case_insensitive_equal (a_other)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
as_string: STRING_32
|
||||||
|
do
|
||||||
|
if string_values.count = 1 then
|
||||||
|
create Result.make_from_string (first_string_value)
|
||||||
|
else
|
||||||
|
create Result.make_from_string ("[")
|
||||||
|
across
|
||||||
|
string_values as c
|
||||||
|
loop
|
||||||
|
if Result.count > 1 then
|
||||||
|
Result.append_character (',')
|
||||||
|
end
|
||||||
|
Result.append_string (c.item)
|
||||||
|
end
|
||||||
|
Result.append_character (']')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
add_value (a_value: WSF_VALUE)
|
||||||
|
require
|
||||||
|
same_name: a_value.name.same_string (name)
|
||||||
|
do
|
||||||
|
if attached {WSF_STRING_VALUE} a_value as sval then
|
||||||
|
add_string_value (sval)
|
||||||
|
elseif attached {WSF_MULTIPLE_STRING_VALUE} a_value as slst then
|
||||||
|
across
|
||||||
|
slst as cur
|
||||||
|
loop
|
||||||
|
add_string_value (cur.item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add_string_value (s: WSF_STRING_VALUE)
|
||||||
|
do
|
||||||
|
string_values.extend (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
invariant
|
||||||
|
string_values_not_empty: string_values.count >= 1
|
||||||
|
|
||||||
|
;note
|
||||||
|
copyright: "2011-2011, 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
|
||||||
71
library/server/wsf/src/request/value/wsf_string_value.e
Normal file
71
library/server/wsf/src/request/value/wsf_string_value.e
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_STRING_VALUE}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_STRING_VALUE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_VALUE
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
convert
|
||||||
|
as_string: {READABLE_STRING_32, STRING_32}
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make (a_name: READABLE_STRING_GENERAL; a_string: like string)
|
||||||
|
do
|
||||||
|
name := a_name.as_string_32
|
||||||
|
string := a_string
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
name: READABLE_STRING_32
|
||||||
|
|
||||||
|
string: READABLE_STRING_32
|
||||||
|
|
||||||
|
feature -- Helper
|
||||||
|
|
||||||
|
same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
|
-- Does `a_other' represent the same string as `Current'?
|
||||||
|
do
|
||||||
|
Result := string.same_string_general (a_other)
|
||||||
|
end
|
||||||
|
|
||||||
|
is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN
|
||||||
|
-- Does `a_other' represent the same case insensitive string as `Current'?
|
||||||
|
local
|
||||||
|
v: like string
|
||||||
|
do
|
||||||
|
v := string
|
||||||
|
if v = a_other then
|
||||||
|
Result := True
|
||||||
|
elseif v.is_valid_as_string_8 then
|
||||||
|
Result := v.is_case_insensitive_equal (a_other)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
as_string: STRING_32
|
||||||
|
do
|
||||||
|
create Result.make_from_string (string)
|
||||||
|
end
|
||||||
|
|
||||||
|
;note
|
||||||
|
copyright: "2011-2011, 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
|
||||||
59
library/server/wsf/src/request/wsf_value.e
Normal file
59
library/server/wsf/src/request/wsf_value.e
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_VALUE}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
WSF_VALUE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
DEBUG_OUTPUT
|
||||||
|
|
||||||
|
convert
|
||||||
|
as_string: {READABLE_STRING_32, STRING_32}
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
name: READABLE_STRING_32
|
||||||
|
-- Parameter name
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Helper
|
||||||
|
|
||||||
|
same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
|
-- Does `a_other' represent the same string as `Current'?
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN
|
||||||
|
-- Does `a_other' represent the same case insensitive string as `Current'?
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
debug_output: STRING
|
||||||
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
|
do
|
||||||
|
create Result.make_from_string (name.as_string_8 + "=" + as_string.as_string_8)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Query
|
||||||
|
|
||||||
|
as_string: STRING_32
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2011, 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
|
||||||
66
library/server/wsf/src/support/wsf_error.e
Normal file
66
library/server/wsf/src/support/wsf_error.e
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_ERROR}."
|
||||||
|
legal: "See notice at end of class."
|
||||||
|
status: "See notice at end of class."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_ERROR
|
||||||
|
|
||||||
|
inherit
|
||||||
|
ERROR
|
||||||
|
|
||||||
|
HTTP_STATUS_CODE_MESSAGES
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make (a_code: INTEGER)
|
||||||
|
do
|
||||||
|
code := a_code
|
||||||
|
name := "HTTP Error"
|
||||||
|
if attached http_status_code_message (a_code) as m then
|
||||||
|
name := m
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
code: INTEGER
|
||||||
|
|
||||||
|
name: STRING
|
||||||
|
|
||||||
|
message: detachable STRING_32
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
set_message (m: like message)
|
||||||
|
-- Set `message' to `m'
|
||||||
|
require
|
||||||
|
m_attached: m /= Void
|
||||||
|
do
|
||||||
|
message := m
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Visitor
|
||||||
|
|
||||||
|
process (a_visitor: ERROR_VISITOR)
|
||||||
|
-- Process Current using `a_visitor'.
|
||||||
|
do
|
||||||
|
a_visitor.process_error (Current)
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2011, 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
|
||||||
454
library/server/wsf/src/support/wsf_header.e
Normal file
454
library/server/wsf/src/support/wsf_header.e
Normal file
@@ -0,0 +1,454 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
The class provides an easy way to build HTTP header.
|
||||||
|
|
||||||
|
You will also find some helper feature to help coding most common usage
|
||||||
|
|
||||||
|
Please, have a look at constants classes such as
|
||||||
|
HTTP_MIME_TYPES
|
||||||
|
HTTP_HEADER_NAMES
|
||||||
|
HTTP_STATUS_CODE
|
||||||
|
HTTP_REQUEST_METHODS
|
||||||
|
(or HTTP_CONSTANTS which groups them for convenience)
|
||||||
|
|
||||||
|
Note the return status code is not part of the HTTP header
|
||||||
|
However you can set the "Status: " header line if you want
|
||||||
|
]"
|
||||||
|
legal: "See notice at end of class."
|
||||||
|
status: "See notice at end of class."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_HEADER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
ANY
|
||||||
|
|
||||||
|
HTTP_STATUS_CODE_MESSAGES --| useful for `put_status'
|
||||||
|
export
|
||||||
|
{NONE} all
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
make,
|
||||||
|
make_with_count
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Initialize current
|
||||||
|
do
|
||||||
|
make_with_count (3)
|
||||||
|
end
|
||||||
|
|
||||||
|
make_with_count (n: INTEGER)
|
||||||
|
-- Make with a capacity of `n' header entries
|
||||||
|
do
|
||||||
|
create {ARRAYED_LIST [READABLE_STRING_8]} headers.make (n)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Recycle
|
||||||
|
|
||||||
|
recycle
|
||||||
|
-- Recycle current object
|
||||||
|
do
|
||||||
|
headers.wipe_out
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
headers: LIST [READABLE_STRING_8]
|
||||||
|
-- Header's lines
|
||||||
|
|
||||||
|
string: STRING
|
||||||
|
-- String representation of the headers
|
||||||
|
local
|
||||||
|
l_headers: like headers
|
||||||
|
do
|
||||||
|
create Result.make (32)
|
||||||
|
l_headers := headers
|
||||||
|
if l_headers.is_empty then
|
||||||
|
put_content_type_text_html -- See if this make sense to define a default content-type
|
||||||
|
else
|
||||||
|
from
|
||||||
|
l_headers.start
|
||||||
|
until
|
||||||
|
l_headers.after
|
||||||
|
loop
|
||||||
|
append_line_to (l_headers.item, Result)
|
||||||
|
l_headers.forth
|
||||||
|
end
|
||||||
|
end
|
||||||
|
append_end_of_line_to (Result)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Header change: general
|
||||||
|
|
||||||
|
add_header (h: READABLE_STRING_8)
|
||||||
|
-- Add header `h'
|
||||||
|
-- if it already exists, there will be multiple header with same name
|
||||||
|
-- which can also be valid
|
||||||
|
require
|
||||||
|
h_not_empty: not h.is_empty
|
||||||
|
do
|
||||||
|
headers.force (h)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_header (h: READABLE_STRING_8)
|
||||||
|
-- Add header `h' or replace existing header of same header name
|
||||||
|
require
|
||||||
|
h_not_empty: not h.is_empty
|
||||||
|
do
|
||||||
|
force_header_by_name (header_name (h), h)
|
||||||
|
end
|
||||||
|
|
||||||
|
add_header_key_value (k,v: READABLE_STRING_8)
|
||||||
|
-- Add header `k:v', or replace existing header of same header name/key
|
||||||
|
do
|
||||||
|
add_header (k + colon_space + v)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_header_key_value (k,v: READABLE_STRING_8)
|
||||||
|
-- Add header `k:v', or replace existing header of same header name/key
|
||||||
|
do
|
||||||
|
put_header (k + colon_space + v)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status related
|
||||||
|
|
||||||
|
put_status (c: INTEGER)
|
||||||
|
-- Put "Status: " header
|
||||||
|
-- Rarely used
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
create s.make_from_string (c.out)
|
||||||
|
if attached http_status_code_message (c) as msg then
|
||||||
|
s.append_character (' ')
|
||||||
|
s.append (msg)
|
||||||
|
end
|
||||||
|
put_header_key_value ("Status", s)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Content related header
|
||||||
|
|
||||||
|
put_content_type (t: READABLE_STRING_8)
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t)
|
||||||
|
end
|
||||||
|
|
||||||
|
add_content_type (t: READABLE_STRING_8)
|
||||||
|
-- same as `put_content_type', but allow multiple definition of "Content-Type"
|
||||||
|
do
|
||||||
|
add_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_content_type_with_name (t: READABLE_STRING_8; n: READABLE_STRING_8)
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t + "; name=%"" + n + "%"")
|
||||||
|
end
|
||||||
|
|
||||||
|
add_content_type_with_name (t: READABLE_STRING_8; n: READABLE_STRING_8)
|
||||||
|
-- same as `put_content_type_with_name', but allow multiple definition of "Content-Type"
|
||||||
|
do
|
||||||
|
add_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t + "; name=%"" + n + "%"")
|
||||||
|
end
|
||||||
|
|
||||||
|
put_content_length (n: INTEGER)
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_content_length, n.out)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_content_transfer_encoding (a_mechanism: READABLE_STRING_8)
|
||||||
|
-- Put "Content-Transfer-Encoding" header with for instance "binary"
|
||||||
|
--| encoding := "Content-Transfer-Encoding" ":" mechanism
|
||||||
|
--|
|
||||||
|
--| mechanism := "7bit" ; case-insensitive
|
||||||
|
--| / "quoted-printable"
|
||||||
|
--| / "base64"
|
||||||
|
--| / "8bit"
|
||||||
|
--| / "binary"
|
||||||
|
--| / x-token
|
||||||
|
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_content_transfer_encoding, a_mechanism)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_transfer_encoding (a_enc: READABLE_STRING_8)
|
||||||
|
-- Put "Transfer-Encoding" header with for instance "chunked"
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_transfer_encoding, a_enc)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_transfer_encoding_chunked
|
||||||
|
-- Put "Transfer-Encoding: chunked" header
|
||||||
|
do
|
||||||
|
put_transfer_encoding ("chunked")
|
||||||
|
end
|
||||||
|
|
||||||
|
put_content_disposition (a_type: READABLE_STRING_8; a_params: detachable READABLE_STRING_8)
|
||||||
|
-- Put "Content-Disposition" header
|
||||||
|
--| See RFC2183
|
||||||
|
--| disposition := "Content-Disposition" ":"
|
||||||
|
--| disposition-type
|
||||||
|
--| *(";" disposition-parm)
|
||||||
|
--| disposition-type := "inline"
|
||||||
|
--| / "attachment"
|
||||||
|
--| / extension-token
|
||||||
|
--| ; values are not case-sensitive
|
||||||
|
--| disposition-parm := filename-parm
|
||||||
|
--| / creation-date-parm
|
||||||
|
--| / modification-date-parm
|
||||||
|
--| / read-date-parm
|
||||||
|
--| / size-parm
|
||||||
|
--| / parameter
|
||||||
|
--| filename-parm := "filename" "=" value
|
||||||
|
--| creation-date-parm := "creation-date" "=" quoted-date-time
|
||||||
|
--| modification-date-parm := "modification-date" "=" quoted-date-time
|
||||||
|
--| read-date-parm := "read-date" "=" quoted-date-time
|
||||||
|
--| size-parm := "size" "=" 1*DIGIT
|
||||||
|
--| quoted-date-time := quoted-string
|
||||||
|
--| ; contents MUST be an RFC 822 `date-time'
|
||||||
|
--| ; numeric timezones (+HHMM or -HHMM) MUST be used
|
||||||
|
do
|
||||||
|
if a_params /= Void then
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_content_disposition, a_type + semi_colon_space + a_params)
|
||||||
|
else
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_content_disposition, a_type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Content-type helpers
|
||||||
|
|
||||||
|
put_content_type_text_css do put_content_type ({HTTP_MIME_TYPES}.text_css) end
|
||||||
|
put_content_type_text_csv do put_content_type ({HTTP_MIME_TYPES}.text_csv) end
|
||||||
|
put_content_type_text_html do put_content_type ({HTTP_MIME_TYPES}.text_html) end
|
||||||
|
put_content_type_text_javascript do put_content_type ({HTTP_MIME_TYPES}.text_javascript) end
|
||||||
|
put_content_type_text_json do put_content_type ({HTTP_MIME_TYPES}.text_json) end
|
||||||
|
put_content_type_text_plain do put_content_type ({HTTP_MIME_TYPES}.text_plain) end
|
||||||
|
put_content_type_text_xml do put_content_type ({HTTP_MIME_TYPES}.text_xml) end
|
||||||
|
|
||||||
|
put_content_type_application_json do put_content_type ({HTTP_MIME_TYPES}.application_json) end
|
||||||
|
put_content_type_application_javascript do put_content_type ({HTTP_MIME_TYPES}.application_javascript) end
|
||||||
|
put_content_type_application_zip do put_content_type ({HTTP_MIME_TYPES}.application_zip) end
|
||||||
|
|
||||||
|
put_content_type_image_gif do put_content_type ({HTTP_MIME_TYPES}.image_gif) end
|
||||||
|
put_content_type_image_png do put_content_type ({HTTP_MIME_TYPES}.image_png) end
|
||||||
|
put_content_type_image_jpg do put_content_type ({HTTP_MIME_TYPES}.image_jpg) end
|
||||||
|
put_content_type_image_svg_xml do put_content_type ({HTTP_MIME_TYPES}.image_svg_xml) end
|
||||||
|
|
||||||
|
put_content_type_message_http do put_content_type ({HTTP_MIME_TYPES}.message_http) end
|
||||||
|
|
||||||
|
put_content_type_multipart_mixed do put_content_type ({HTTP_MIME_TYPES}.multipart_mixed) end
|
||||||
|
put_content_type_multipart_alternative do put_content_type ({HTTP_MIME_TYPES}.multipart_alternative) end
|
||||||
|
put_content_type_multipart_related do put_content_type ({HTTP_MIME_TYPES}.multipart_related) end
|
||||||
|
put_content_type_multipart_form_data do put_content_type ({HTTP_MIME_TYPES}.multipart_form_data) end
|
||||||
|
put_content_type_multipart_signed do put_content_type ({HTTP_MIME_TYPES}.multipart_signed) end
|
||||||
|
put_content_type_multipart_encrypted do put_content_type ({HTTP_MIME_TYPES}.multipart_encrypted) end
|
||||||
|
|
||||||
|
feature -- Date
|
||||||
|
|
||||||
|
put_date (s: READABLE_STRING_8)
|
||||||
|
-- Put "Date: " header
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_date, s)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_current_date
|
||||||
|
-- Put current date time with "Date" header
|
||||||
|
do
|
||||||
|
put_utc_date (create {DATE_TIME}.make_now_utc)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_utc_date (dt: DATE_TIME)
|
||||||
|
-- Put UTC date time `dt' with "Date" header
|
||||||
|
do
|
||||||
|
put_date (dt.formatted_out ("ddd,[0]dd mmm yyyy [0]hh:[0]mi:[0]ss.ff2") + " GMT")
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Others
|
||||||
|
|
||||||
|
put_expires (n: INTEGER)
|
||||||
|
do
|
||||||
|
put_header_key_value ("Expires", n.out)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_cache_control (s: READABLE_STRING_8)
|
||||||
|
-- `s' could be for instance "no-cache, must-revalidate"
|
||||||
|
do
|
||||||
|
put_header_key_value ("Cache-Control", s)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_pragma (s: READABLE_STRING_8)
|
||||||
|
do
|
||||||
|
put_header_key_value ("Pragma", s)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_pragma_no_cache
|
||||||
|
do
|
||||||
|
put_pragma ("no-cache")
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Redirection
|
||||||
|
|
||||||
|
put_location (a_location: READABLE_STRING_8)
|
||||||
|
-- Tell the client the new location `a_location'
|
||||||
|
require
|
||||||
|
a_location_valid: not a_location.is_empty
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_location, a_location)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_refresh (a_location: READABLE_STRING_8; a_timeout_in_seconds: INTEGER)
|
||||||
|
-- Tell the client to refresh page with `a_location' after `a_timeout_in_seconds' in seconds
|
||||||
|
require
|
||||||
|
a_location_valid: not a_location.is_empty
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_refresh, a_timeout_in_seconds.out + "; url=" + a_location)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Cookie
|
||||||
|
|
||||||
|
put_cookie (key, value: READABLE_STRING_8; expiration, path, domain, secure: detachable READABLE_STRING_8)
|
||||||
|
-- Set a cookie on the client's machine
|
||||||
|
-- with key 'key' and value 'value'.
|
||||||
|
require
|
||||||
|
make_sense: (key /= Void and value /= Void) and then (not key.is_empty and not value.is_empty)
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
s := {HTTP_HEADER_NAMES}.header_set_cookie + colon_space + key + "=" + value
|
||||||
|
if expiration /= Void then
|
||||||
|
s.append ("; expires=" + expiration)
|
||||||
|
end
|
||||||
|
if path /= Void then
|
||||||
|
s.append ("; path=" + path)
|
||||||
|
end
|
||||||
|
if domain /= Void then
|
||||||
|
s.append ("; domain=" + domain)
|
||||||
|
end
|
||||||
|
if secure /= Void then
|
||||||
|
s.append ("; secure=" + secure)
|
||||||
|
end
|
||||||
|
add_header (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
has_header_named (a_name: READABLE_STRING_8): BOOLEAN
|
||||||
|
-- Has header item for `n'?
|
||||||
|
local
|
||||||
|
c: like headers.new_cursor
|
||||||
|
n: INTEGER
|
||||||
|
l_line: READABLE_STRING_8
|
||||||
|
do
|
||||||
|
from
|
||||||
|
n := a_name.count
|
||||||
|
c := headers.new_cursor
|
||||||
|
until
|
||||||
|
c.after or Result
|
||||||
|
loop
|
||||||
|
l_line := c.item
|
||||||
|
if l_line.starts_with (a_name) then
|
||||||
|
if l_line.valid_index (n + 1) then
|
||||||
|
Result := l_line [n + 1] = ':'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
c.forth
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
has_content_length: BOOLEAN
|
||||||
|
-- Has header "content_length"
|
||||||
|
do
|
||||||
|
Result := has_header_named ({HTTP_HEADER_NAMES}.header_content_length)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation: Header
|
||||||
|
|
||||||
|
force_header_by_name (n: detachable READABLE_STRING_8; h: READABLE_STRING_8)
|
||||||
|
-- Add header `h' or replace existing header of same header name `n'
|
||||||
|
require
|
||||||
|
h_has_name_n: (n /= Void and attached header_name (h) as hn) implies n.same_string (hn)
|
||||||
|
local
|
||||||
|
l_headers: like headers
|
||||||
|
do
|
||||||
|
if n /= Void then
|
||||||
|
from
|
||||||
|
l_headers := headers
|
||||||
|
l_headers.start
|
||||||
|
until
|
||||||
|
l_headers.after or l_headers.item.starts_with (n)
|
||||||
|
loop
|
||||||
|
l_headers.forth
|
||||||
|
end
|
||||||
|
if not l_headers.after then
|
||||||
|
l_headers.replace (h)
|
||||||
|
else
|
||||||
|
add_header (h)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
add_header (h)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
header_name (h: READABLE_STRING_8): detachable READABLE_STRING_8
|
||||||
|
-- If any, header's name with colon
|
||||||
|
--| ex: for "Foo-bar: something", this will return "Foo-bar:"
|
||||||
|
local
|
||||||
|
s: detachable STRING_8
|
||||||
|
i,n: INTEGER
|
||||||
|
c: CHARACTER
|
||||||
|
do
|
||||||
|
from
|
||||||
|
i := 1
|
||||||
|
n := h.count
|
||||||
|
create s.make (10)
|
||||||
|
until
|
||||||
|
i > n or c = ':' or s = Void
|
||||||
|
loop
|
||||||
|
c := h[i]
|
||||||
|
inspect c
|
||||||
|
when ':' then
|
||||||
|
s.extend (c)
|
||||||
|
when '-', 'a' .. 'z', 'A' .. 'Z' then
|
||||||
|
s.extend (c)
|
||||||
|
else
|
||||||
|
s := Void
|
||||||
|
end
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
Result := s
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
append_line_to (s: READABLE_STRING_8; h: like string)
|
||||||
|
do
|
||||||
|
h.append_string (s)
|
||||||
|
append_end_of_line_to (h)
|
||||||
|
end
|
||||||
|
|
||||||
|
append_end_of_line_to (h: like string)
|
||||||
|
do
|
||||||
|
h.append_character ('%R')
|
||||||
|
h.append_character ('%N')
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Constants
|
||||||
|
|
||||||
|
colon_space: STRING = ": "
|
||||||
|
semi_colon_space: STRING = "; "
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2011, 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
|
||||||
32
library/server/wsf/src/wsf_application.e
Normal file
32
library/server/wsf/src/wsf_application.e
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
note
|
||||||
|
description: "Objects that ..."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
WSF_APPLICATION
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WGI_APPLICATION
|
||||||
|
rename
|
||||||
|
execute as wgi_execute
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Execution
|
||||||
|
|
||||||
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
|
-- Execute the request
|
||||||
|
-- See `req.input' for input stream
|
||||||
|
-- `req.meta_variables' for the CGI meta variable
|
||||||
|
-- and `res' for output buffer
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- WGI Execution
|
||||||
|
|
||||||
|
wgi_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
|
||||||
|
do
|
||||||
|
execute (req, res)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
1486
library/server/wsf/src/wsf_request.e
Normal file
1486
library/server/wsf/src/wsf_request.e
Normal file
File diff suppressed because it is too large
Load Diff
164
library/server/wsf/src/wsf_response.e
Normal file
164
library/server/wsf/src/wsf_response.e
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Summary description for {WSF_RESPONSE}.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_RESPONSE
|
||||||
|
|
||||||
|
create {WSF_APPLICATION}
|
||||||
|
make_from_wgi
|
||||||
|
|
||||||
|
convert
|
||||||
|
make_from_wgi ({WGI_RESPONSE_BUFFER})
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make_from_wgi (r: WGI_RESPONSE_BUFFER)
|
||||||
|
do
|
||||||
|
wgi_response := r
|
||||||
|
end
|
||||||
|
|
||||||
|
wgi_response: WGI_RESPONSE_BUFFER
|
||||||
|
|
||||||
|
--feature {WSF_APPLICATION} -- Commit
|
||||||
|
|
||||||
|
-- commit
|
||||||
|
-- -- Commit the current response
|
||||||
|
-- do
|
||||||
|
-- wgi_response.commit
|
||||||
|
-- ensure
|
||||||
|
-- status_is_set: status_is_set
|
||||||
|
-- header_committed: header_committed
|
||||||
|
-- message_committed: message_committed
|
||||||
|
-- end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
header_committed: BOOLEAN
|
||||||
|
-- Header committed?
|
||||||
|
do
|
||||||
|
Result := wgi_response.header_committed
|
||||||
|
end
|
||||||
|
|
||||||
|
message_committed: BOOLEAN
|
||||||
|
-- Message committed?
|
||||||
|
do
|
||||||
|
Result := wgi_response.message_committed
|
||||||
|
end
|
||||||
|
|
||||||
|
message_writable: BOOLEAN
|
||||||
|
-- Can message be written?
|
||||||
|
do
|
||||||
|
Result := wgi_response.message_writable
|
||||||
|
end
|
||||||
|
|
||||||
|
--feature {WGI_RESPONSE_BUFFER} -- Core output operation
|
||||||
|
|
||||||
|
-- write (s: READABLE_STRING_8)
|
||||||
|
-- -- Send the string `s'
|
||||||
|
-- -- this can be used for header and body
|
||||||
|
-- do
|
||||||
|
-- wgi_response.write (s)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
feature -- Status setting
|
||||||
|
|
||||||
|
status_is_set: BOOLEAN
|
||||||
|
-- Is status set?
|
||||||
|
do
|
||||||
|
Result := wgi_response.status_is_set
|
||||||
|
end
|
||||||
|
|
||||||
|
set_status_code (a_code: INTEGER)
|
||||||
|
-- Set response status code
|
||||||
|
-- Should be done before sending any data back to the client
|
||||||
|
require
|
||||||
|
status_not_set: not status_is_set
|
||||||
|
header_not_committed: not header_committed
|
||||||
|
do
|
||||||
|
wgi_response.set_status_code (a_code)
|
||||||
|
ensure
|
||||||
|
status_code_set: status_code = a_code
|
||||||
|
status_set: status_is_set
|
||||||
|
end
|
||||||
|
|
||||||
|
status_code: INTEGER
|
||||||
|
-- Response status
|
||||||
|
do
|
||||||
|
Result := wgi_response.status_code
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Header output operation
|
||||||
|
|
||||||
|
write_headers_string (a_headers: READABLE_STRING_8)
|
||||||
|
require
|
||||||
|
status_set: status_is_set
|
||||||
|
header_not_committed: not header_committed
|
||||||
|
do
|
||||||
|
wgi_response.write_headers_string (a_headers)
|
||||||
|
ensure
|
||||||
|
status_set: status_is_set
|
||||||
|
header_committed: header_committed
|
||||||
|
message_writable: message_writable
|
||||||
|
end
|
||||||
|
|
||||||
|
write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: READABLE_STRING_8; value: READABLE_STRING_8]])
|
||||||
|
-- Send headers with status `a_status', and headers from `a_headers'
|
||||||
|
require
|
||||||
|
status_not_set: not status_is_set
|
||||||
|
header_not_committed: not header_committed
|
||||||
|
do
|
||||||
|
wgi_response.write_header (a_status_code, a_headers)
|
||||||
|
ensure
|
||||||
|
header_committed: header_committed
|
||||||
|
status_set: status_is_set
|
||||||
|
message_writable: message_writable
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Output operation
|
||||||
|
|
||||||
|
write_string (s: READABLE_STRING_8)
|
||||||
|
-- Send the string `s'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
do
|
||||||
|
wgi_response.write_string (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
write_substring (s: READABLE_STRING_8; a_begin_index, a_end_index: INTEGER)
|
||||||
|
-- Send the substring `s[a_begin_index:a_end_index]'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
do
|
||||||
|
wgi_response.write_substring (s, a_begin_index, a_end_index)
|
||||||
|
end
|
||||||
|
|
||||||
|
write_file_content (fn: READABLE_STRING_8)
|
||||||
|
-- Send the content of file `fn'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
do
|
||||||
|
wgi_response.write_file_content (fn)
|
||||||
|
end
|
||||||
|
|
||||||
|
flush
|
||||||
|
-- Flush if it makes sense
|
||||||
|
do
|
||||||
|
wgi_response.flush
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2011, 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
|
||||||
20
library/server/wsf/wsf-safe.ecf
Normal file
20
library/server/wsf/wsf-safe.ecf
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="wsf" uuid="A37CE5AA-4D2A-4441-BC6A-0A1D7EC49647" library_target="wsf">
|
||||||
|
<target name="wsf">
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/.git$</exclude>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||||
|
</option>
|
||||||
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="ewsgi" location="..\ewsgi\ewsgi-safe.ecf"/>
|
||||||
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
|
<library name="error" location="..\..\error\error-safe.ecf"/>
|
||||||
|
<library name="http" location="..\..\protocol\http\http-safe.ecf"/>
|
||||||
|
<library name="encoder" location="..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||||
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
16
library/server/wsf/wsf.ecf
Normal file
16
library/server/wsf/wsf.ecf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf" uuid="A37CE5AA-4D2A-4441-BC6A-0A1D7EC49647" library_target="wsf">
|
||||||
|
<target name="wsf">
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/.git$</exclude>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||||
|
</option>
|
||||||
|
<library name="ewsgi" location="..\ewsgi\ewsgi.ecf"/>
|
||||||
|
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||||
|
<cluster name="src" location="." recursive="true"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
Reference in New Issue
Block a user