Added a few example based on the obsolete libraries (v0).
Updated the tutorial example. Added WSF_MESSAGE_EXECUTION.
This commit is contained in:
@@ -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