Unzip the attached file into your \exp20\samples\web20 folder but first delete all files that are already in that folder. Also, delete \exp20\samples\web and \exp20\cxp folders. These should have been cleaned up with the build 261 release.
CxpHttpServer.Exe is a Web Server that utilizes the HttpEndPoint() and WebHandler() classes of Xbase++ 2.0.
This is a simple but powerful framework for a Web Server that can be used for almost any purpose.
No other web server is required. No IIS or Apache.
It will handle all file types that are normally handled by any web server and in addition it will compile .CXP pages.
The default port is 8080 in this sample.
To test any of the methods, start your web browser and enter the following URLs:
Code: Select all
http://localhost:8080/index.html
http://localhost:8080/test/gettime
http://localhost:8080/test/echovars?a=1,b=2,c=3
Code: Select all
http://localhost:8080/test/crash
Example:
Code: Select all
CLASS Test FROM CustomWebHandler
EXPORTED:
INLINE METHOD getTime
LOCAL cThreadId, cResponse := ""
cThreadId := AllTrim(Str(ThreadId()))
cResponse += "<!DOCTYPE html>"
cResponse += "<html>"
cResponse += "<head><title>"+ProcName()+"</title></head>"
cResponse += "<body>"
cResponse += "<h1>Current Time:</h1>"
cResponse += "<p>"+Time()+" (HH:MM:SS)</p>"
cResponse += "<small>By thread: "+cThreadId+"</small>"
cResponse += "</body>"
cResponse += "</html>"
RETURN cResponse
ENDCLASS
* =======================
EmailVerify is a program written for Bobby Drakos that is used to verify that the Medallion system has a correct email address for each driver.
This service sends an email to the address on file for each driver. If the driver receives the email he will click on the URL in the email to completethe verification.
AddEMail
This method sends the email and writes the driver hack number, email address, date/time and PENDING status to MNEVN.DBF.
VerifyEmail
This method is called when the driver clicks on the URL in the received email. The driver has 24 hours to verify the email or he will receive a response to call the office. The verification updates the status in MNEVN.DBF and writes VERIFIED status to MNEVN.DBF
CleanUp
This method will delete all records in MNEVN.DBF that have a status of DENIED and are older than 24 hours. It will also send an email to the Transit office for each DENIED record stating that the address could not be verified.
Usage
The Medallion program would simply send a URL to localhost to start the verification process.
Example:
DC_SpawnUrl("http://localhost:8080/VerifyEmail/AddEm ... garage.com")