Compare commits

...

7 Commits

Author SHA1 Message Date
f56aa22c29 Fixed compilation of proxy and simple examples.
Made the websocket client library scoop capable.
2016-12-05 15:56:46 +01:00
186e5514eb If the count for put_file_content is not positive (i.e <= 0), do not send anything.
Output/log more information for request handling when standalone httpd server has verbose enabled.
2016-12-01 21:20:14 +01:00
9fd53b9b1f Fixed debug.ecf file from debug example. 2016-12-01 21:08:13 +01:00
27c77721fd Fixed a few void-safety issue, attribute not initialized before computing agent objects. 2016-12-01 20:41:03 +01:00
c2202e82f6 Fixed compilation of desktop app example. 2016-12-01 18:43:22 +01:00
72a40a2673 Fixed potential void-safety issue in descendants related to initialization of router and filter. 2016-12-01 18:14:07 +01:00
2fbffd0c1e Fixed compilation. 2016-12-01 16:09:41 +01:00
23 changed files with 99 additions and 73 deletions

View File

@@ -20,15 +20,16 @@ feature
initialize_controls
do
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", "Grid Demo"))
create datasource.make_news
create search_query.make (create {GOOGLE_AUTOCOMPLETION}.make)
search_query.add_class ("form-control")
create grid.make (<<create {WSF_GRID_COLUMN}.make ("Title", "title"), create {WSF_GRID_COLUMN}.make ("Content", "content")>>, datasource)
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", "Grid Demo"))
search_query.set_change_event (agent change_query)
control.add_control (search_query)
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h2", "", "Results"))
create grid.make (<<create {WSF_GRID_COLUMN}.make ("Title", "title"), create {WSF_GRID_COLUMN}.make ("Content", "content")>>, datasource)
control.add_control (grid)
navbar.set_active (2)
end

View File

@@ -20,15 +20,17 @@ feature
initialize_controls
do
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", " Repeater Demo"))
create datasource.make_news
create repeater.make (datasource)
create search_query.make (create {GOOGLE_AUTOCOMPLETION}.make)
search_query.add_class ("form-control")
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", " Repeater Demo"))
search_query.set_change_event (agent change_query)
control.add_control (search_query)
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h2", "", "Results"))
create repeater.make (datasource)
control.add_control (repeater)
navbar.set_active (3)
end

View File

@@ -28,7 +28,6 @@ feature
cats_container: WSF_FORM_ELEMENT_CONTROL [LIST [STRING_32]]
source: INCREASING_PROGRESSSOURCE
do
Precursor
create form.make
--Number 1
create textbox1.make ({STRING_32} "1")
@@ -64,24 +63,33 @@ feature
form.add_control (cats_container)
--Button 1
create button1.make ("Update")
button1.set_click_event (agent handle_click)
button1.add_class ("col-lg-offset-2")
form.add_control (button1)
--Button 2
create button2.make ("Start Modal Grid")
button2.set_click_event (agent run_modal)
form.add_control (button2)
--Result
create result_html.make ("p", "")
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING_32]}.make ("Result", result_html))
control.add_control (form)
--Progress bar
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h4", "", "Autoincrementing progressbar"))
create source.make
create progress.make_with_source (source)
source.set_control (progress)
progress.set_isolation (true)
Precursor
control.add_control (form)
-- Actions
button1.set_click_event (agent handle_click)
button2.set_click_event (agent run_modal)
--Progress bar
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h4", "", "Autoincrementing progressbar"))
control.add_control (progress)
navbar.set_active (1)
end

View File

