[fpc-pascal] Troubles with SQLDBRESTBridge
Michael Van Canneyt
michael at freepascal.org
Mon Jun 24 09:30:28 CEST 2019
On Sun, 23 Jun 2019, Sven Barth via fpc-pascal wrote:
>>>>> - localhost:8080/metadata works
>>>>> - localhost:8080/users returns "INVALID RESOURCE"
>>>>
>>>> Because it has rdoConnectionInURL set, and so you must do
>>>> localhost:8080/expenses/users
>>>
>>> Ahhhhhh! Hadn't seen that this option is active... Okay, then it
>>> indeed works as expected, both with and without rdoConnectionInURL.
>>>
>>> By the way: I noticed a slight annoyance, but I don't know whether
>>> one can really do something about that: When I set rdoConnectionInURL
>>> to False inside the object inspector it turns on again, because
>>> rdoConnectionResource is set. Took me a moment to look at the source
>>> code to see that I need to disable rdoConnectionResource first. Don't
>>> know what a better solution would be...
>>
>> Funny you mention this, I was fooled myself yesterday, I also had to
>> look in
>> the sources :(
>>
>> One way would be to disable rdoConnectionResource if you disable
>> rdoConnectionInURL. I will add this.
>
> But wouldn't that lead to an analogous problem with
> rdoConnectionResource if rdoConnectionInURL is not set?
I fixed this: if you disable rdoConnectionInURL, rdoConnectionResource is
disabled. If not, if rdoConnectionResource is included, rdoConnectionInURL
will be set too.
I also fixed the use in a module. The module will set 'active' to false on
the dispatcher. Before handling the request, it takes the request and uses
pathinfo to set the routing parameters
With the sample module, I tested all possible cases:
No rdoConnectionInURL:
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/users --content-on-error -O - -d --auth-no-challenge
rdoConnectionInURL set:
Basepath empty:
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/expenses/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/expenses/users --content-on-error -O - -d --auth-no-challenge
BasePath set to Lola
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/Lola/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/Lola/expenses/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/Lola/expenses/users --content-on-error -O - -d --auth-no-challenge
BasePath set to Lola/Pola
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/Lola/Pola/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/Lola/Pola/expenses/metadata --content-on-error -O - -d --auth-no-challenge
wget --auth-no-challenge --http-user=me --http-password=secret http://localhost:8080/REST/Lola/Pola/expenses/users --content-on-error -O - -d --auth-no-challenge
I think I covered all cases. If I forgot one, do let me know...
I will update the Wiki.
Michael.
More information about the fpc-pascal
mailing list