Protected export of WSF_RESPONSE_MESSAGE.send_to

Added WSF_DEFAULT_RESPONSE_SERVICE
Added simple WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI class to load launch option from ini file.

Removed a few obsolete features
This commit is contained in:
Jocelyn Fiat
2012-05-25 20:17:55 +02:00
parent aa6a1f2b8a
commit 6cff00428b
27 changed files with 282 additions and 72 deletions

View File

@@ -104,7 +104,7 @@ feature -- Element change
answer_head_request_method := b
end
feature -- Basic operations
feature {WSF_SERVICE, WSF_RESPONSE} -- Basic operations
send_to (res: WSF_RESPONSE)
do

View File

@@ -150,7 +150,7 @@ feature -- Element change
update_content_length
end
feature -- Output
feature {WSF_SERVICE, WSF_RESPONSE} -- Output
send_to (res: WSF_RESPONSE)
local

View File

@@ -110,7 +110,7 @@ feature -- Element change
body := b
end
feature -- Output
feature {WSF_SERVICE, WSF_RESPONSE} -- Output
send_to (res: WSF_RESPONSE)
local

View File

@@ -79,7 +79,7 @@ feature -- Element change
l_body.append (a_string)
end
feature -- Output
feature {WSF_SERVICE, WSF_RESPONSE} -- Output
send_to (res: WSF_RESPONSE)
local

View File

@@ -70,7 +70,7 @@ feature -- Element change
content_type := Void
end
feature -- Output
feature {WSF_SERVICE, WSF_RESPONSE} -- Output
send_to (res: WSF_RESPONSE)
local

View File

@@ -11,13 +11,20 @@ inherit
feature {NONE} -- Initialization
make_and_launch
frozen make_and_launch
local
l_launcher: G
do
initialize
create l_launcher.make_and_launch (Current, service_options)
end
initialize
-- Initialize current service
--| Could be redefine to set custom service option(s)
do
end
service_options: detachable WSF_SERVICE_LAUNCHER_OPTIONS
feature -- Default service options

View File

@@ -66,13 +66,6 @@ feature {NONE} -- Initialization
make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options)
end
frozen make_and_launch_with_options (a_callback: like {WSF_CALLBACK_SERVICE}.callback; a_options: like options)
obsolete
"[2012-Mars-20] Use make_callback_and_launch (a_callback, a_options)"
do
make_callback_and_launch (a_callback, a_options)
end
initialize
-- Initialize Current using `options' if attached
-- and build the connector

View File

@@ -14,7 +14,14 @@ note
class
WSF_SERVICE_LAUNCHER_OPTIONS
inherit
ANY
redefine
default_create
end
create
default_create,
make,
make_from_array
@@ -23,9 +30,15 @@ convert
feature {NONE} -- Initialization
default_create
do
Precursor
create options.make (0)
end
make
do
create options.make (0)
default_create
end
make_from_array (a_options: ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]])

View File

@@ -0,0 +1,62 @@
note
description: "[
Options used by WSF_SERVICE_LAUNCHER
Built from ini configuration file
]"
class
WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI
inherit
WSF_SERVICE_LAUNCHER_OPTIONS
create
make_from_file
feature {NONE} -- Initialization
make_from_file (a_filename: READABLE_STRING_32)
-- Initialize `Current'.
do
make
import (a_filename)
end
feature {NONE} -- Implementation
import (a_filename: READABLE_STRING_32)
-- Import ini file content
local
f: PLAIN_TEXT_FILE
l,v: STRING_8
p: INTEGER
do
--FIXME: handle unicode filename here.
create f.make (a_filename)
if f.exists and f.is_readable then
f.open_read
from
f.read_line
until
f.exhausted
loop
l := f.last_string
l.left_adjust
if not l.is_empty and then l[1] /= '#' then
p := l.index_of ('=', 1)
if p > 1 then
v := l.substring (p + 1, l.count)
l.keep_head (p - 1)
v.left_adjust
v.right_adjust
l.right_adjust
set_option (l.as_lower, v)
end
end
f.read_line
end
f.close
end
end
end

View File

@@ -265,22 +265,6 @@ feature -- Output operation
feature -- Response object
put_response (a_message: WSF_RESPONSE_MESSAGE)
-- Set `a_message' as the whole response to the client
--| `a_message' is responsible to sent the status code, the header and the content
obsolete
"[2012-Mars-19] Use `send (a_message)' "
require
header_not_committed: not header_committed
status_not_committed: not status_committed
no_message_committed: not message_committed
do
a_message.send_to (Current)
ensure
status_committed: status_committed
header_committed: header_committed
end
send (a_message: WSF_RESPONSE_MESSAGE)
-- Set `a_message' as the whole response to the client
--| `a_message' is responsible to sent the status code, the header and the content

View File

@@ -7,9 +7,11 @@ note
deferred class
WSF_RESPONSE_MESSAGE
feature -- Output
feature {WSF_SERVICE, WSF_RESPONSE} -- Output
send_to (res: WSF_RESPONSE)
-- Send Current message to `res'
--| This should not be called by user's code directly
require
header_not_committed: not res.header_committed
status_not_committed: not res.status_committed