Hello,
I need to pass a ServletResponse object as a Tag in an HttpJob, but I'm not sure how to cast the Tag back to a ServletResponse. Current I'm getting an error saying method SendString not found.
I need to pass a ServletResponse object as a Tag in an HttpJob, but I'm not sure how to cast the Tag back to a ServletResponse. Current I'm getting an error saying method SendString not found.
B4X:
Sub Process_Globals
Private SRV As HttpServer
End Sub
Sub Service_Create
SRV.Initialize("SRV")
SRV.Start(8282)
Log("HTTP Server started on port 8282")
End Sub
Sub SRV_HandleRequest(Request As ServletRequest, Response As ServletResponse)
Log(Request.Method)
Log(Request.RequestURI)
Dim j As HttpJob
j.Initialize("HttpJob", Me)
If Request.Method = "GET" Then
j.Tag = Response
j.Download("http://8.8.8.8.8:8282/" & Request.RequestURI)
End If
End Sub
Sub JobDone(Job As HttpJob)
Dim Response As ServletResponse = Job.Tag
Response.SendString(Job.GetString) ` THIS IS WERE I'M GETTING THE ERROR
End Sub