Page 1 of 1

WebHandler() question

Posted: Fri Dec 31, 2021 11:56 am
by rdonnay
I am using the below code to send a response back to a Web browser.
I want to use the ::httpResponse object to tell the user to wait for the query results.
This works ok except it suppresses the final HTML output which never makes it to the web browser.

If I try to use ::httpResponse:send() to send back the query results, that doesn't work either.
Apparently, it can be only used once.

Any ideas?

Code: Select all

METHOD SqlService:query( cSql )

LOCAL cParams, cHtml

cParams := '/co:ADS_1 /sq:"' + cSql + '" /ee:reply.htm'

::httpResponse:contentType := 'text/html'
::httpResponse:writeStr( 'Please wait while executing your query...' )
::httpResponse:send()

Runshell(cParams,'sqlquery.exe')

IF File('reply.htm')
  cHtml := MemoRead('reply.htm')
ELSE
  cHtml := 'Cannot run your query'
ENDIF

RETURN cHtml

Re: WebHandler() question

Posted: Mon Jan 03, 2022 1:31 am
by skiman
Hi Roger,

FIrst of all a happy and healthy 2022.

Maybe you could create an unique ID for a request and add it to the response. Afterwards you can send a new request with that ID. If the file 'reply<ID>.html' is already available, you can return it. This way you can check if the response is already available on the server.