New proxystub comming

Topics: Developer Forum
Coordinator
Dec 5, 2013 at 11:33 PM
Edited Dec 5, 2013 at 11:40 PM
Hi everyone

I have been working in a totally revamped version of proxystub.prg that will include many new options for extending AVFP functionality on the fly. New features includes:
  • A complete plugin system. Put your pluing in PRG\Plugins folder and AVFP will automatically load it and let you use it in your code (ej: <%= myPlugin.Action() %>
  • An http handler manager. This will allow to create special http handlers to process a request instead of the default MAIN.PRG handler. For example, the REST handler could now reside outside ACTIVEVFP.DLL so it can be customized as needed.
  • A garbage collector. This will automatically unload from memory any program or library you load in your code, allowing you to make changes to your code without restarting the AVFP process. All you need to take advantage of this is to use the new oAVFP object to instantiate your classes or load your libraries, ex:
oAVFP.Load("myfunclib.prg")   && If you don't include a path, AVFP will look for the file in the PRG folder
oMyObj = oAVFP.New("MyClass","MyClass.PRG")
oMyObj = oAVFP.New("MyClass")  && If a PRG is not indicated, AVFP will look for MyClass.PRG in PRG folder
  • A custom parsers manager. This will allow you to easily extend AVFP code parser (mergeScript) with your own text parsers!. Al you need is to create your parser in the PRG\Parsers folder and AVFP will automatically load and use it. For example, to convert any instance of @@NOW@@ to the current datetime, you can create a custom parser like this:
DECLARE timeStampParser AS avfpParser

 PROCEDURE Parse(pcHTML)
  pcHTML = STRT(pcHTML "@@NOW@@", TTOC(DATETIME()))
 RETURN pcHTML
ENDPROC

ENDDEFINE
  • A delegate system. This will allow you to declare an AVFP "delegate" that expose a number of events that are automatically called by proxystub. For example, to load a common library before processing any request, all you have to do is create a file called DELEGATE.PRG in the PRG folder with this code:
DEFINE delegate AS avfpDelegate

 PROCEDURE loadLibraries
   oAVFP.Load("mylib.prg")
 ENDPROC

ENDDEFINE
I think that maybe it could be a good idea to create a separate project here in codeplex to place this code so everyone can use it and contribute with it. What do you think ?


Victor Espina
Coordinator
Dec 6, 2013 at 10:07 AM
Sounds good. I guess I would prefer you stay in this project (and I can help if your work stays here) but it's up to you.

How goes the CMS with Christian?
Coordinator
Dec 6, 2013 at 1:12 PM
Edited Dec 6, 2013 at 1:13 PM
I would also like to keep all AVFP related things in one single project. I am just not clear about how we can get peoplo to download the new code and collaborate with it without generating a new AVFP release. Any ideas ?

Regarding CMS, I haven't had any news from Chrsitian and I will just begin the dynamic template engine maybe next week (using the new proxystub custom parsers engine). Once this engine is done we can consider to include it inside ACTIVEVFP.DLL or leave it as an external parser inside the distribution version of AVFP.

Regarding proxystub, last thing I want to do is to improve the error handling and notification. One of the changes I made to proxystub was to use a TRY-CATCH block for the startup and request processing tasks, but for some reason if the error occurs in a code outside ActiveVFP class, it its not catched by my TRY-CATCH but insted it get scalated to the .NET handler. I have to figure it out why this happens and how to workaround it.

I also want to use some kind of customizable templates for error notification and other AVFP internal messages.


Regards


Victor Espina
Coordinator
Dec 6, 2013 at 2:46 PM
I would also like to keep all AVFP related things in one single project. I am just not clear about how we can get peoplo to download the new code and collaborate with it without generating a new AVFP release. Any ideas ?
Victor, we can do it anyway you want. I've made you a Coordinator of this project so you are equal to me and can make decisions as to what you want to do and how, I'm totally open to a new rapid way of generating new updates without going through the "pain" of a new release each time.
Coordinator
Dec 6, 2013 at 2:59 PM
Thanks for the trust vote Claude. Let me think about it and check how codeplex works to have a better idea about the best way to handle this.

Quick question: it seems that the code for evaluating VFP code inside HTML text is duplicated in mergeScript method of ActiveVFP class and mergeText and mergeScript method of AVFPHtml class.

Is there a reason for that?

Regards

Victor Espina


Coordinator
Dec 6, 2013 at 4:46 PM
Quick question: it seems that the code for evaluating VFP code inside HTML text is duplicated in mergeScript method of ActiveVFP class and mergeText and mergeScript method of AVFPHtml class.
I'm only seeing one copy of mergescript and mergetext in the AVFPHtml class, none in the ActiveVFP class.
Coordinator
Dec 6, 2013 at 5:25 PM
My mistake. I missed the point where ActiveVFP ends and avfpHtml starts.

Thanks for your answer. I just finished a few changes to capture errors in any custom code, to handle them through the new avfpException class. This class has a Render() method that will generate an HTML with all info about the exception.

I will try to find the original error page I made for AVFP 6.03.

Regarding AVFP project in codeplex I just understand how the hole releases mechanism works. What tests do you do to be sure that a change in ACTIVEVFP.DLL wont break users websites ?


Regards

Victor Espina


Coordinator
Dec 6, 2013 at 6:09 PM
Regarding AVFP project in codeplex I just understand how the hole releases mechanism works. What tests do you do to be sure that a change in ACTIVEVFP.DLL wont break users websites ?
I do the basic test in all the browsers and most popular smart phones using the demo apps in the latest version (which includes most of the demos from the previous versions). Beyond that, it's up to the end-user to test just as it is with each new version of PHP or WordPress when their users install new versions.
Coordinator
Dec 11, 2013 at 12:56 PM
Hi everyone. I just uploaded the new version of activevvfp.dll and an updated version of default.avfp explaining all new features contained in this new version. You can check it out here:

http://www.victorespina.com.ve/avfpsb/

In the following days I will make public all the source code.

Victor Espina
Coordinator
Dec 13, 2013 at 11:27 AM
For those interested, you can download the new sources from here:
http://cl.ly/0N3i2y3V030K

Once they get tested I will upload them to the main project.