Hi guys,
I have a problem with my custom business logic.
While I’m in debug mode everything works fine, but when I switch into production something goes wrong. I don’t know what, I’m not able to identify any error, but I can’t find any new object into my table after the execution(the code simply retrieve a json, convert it into an object and store this object into a backendless table, in debug mode this works as expected).
It think the problem is related to the way I make the http call to the external host in order to retrieve the json.
The website has been already approved in the external host list.
So, what is the proper way to make an http call from a timer in java custom business logic?
This is my current code:
public static String readJsonFromUrl(String url) throws IOException {
URL website = new URL(url);
URLConnection connection = website.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null)
response.append(inputLine);
in.close();
return response.toString();
}
Thanks in advance for your answers!