2
Vote

fixes for resthelper + 1 improve

description

I found a few lines in resthelper.prg that I think are causing the bugs described in the thread:
https://activevfp.codeplex.com/discussions/461198

In summary cotrollers and action names are not seached using an "exact" match.

Lines in question are 98 , 138 ,139 Controllers names exact match.
(lines 154 , 200) Actions names exact match and replace actions from being the first parameter
( I leave all the old ones commented for reference)

Also added an improvement ( line 90) to skip extensioned pages from be searched as it were controller files, this could acelerate 'some' the load of every not restful requests i.e default.avfp or default.avfp?debug=on.
now it checks only the first two chunks of "SCRIPT_NAME", to avoid the issue:
https://activevfp.codeplex.com/workitem/34577
but yo can make your own, or use the original if not your case.

Limitations

one -- a restful prg file should not contain a dot in last 5 positions or will not be considered a controller and skiped . i.e. custo.mers.prg ( very rare I think)

anyway ( as su-folders are not implemented) a dot can be used in any other position to distinguish groups of controllers but a different character is recomended i.e. app1-customers.prg instead of app1.customers.prg ( both valid) .

Extensioned pages longer than 4 positions can be used, but would be searched in contollers folder first( normal behaviour before applying current patch).

Pending enhancements

1) use sub-directories to store controllers
2) a better error description when a restful call is invalid


Update: Please check this thread, about the use of dots:
https://activevfp.codeplex.com/discussions/462725

Update2: New file fixing the examples with default action ( lines 182-217 ) because action is not the first parameter now. (also replaced line 90 with the last suggested in thread above to maintain 'dots' ussage. )

file attachments

comments