#1 2014-09-07 17:03:43

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Can THttpServer.OnRequest() access the GUI?

Hi Arnaud,

With TSQLRestFullMemory, can can configure the methods to run in the main thread,

but with THttpServer, it's not clear to me, is THttpServer.OnRequest() by default runs in the main thread? Because in that method I need to access the GUI.

thanks.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2014-09-07 17:53:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Can THttpServer.OnRequest() access the GUI?

No, THTTPServer runs in one of the thread of the thread pool.

Our TSQLRestServer classes handle tuned threading, not the low level THTTPServer.

Why are you using THTTPServer directly?
There is much more features in TSQLRestServer, and its overhead is very slight. Nothing noticeable in practice, when compare to the network bandwidth and the IP processing on server.

Following the single responsibility principle, we use THTTPServer to serve HTTP, not to do all the features possible.

Offline

#3 2014-09-08 03:24:21

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Can THttpServer.OnRequest() access the GUI?

Arnaud,

Update 1: Looks like example 22 - "JavaScript HTTPApi web server" can just server the static files perfectly, I should go from there! I check it out in depth.

---------------------------------------------------------------
I'm planning to use THTTPServer in LIVEditor, which is a live html and css editor  I mentioned earlier.

It's going to be a standard HTTP server - when the files the web browser requests are not loaded into the code editor yet, it just like a standard http server, but if the files are loaded into the code editor, it will return the real-time html/css content from the code editor.

I hope I explained my requirement clearly here smile

Last edited by edwinsn (2014-09-08 16:05:40)


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB