Fixed wsf tests project.

Added ini config support to simple_file example.
This commit is contained in:
2016-10-25 15:22:18 +02:00
parent 5e79751522
commit 193f22ebc8
3 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
port=9090
verbose=true
socket_recv_timeout=15
keep_alive_timeout=30

View File

@@ -21,6 +21,7 @@ feature {NONE} -- Initialization
do do
Precursor Precursor
set_service_option ("port", 9090) set_service_option ("port", 9090)
import_service_options (create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("service.ini"))
end end
end end

View File

@@ -108,6 +108,49 @@ feature -- Output operation
output.append_substring (s, start_index, end_index) output.append_substring (s, start_index, end_index)
end 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 flush
do do
output.wipe_out output.wipe_out