@@ -20,7 +20,6 @@ feature -- Implementation
initialize_controls
do
Precursor
create slider.make
--slider.add_control (form, Void)
--slider.add_image ("http://www.placesmustseen.com/wp-content/uploads/2013/01/paris-eiffel-tower.jpg", "Eiffel Tower")
@@ -28,6 +27,8 @@ feature -- Implementation
slider.add_image ("http://31.media.tumblr.com/5b5ae35c4f88d4b80aeb21e36263c6e6/tumblr_mtw7mhZsCe1st5lhmo1_1280.jpg", "landscape")
slider.add_image ("http://25.media.tumblr.com/403969159fb1642e67ed702f28e966e0/tumblr_muuig0890N1st5lhmo1_1280.jpg", "landscape")
slider.add_image ("http://24.media.tumblr.com/d349779e7216167e7c0ca3af66817794/tumblr_mufrlh9WqW1st5lhmo1_1280.jpg", "landscape")
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", " Image Slider Demo"))
control.add_control (slider)
navbar.set_active (4)

View File

@@ -21,20 +21,25 @@ feature -- Implementation
initialize_controls
local
do
create form.make
create filebox.make
create n1_container.make ("File Upload", filebox)
create filebox2.make
create n2_container.make ("Auto start Upload", filebox2)
create filebox3.make_with_image_preview
create n3_container.make ("Image Upload", filebox3)
create button1.make ("Update")
Precursor
control.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("h1", "", "File Upload Demo"))
create form.make
--File
create filebox.make
filebox.set_upload_function (agent upload_file)
filebox.set_upload_done_event (agent submit_form)
create n1_container.make ("File Upload", filebox)
n1_container.add_validator (create {WSF_FILESIZE_VALIDATOR}.make (10000000, "File must be smaller than 10MB"))
form.add_control (n1_container)
--File
create filebox2.make
filebox2.set_upload_function (agent upload_file)
create n2_container.make ("Auto start Upload", filebox2)
filebox2.set_change_event (agent
do
n1_container.validate
@@ -45,15 +50,13 @@ feature -- Implementation
n2_container.add_validator (create {WSF_FILESIZE_VALIDATOR}.make (10000000, "File must be smaller than 10MB"))
form.add_control (n2_container)
--Image
create filebox3.make_with_image_preview
filebox3.set_upload_function (agent upload_file)
filebox3.set_upload_done_event (agent submit_form)
create n3_container.make ("Image Upload", filebox3)
n3_container.add_validator (create {WSF_FILESIZE_VALIDATOR}.make (10000000, "File must be smaller than 10MB"))
form.add_control (n3_container)
--Button 1
create button1.make ("Update")
button1.set_click_event (agent submit_form)
button1.add_class ("col-lg-offset-2")
form.add_control (button1)

View File

@@ -11,10 +11,6 @@
</option>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<capability>
<concurrency support="scoop" use="scoop"/>
<void_safety support="all"/>
</capability>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoder" location="..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
@@ -24,9 +20,6 @@
<target name="debug_any" extends="common">
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/>
<capability>
<concurrency support="scoop" use="scoop"/>
</capability>
<library name="cgi" location="..\..\library\server\wsf\connector\cgi-safe.ecf" readonly="false"/>
<library name="libfcgi" location="..\..\library\server\wsf\connector\libfcgi-safe.ecf" readonly="false"/>
<library name="standalone" location="..\..\library\server\wsf\connector\standalone-safe.ecf" readonly="false"/>
@@ -36,9 +29,6 @@
<target name="debug_standalone" extends="common">
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/>
<capability>
<concurrency support="scoop" use="scoop"/>
</capability>
<library name="default_standalone" location="..\..\library\server\wsf\default\standalone-safe.ecf" readonly="false"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>

View File

@@ -10,7 +10,6 @@
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="ewsgi" location="..\..\library\server\ewsgi\ewsgi-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="vision2" location="$ISE_LIBRARY\library\vision2\vision2-safe.ecf"/>
<library name="web_browser" location="$ISE_LIBRARY\library\web_browser\web_browser-safe.ecf" readonly="false"/>
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>

View File

@@ -50,7 +50,7 @@ feature -- Execution
feature -- Access
on_launched_action: detachable separate PROCEDURE [ANY, TUPLE]
on_launched_action: detachable separate PROCEDURE [TUPLE]
set_on_launched_action (act: like on_launched_action)
do

View File

@@ -10,6 +10,7 @@
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<variable name="ssl_supported" value="false"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>

View File

@@ -10,6 +10,7 @@
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>

View File

@@ -22,13 +22,10 @@ create
feature {NONE} -- Initialization
initialize
local
opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS
do
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)
--| Uncomment the following line, to read options from "ewf.ini" configuration file
-- import_service_options (create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} opts.make_from_file ("ewf.ini"))
end
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)

