Added a few example based on the obsolete libraries (v0).
Updated the tutorial example. Added WSF_MESSAGE_EXECUTION.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
This folder contains 2 alternatives code
|
||||
|
||||
1) "execute" using the WSF_SERVICE interface, i.e
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
1) "message" using the WSF_MESSAGE_EXECUTION interface, i.e
|
||||
message: WSF_RESPONSE_MESSAGE
|
||||
do
|
||||
...
|
||||
end
|
||||
|
||||
|
||||
2) "launcher" using the WSF_RESPONSE_SERVICE interface, but it uses a launcher to start the service, instead of inheriting from WSF_DEFAULT_SERVICE or WSF_DEFAULT_RESPONSE_SERVICE
|
||||
2) "launcher" using the WSF_RESPONSE_SERVICE interface, but it uses a launcher to start the service, instead of inheriting from WSF_DEFAULT_SERVICE
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
APPLICATION implements the `Hello World' service.
|
||||
|
||||
It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready
|
||||
only `execute' needs to be implemented.
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed.
|
||||
|
||||
]"
|
||||
|
||||
class
|
||||
HELLO_APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
page: WSF_PAGE_RESPONSE
|
||||
do
|
||||
create page.make
|
||||
page.put_string ("Hello World")
|
||||
res.send (page)
|
||||
|
||||
--| another alternative would have been more low level
|
||||
--| by setting the status code, the content type, and the content length which is 11 for "Hello World"
|
||||
--| res.put_header ({WSF_HEADER}.ok, <<["Content-Type", "text/plain"], ["Content-Length", "11"]>>)
|
||||
--| res.put_string ("Hello World")
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -11,30 +11,31 @@ class
|
||||
HELLO_APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_RESPONSE_SERVICE
|
||||
WSF_LAUNCHABLE_SERVICE
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_and_launch
|
||||
initialize
|
||||
local
|
||||
launcher: WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
do
|
||||
--| Uncomment the following line, to read options from "ewf.ini" configuration file
|
||||
-- create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} opts.make_from_file ("ewf.ini")
|
||||
|
||||
create launcher.make_and_launch (Current, opts)
|
||||
Precursor
|
||||
--| Uncomment the following 2 lines, to read options from "ewf.ini" configuration file
|
||||
-- create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} opts.make_from_file ("ewf.ini")
|
||||
-- import_service_options (opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
response (req: WSF_REQUEST): WSF_PAGE_RESPONSE
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_DEFAULT_SERVICE_LAUNCHER [HELLO_EXECUTION]
|
||||
do
|
||||
create Result.make
|
||||
Result.put_string ("Hello World")
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
note
|
||||
description: "[
|
||||
Request execution for Current application.
|
||||
Implement `execute' based on `request' and `response'.
|
||||
]"
|
||||
author: "$Author$"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HELLO_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
local
|
||||
msg: WSF_PAGE_RESPONSE
|
||||
do
|
||||
create msg.make_with_body ("Hello World")
|
||||
response.send (msg)
|
||||
|
||||
--| alternative would have been more low level
|
||||
--| by setting the content type, and the content length which is 11 for "Hello World"
|
||||
-- response.header.put_content_type_text_plain
|
||||
-- response.header.put_content_length (11)
|
||||
-- response.put_string ("Hello World")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
note
|
||||
description: "[
|
||||
APPLICATION implements the `Hello World' service.
|
||||
|
||||
It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready
|
||||
only `execute' needs to be implemented.
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed.
|
||||
|
||||
]"
|
||||
|
||||
class
|
||||
HELLO_APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE [HELLO_EXECUTION]
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
note
|
||||
description: "[
|
||||
Request execution for Current application.
|
||||
Implement `message' based on `request' and `response'.
|
||||
]"
|
||||
author: "$Author$"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HELLO_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_MESSAGE_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
message: WSF_PAGE_RESPONSE
|
||||
do
|
||||
create Result.make_with_body ("Hello World")
|
||||
response.send (Result)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -11,9 +11,10 @@
|
||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||
<library name="default_nino" location="..\..\..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||
<library name="default_standalone" location="..\..\..\..\..\..\library\server\wsf\default\standalone-safe.ecf"/>
|
||||
<cluster name="src" location=".\" />
|
||||
</target>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# For nino connector, use port 9999
|
||||
# For standalone connectors, use port 9999
|
||||
port=9999
|
||||
|
||||
#verbose=true
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</option>
|
||||
<precompile name="precomp_wsf" location="..\..\..\..\precomp\wsf-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||
<library name="default_standalone" location="..\..\..\..\library\server\wsf\default\standalone-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
@@ -29,7 +29,7 @@
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<precompile name="precomp_wsf-mt" location="..\..\..\..\precomp\wsf-mt-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||
<library name="default_standalone" location="..\..\..\..\library\server\wsf\default\standalone-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -2,19 +2,17 @@ note
|
||||
description: "[
|
||||
This class implements the `Hello World' service.
|
||||
|
||||
It inherits from WSF_DEFAULT_RESPONSE_SERVICE to get default EWF connector ready
|
||||
only `response' needs to be implemented.
|
||||
In this example, it is redefined and specialized to be WSF_PAGE_RESPONSE
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed.
|
||||
It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready
|
||||
only `HELLO_EXECUTION' needs to be implemented.
|
||||
|
||||
`initialize' is redefined to provide custom options if needed.
|
||||
]"
|
||||
|
||||
class
|
||||
CUSTOM_HELLO_APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_RESPONSE_SERVICE
|
||||
WSF_DEFAULT_SERVICE [HELLO_EXECUTION]
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
@@ -32,7 +30,7 @@ feature {NONE} -- Initialization
|
||||
--| You can also uncomment the following line if you use the Nino connector
|
||||
--| so that the server listens on port 9999
|
||||
--| quite often the port 80 is already busy
|
||||
-- set_service_option ("port", 9999)
|
||||
set_service_option ("port", 9999)
|
||||
|
||||
--| Uncomment next line to have verbose option if available
|
||||
-- set_service_option ("verbose", True)
|
||||
@@ -41,13 +39,4 @@ feature {NONE} -- Initialization
|
||||
Precursor
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
response (req: WSF_REQUEST): WSF_PAGE_RESPONSE
|
||||
-- Computed response message.
|
||||
do
|
||||
create Result.make
|
||||
Result.put_string ("Hello World")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,30 +2,20 @@ note
|
||||
description: "[
|
||||
This class implements the `Hello World' service.
|
||||
|
||||
It inherits from WSF_DEFAULT_RESPONSE_SERVICE to get default EWF connector ready
|
||||
only `response' needs to be implemented.
|
||||
In this example, it is redefined and specialized to be WSF_PAGE_RESPONSE
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed.
|
||||
It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready.
|
||||
And implement HELLO_EXECUTION.
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed,
|
||||
such as specific port number.
|
||||
]"
|
||||
|
||||
class
|
||||
HELLO_APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_RESPONSE_SERVICE
|
||||
WSF_DEFAULT_SERVICE [HELLO_EXECUTION]
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
response (req: WSF_REQUEST): WSF_PAGE_RESPONSE
|
||||
-- Computed response message.
|
||||
do
|
||||
create Result.make
|
||||
Result.put_string ("Hello World")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
35
examples/tutorial/step_2/hello/src/hello_execution.e
Normal file
35
examples/tutorial/step_2/hello/src/hello_execution.e
Normal file
@@ -0,0 +1,35 @@
|
||||
note
|
||||
description: "[
|
||||
Request execution for Current application.
|
||||
Implement `execute' based on `request' and `response'.
|
||||
]"
|
||||
author: "$Author$"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HELLO_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
local
|
||||
msg: WSF_PAGE_RESPONSE
|
||||
do
|
||||
create msg.make_with_body ("Hello World")
|
||||
response.send (msg)
|
||||
|
||||
--| alternative would have been more low level
|
||||
--| by setting the content type, and the content length which is 11 for "Hello World"
|
||||
-- response.header.put_content_type_text_plain
|
||||
-- response.header.put_content_length (11)
|
||||
-- response.put_string ("Hello World")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user