Fixed wsf tests project.
Added ini config support to simple_file example.
This commit is contained in:
4
examples/simple_file/service.ini
Normal file
4
examples/simple_file/service.ini
Normal file
@@ -0,0 +1,4 @@
|
||||
port=9090
|
||||
verbose=true
|
||||
socket_recv_timeout=15
|
||||
keep_alive_timeout=30
|
||||
@@ -21,6 +21,7 @@ feature {NONE} -- Initialization
|
||||
do
|
||||
Precursor
|
||||
set_service_option ("port", 9090)
|
||||
import_service_options (create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("service.ini"))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -108,6 +108,49 @@ feature -- Output operation
|
||||
output.append_substring (s, start_index, end_index)
|
||||
end
|
||||
|
||||
put_file_content (a_file: FILE; a_offset: INTEGER; a_byte_count: INTEGER)
|
||||
-- Send `a_byte_count' bytes from the content of file `a_file' starting at offset `a_offset'.
|
||||
--| Could be redefined for optimization.
|
||||
local
|
||||
l_close_needed: BOOLEAN
|
||||
l_remain: INTEGER
|
||||
l_done: BOOLEAN
|
||||
s: STRING
|
||||
do
|
||||
if a_file.exists and then a_file.is_access_readable then
|
||||
if a_file.is_open_read then
|
||||
l_close_needed := False
|
||||
else
|
||||
l_close_needed := True
|
||||
a_file.open_read
|
||||
end
|
||||
if a_offset > 0 then
|
||||
a_file.move (a_offset)
|
||||
end
|
||||
from
|
||||
l_remain := a_byte_count
|
||||
l_done := False
|
||||
until
|
||||
a_file.exhausted or l_done
|
||||
loop
|
||||
a_file.read_stream (l_remain.min (4_096))
|
||||
s := a_file.last_string
|
||||
if s.is_empty then
|
||||
-- network error?
|
||||
l_done := True
|
||||
else
|
||||
put_string (s)
|
||||
l_remain := l_remain - s.count
|
||||
check l_remain >= 0 end
|
||||
l_done := l_remain = 0
|
||||
end
|
||||
end
|
||||
if l_close_needed then
|
||||
a_file.close
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
flush
|
||||
do
|
||||
output.wipe_out
|
||||
|
||||
Reference in New Issue
Block a user