View File

@@ -29,10 +29,8 @@ feature {NONE} -- Initialization
create ws_client.make_with_port ("ws://echo.websocket.org", 80, Void)
-- create ws_client.make_with_port ("ws://127.0.0.1", 9090, Void)
ws_client.launch
ws_client.join_all
execution_environment.sleep (5_000_000)
ws_client.execute
end
end

View File

@@ -7,9 +7,10 @@
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<option warning="true" void_safety="all">
<option warning="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="concurrency" value="scoop"/>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="web_socket_client" location="..\..\web_socket_client-safe.ecf" readonly="false"/>
@@ -17,7 +18,7 @@
</target>
<target name="ws_client" extends="common">
<root class="APPLICATION" feature="make"/>
<setting name="concurrency" value="thread"/>
<setting name="concurrency" value="scoop"/>
</target>
<target name="ws_client_ssl" extends="ws_client">
<variable name="ssl_enabled" value="true"/>

View File

@@ -23,11 +23,6 @@ inherit
WEB_SOCKET
THREAD
rename
make as thread_make
end
feature -- Initialization
initialize (a_uri: READABLE_STRING_GENERAL; a_protocols: detachable ITERABLE [STRING])
@@ -35,7 +30,6 @@ feature -- Initialization
require
is_valid_uri: is_valid_uri (a_uri)
do
thread_make
uri := a_uri
set_default_port
create protocol.make_empty
@@ -50,7 +44,6 @@ feature -- Initialization
require
is_valid_uri: is_valid_uri (a_uri)
do
thread_make
uri := a_uri
port := a_port
create protocol.make_empty
@@ -64,11 +57,9 @@ feature -- Initialization
require
is_valid_uri: is_valid_uri (a_host)
do
thread_make
uri := a_host + ":" + a_port.out + a_path
port := a_port
create protocol.make_empty
-- set_protocols (a_protocols)
create ready_state.make
socket := new_socket (port, host)
create server_handshake.make
@@ -98,8 +89,10 @@ feature -- Access
local
l_uri: URI
do
create l_uri.make_from_string (a_uri.as_string_8)
Result := l_uri.is_valid
if a_uri.is_valid_as_string_8 then
create l_uri.make_from_string (a_uri.to_string_8)
Result := l_uri.is_valid
end
end
server_handshake: WEB_SOCKET_HANDSHAKE_DATA

View File

@@ -17,7 +17,6 @@
<library name="lib_http_network" location="..\..\http_network\http_network-safe.ecf"/>
<library name="lib_web_socket_protocol" location="..\protocol\web_socket_protocol-safe.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri-safe.ecf"/>
<cluster name="web_socket_client" location=".\src\" recursive="true">
<file_rule>

View File

@@ -8,7 +8,7 @@
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<option warning="true" void_safety="none">
<option warning="true" void_safety="none">
</option>
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
@@ -17,7 +17,6 @@
<library name="lib_http_network" location="..\..\http_network\http_network.ecf"/>
<library name="lib_web_socket_protocol" location="..\protocol\web_socket_protocol.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf"/>
<cluster name="web_socket_client" location=".\src\" recursive="true">
<file_rule>

View File

@@ -106,7 +106,9 @@ feature -- Output operation
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
do
output.put_file_content (f, a_offset, a_count)
if a_count > 0 then
output.put_file_content (f, a_offset, a_count)
end
end
flush

View File

