WebHandler() question

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

WebHandler() question

#1 Post 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
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: WebHandler() question

#2 Post 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.
Best regards,

Chris.
www.aboservice.be

Post Reply