echo example
Posted: Mon Apr 20, 2015 11:41 pm
Hi Roger,
I want in your test Test:Echo example save and then show e.g. all previously passed strings and time when it was called.
But when I call this modified example in webbrowser,
next error is saved in error.log file:
= Donnay Software Web Server Error ==========
Date: 20150421, Time: 08:16:16
App: c:\exp20\Samples\Web20\CxpHttpServer.EXE, Thread: 4
ERROR BASE/2266
Receiver of message is not an object.: Form
Called from WEBHANDLER:EXECUTE(149)
Called from CUSTOMWEBHANDLER:EXECUTE(157)
Called from WEBHANDLERPROCESSOR:RUN(260)
Called from ABSTRACTHOSTADAPTOR:RUN(204)
Called from WEBJOB:EXECUTEWEBREQUEST(562)
Called from WEBJOB:EXECUTEHTTP(505)
Called from WEBJOB:EXECUTE(461)
Where is problem? Please, can you correct my code?
TIA & Regards
Zdeno
I want in your test Test:Echo example save and then show e.g. all previously passed strings and time when it was called.
But when I call this modified example in webbrowser,
next error is saved in error.log file:
= Donnay Software Web Server Error ==========
Date: 20150421, Time: 08:16:16
App: c:\exp20\Samples\Web20\CxpHttpServer.EXE, Thread: 4
ERROR BASE/2266
Receiver of message is not an object.: Form
Called from WEBHANDLER:EXECUTE(149)
Called from CUSTOMWEBHANDLER:EXECUTE(157)
Called from WEBHANDLERPROCESSOR:RUN(260)
Called from ABSTRACTHOSTADAPTOR:RUN(204)
Called from WEBJOB:EXECUTEWEBREQUEST(562)
Called from WEBJOB:EXECUTEHTTP(505)
Called from WEBJOB:EXECUTE(461)
Where is problem? Please, can you correct my code?
TIA & Regards
Zdeno
Code: Select all
#INCLUDE "dcdialog.CH"
#define CRLF Chr(13)+Chr(10)
CLASS Test FROM CustomWebHandler
EXPORTED:
VAR aTime
VAR aString
VAR nCount
METHOD /*init,*/ echo, getTime, echoVars, crash
* --------
INLINE METHOD init
* METHOD Test:init
/*
LOCAL aVars, i
aVars := ::classdescribe()[3]
FOR i := 1 TO Len(aVars)
::&(aVars[i,1]) := ''
NEXT
*/
::aTime := {}
::aString := {}
::nCount := 0
*
RETURN self
* ---------
ENDCLASS
*
METHOD Test:echo( cParamName1 )
LOCAL cHtml := ""
::setErrorBlock()
AAdd( ::aTime, Time() )
::nCount ++
cHtml += "<html><title>Donnay:echo() was called</title><body>"
cHtml += '<pre>'
* cHtml += "Parameter cParamName1 is " + cParamName1 + CRLF
cHtml += 'Pcount is: ' + Alltrim(Str(Pcount())) + CRLF
cHtml += 'Query String is: ' + ::httpRequest:getQueryString() + CRLF
*
cHtml += 'aTime: ' + Var2Char( ::nCount ) + ' - ' + Var2Char( ::aTime ) + ' - ' + Var2Char( ::httpRequest:getQueryString() ) + '</br>'+ CRLF
*
cHtml += "</pre></body></html>"
RETURN cHtml