#1 2019-01-30 12:35:42

egold2005
Member
Registered: 2019-01-28
Posts: 16

Overriding TSQLHttpServer.Request method

Hello,

I am about to create a kind of proxy-service for a number of internal REST services, so this proxy would act as single entry point.

I determined i have to override TSQLHttpServer.Request method for that, is this approach feasible?

If so, i would need a client-side component to make a request to internal REST services and return the results to the caller.

Is there such a component in the framework? Any advice and sample code are greatly appreciated.

Thanx,
Eugene.

Offline

#2 2019-01-30 18:48:55

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

Re: Overriding TSQLHttpServer.Request method

I would rather combine the proxy at TSQLRestServer.URI level, not at HTTP level.

Offline

#3 2019-01-31 10:16:59

egold2005
Member
Registered: 2019-01-28
Posts: 16

Re: Overriding TSQLHttpServer.Request method

ab wrote:

I would rather combine the proxy at TSQLRestServer.URI level, not at HTTP level.

As i said i am completely new to the framework, so this says nothing to me actually...

Why would i better do it this way? What methods should i override etc?

Thanks.

Offline

#4 2019-01-31 10:54:35

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

Re: Overriding TSQLHttpServer.Request method

If you start from a shared /root/... URI, you can override TSQLRestServer.URI, or just define method-based services to do the redirect for the whole Ctxt.

If you want to handle several /root1/... /root2/.. and so on, then TSQLHttpServer.Request is where to override.

Offline

#5 2019-01-31 12:03:00

egold2005
Member
Registered: 2019-01-28
Posts: 16

Re: Overriding TSQLHttpServer.Request method

ab wrote:

If you want to handle several /root1/... /root2/.. and so on, then TSQLHttpServer.Request is where to override.

This is exactly what i need and seems like i figured it out correctly.

I am using internal THttpClientSocket to communicate to end points. What is the proper flow of methods when working with it, should i call .Open first?

Basically i am trying to get the following code working in Request

    result := FClient.Get(vURL);
    Ctxt.OutContent := FClient.Content;
    Ctxt.OutContentType := FClient.ContentType;

But this is for GET method, should i use similar structures for others?

When i connect to end point in browser it opens up auth dialog so i can supply username/password.

Are these being usually handled in PUT? Sorry this is not essentially a framework questions, but rather HTTP-related in general....

Thanx alot.

Offline

Board footer

Powered by FluxBB