'Handler class
Sub Class_Globals
Private c3po As AWTRobot
Private oFTP As FTP
End Sub
Public Sub Initialize
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
Try
Dim strFileName As String = "screenshot-" & DateTime.Now & ".png"
Dim strCurDir As String = "./" 'this default to the objects dir of your java app or jar file
'Capture current monitor screen
c3po.ScreenCurrentRectangleSetAsRightScreen '<- needed since I have multiple monitors
c3po.ScreenCaptureToFile(strFileName)
Log( File.Exists(strCurDir,strFileName) )
'FTP File to server
Dim ctm As CustomTrustManager
ctm.InitializeAcceptAll
oFTP.Initialize("FTP", "ftp.YourDomain.com", 21, "YourUserHere", "YourPasswordHere")
oFTP.PassiveMode = True
oFTP.UseSSLExplicit = True
oFTP.SetCustomSSLTrustManager(ctm)
oFTP.UploadFile(strCurDir, strFileName, False, "/YourSubDirectory/" & strFileName )
resp.Write("screen shot saved - " & DateUtils.TicksToString(DateTime.Now) )
Catch
resp.SendError(500, LastException.Message)
End Try
End Sub