Currently, I am using NSURLSession and HTTPPost method to upload data to Java servlet. The java servlet will parse the data received and update it into database.
let dataTest:NSData = dao.readStringFromDb().data
let request = NSMutableURLRequest(URL: NSURL(string: urlSubmit)!)
request.HTTPMethod = "POST"
request.addValue("multipart/form-data", forHTTPHeaderField: "Accept")
request.HTTPBody = dataTest
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in
print("Response: \(response)")})
task.resume()
}
During update process (in Java), different status flags are updated into DB based on different conditions. Now, my requirement is to get that status returned from the web server and show locally.
I am aware that I can use HTTPGet method again, pass the key value and get the status flag.
I am trying to explore if there are any callback handlers available to use with java servlets like the one available in javascript.
Any suggestions would be highly helpful.
Regards.