Only send changes back to client
This commit is contained in:
@@ -25,27 +25,27 @@ feature -- Access
|
||||
feature
|
||||
|
||||
initialize_controls
|
||||
-- Initalize all the controls, all the event handles must be set in this function.
|
||||
-- Initalize all the controls, all the event handles must be set in this function.
|
||||
deferred
|
||||
ensure
|
||||
attached control
|
||||
end
|
||||
|
||||
process
|
||||
-- Function called on page load (not on callback)
|
||||
-- Function called on page load (not on callback)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
execute
|
||||
-- Entry Point: If request is a callback, restore control states and execute handle then return new state json.
|
||||
-- If request is not a callback. Run process and render the html page
|
||||
-- Entry Point: If request is a callback, restore control states and execute handle then return new state json.
|
||||
-- If request is not a callback. Run process and render the html page
|
||||
local
|
||||
event: detachable STRING
|
||||
control_name: detachable STRING
|
||||
states: detachable STRING
|
||||
new_states: JSON_OBJECT
|
||||
states_changes: JSON_OBJECT
|
||||
json_parser: JSON_PARSER
|
||||
do
|
||||
control_name := get_parameter ("control_name")
|
||||
@@ -57,10 +57,10 @@ feature
|
||||
control.load_state (sp)
|
||||
end
|
||||
control.handle_callback (control_name, event)
|
||||
create new_states.make
|
||||
control.read_state (new_states)
|
||||
create states_changes.make
|
||||
control.read_state_changes (states_changes)
|
||||
response.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "application/json"]>>)
|
||||
response.put_string (new_states.representation)
|
||||
response.put_string (states_changes.representation)
|
||||
else
|
||||
process
|
||||
render
|
||||
@@ -68,7 +68,7 @@ feature
|
||||
end
|
||||
|
||||
render
|
||||
-- Render and send the HTML Page
|
||||
-- Render and send the HTML Page
|
||||
local
|
||||
data: STRING
|
||||
page: WSF_PAGE_RESPONSE
|
||||
@@ -92,13 +92,13 @@ feature
|
||||
end
|
||||
|
||||
get_parameter (key: STRING): detachable STRING
|
||||
-- Read query parameter as string
|
||||
-- Read query parameter as string
|
||||
local
|
||||
value: detachable WSF_VALUE
|
||||
do
|
||||
Result := VOID
|
||||
value := request.query_parameter (key)
|
||||
if attached value and then value.is_string then
|
||||
if attached value and then value.is_string then
|
||||
Result := value.as_string.value
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user