@@ -170,6 +170,9 @@ feature -- Status change
-- Report error occurred, with optional message `m'.
do
has_error := True
if m /= Void and then is_verbose then
log (m.as_string_8, debug_level)
end
end
reset_error
@@ -313,7 +316,7 @@ feature -- Execution
is_persistent_connection_requested := False
else
if is_verbose then
log (request_header, information_level)
log_with_separation_line (request_header, information_level)
end
process_request (l_socket)
end
@@ -590,6 +593,26 @@ feature -- Output
logger_set: logger = a_logger
end
log_with_separation_line (m: STRING; a_level: INTEGER)
-- Log message `m'.
require
is_verbose: is_verbose
local
s: STRING
do
if is_verbose and (verbose_level & a_level) = a_level then
create s.make (m.count + 42)
s.append (create {STRING}.make_filled ('-', 40))
s.append_character ('%N')
s.append (m)
if attached logger as l_logger then
l_logger.log (s)
else
io.put_string (s + "%N")
end
end
end
log (m: STRING; a_level: INTEGER)
-- Log message `m'.
require

View File

@@ -12,7 +12,7 @@
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="ewsgi" location="..\ewsgi\ewsgi.ecf"/>
<library name="http" location="..\..\network\protocol\http\http.ecf"/>
<library name="http" location="..\..\..\..\network\protocol\http\http.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
<library name="wsf" location="wsf.ecf"/>

View File

@@ -29,21 +29,29 @@ inherit
feature {NONE} -- Initialize
initialize
do
create_filtered_router
initialize_filtered_router
end
create_filtered_router
-- Create `router` and `filter`.
do
create_router
create_filter
end
initialize_filtered_router
-- Initialize `router` and `filter`.
local
f: like filter
do
Precursor {WSF_ROUTED_EXECUTION}
Precursor {WSF_FILTERED_EXECUTION}
initialize_router
initialize_filter
-- Current is a WSF_FILTER as well in order to call the router
-- let's add Current at the end of the filter chain.
from
f := filter
until
not attached f.next as l_next
loop
f := l_next
end
f.set_next (Current)
append_filter (Current)
end
feature -- Execute Filter

View File

@@ -389,8 +389,10 @@ feature -- Body
message_writable: message_writable
not_too_big: a_offset + a_count <= f.count
do
wgi_response.put_file_content (f, a_offset, a_count)
increment_transfered_content_length (a_count)
if a_count > 0 then
wgi_response.put_file_content (f, a_offset, a_count)
increment_transfered_content_length (a_count)
end
end
feature -- Chunk body

View File

@@ -21,7 +21,6 @@
<library name="default_cgi" location="..\library\server\wsf\default\cgi-safe.ecf" readonly="false"/>
<library name="default_libfcgi" location="..\library\server\wsf\default\libfcgi-safe.ecf" readonly="false"/>
<library name="default_openshift" location="..\library\server\wsf\default\openshift-safe.ecf" readonly="false"/>
<library name="demo-1" location="..\library\security\openid\consumer\demo\demo-safe.ecf" readonly="false"/>
<library name="encoder" location="..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="..\library\utility\general\error\error-safe.ecf" readonly="false"/>
<library name="ewsgi" location="..\library\server\ewsgi\ewsgi-safe.ecf" readonly="false"/>

View File

@@ -20,7 +20,6 @@
<library name="default_libfcgi" location="..\library\server\wsf\default\libfcgi-safe.ecf" readonly="false"/>
<library name="default_openshift" location="..\library\server\wsf\default\openshift-safe.ecf" readonly="false"/>
<library name="default_standalone" location="..\library\server\wsf\default\standalone-safe.ecf" readonly="false"/>
<library name="demo-1" location="..\library\security\openid\consumer\demo\demo-safe.ecf" readonly="false"/>
<library name="encoder" location="..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="..\library\utility\general\error\error-safe.ecf" readonly="false"/>
<library name="ewsgi" location="..\library\server\ewsgi\ewsgi-safe.ecf" readonly="false"/>