Simplified EWSGI interfaces
Renamed WGI_RESPONSE_BUFFER as WGI_RESPONSE to avoid confusion
Removed EWF_HEADER and removed related caller from WGI implementation,
now this is only part of WSF library
Added wgi_version, wgi_implementation and wgi_connector to the WGI_REQUEST interface
to give more information to the user
Added back WGI_CONNECTOR to WGI specification, mainly because of `{WGI_REQUEST}.wgi_connector'
simplified WGI_CONNECTOR to contain for now only `name' and `version'
if the implementation of connector inherit from WGI_CONNECTOR (recommended)
this might gives more access to the user using a reverse assignment for specific needs
(but this usage is not recommended due to portability issue on other connector)
Removed useless connector.ecf since now EWF/WGI library provides the helper classes
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
<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="connector" location="..\connector-safe.ecf" readonly="false"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\..\contrib\library\server\nino\nino-safe.ecf" readonly="false">
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<option warning="true" full_class_checking="true">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="connector" location="..\connector.ecf" readonly="false"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\..\contrib\library\server\nino\nino.ecf" readonly="false">
|
||||
|
||||
@@ -9,9 +9,6 @@ class
|
||||
|
||||
inherit
|
||||
WGI_CONNECTOR
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
@@ -19,6 +16,16 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_app: like application)
|
||||
local
|
||||
cfg: HTTP_SERVER_CONFIGURATION
|
||||
do
|
||||
application := a_app
|
||||
|
||||
create cfg.make
|
||||
create server.make (cfg)
|
||||
end
|
||||
|
||||
make_with_base (a_app: like application; a_base: like base)
|
||||
require
|
||||
a_base_starts_with_slash: (a_base /= Void and then not a_base.is_empty) implies a_base.starts_with ("/")
|
||||
@@ -27,15 +34,18 @@ feature {NONE} -- Initialization
|
||||
set_base (a_base)
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
feature -- Access
|
||||
|
||||
initialize
|
||||
local
|
||||
cfg: HTTP_SERVER_CONFIGURATION
|
||||
do
|
||||
create cfg.make
|
||||
create server.make (cfg)
|
||||
end
|
||||
name: STRING_8 = "Nino"
|
||||
-- Name of Current connector
|
||||
|
||||
version: STRING_8 = "0.1"
|
||||
-- Version of Current connector
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
application: WGI_SERVICE
|
||||
-- Gateway Service
|
||||
|
||||
feature -- Access
|
||||
|
||||
@@ -107,11 +117,11 @@ feature -- Server
|
||||
process_request (env: HASH_TABLE [STRING, STRING]; a_headers_text: STRING; a_socket: TCP_STREAM_SOCKET)
|
||||
local
|
||||
req: WGI_REQUEST_FROM_TABLE
|
||||
res: detachable WGI_RESPONSE_STREAM_BUFFER
|
||||
res: detachable WGI_RESPONSE_STREAM
|
||||
rescued: BOOLEAN
|
||||
do
|
||||
if not rescued then
|
||||
create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket))
|
||||
create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket), Current)
|
||||
create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket))
|
||||
req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text)
|
||||
application.execute (req, res)
|
||||
@@ -119,7 +129,7 @@ feature -- Server
|
||||
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
||||
if res /= Void then
|
||||
if not res.status_is_set then
|
||||
res.write_header ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error)
|
||||
end
|
||||
if res.message_writable then
|
||||
res.write_string ("<pre>" + l_trace + "</pre>")
|
||||
|
||||
Reference in New Issue
Block a user