In my application a user will preform a HTTPrequest to retrieve data from the server.
At the moment on the server side, i preform a database select statement and then use the ResultSetDynaBean to retrieve each row and convert to an object and store in an ArrayList. this all works fine.
ArrayList<ParkingSpot> spotsList
I then convert eachobject to a JSON string using google GSON library
ArrayList<String> jsonStrings = new ArrayList<String>();
Gson gson = new Gson();
for (ParkingSpot ps : spotsList) {
String json = gson.toJson(ps);
jsonStrings.add(json);
}
Each json string looks like this
{"address":"York Road","zone":"Green","startTime":7.0,"endTime":24.0,"timeAdded":"Jun 16, 2011 11:53:27 AM","psId":898}
there can be up to 1000 of the above strings that i need to send
As you can see i add each to a String ArrayList. i do not think this is correct.
How should i go about sending the information to an android phone.
From the GSON library i can call the below on the android phone
Spot spot = gson.fromJson(jsonString, Spot.class);
System.out.println(spot);
But i do not know how retrieve the jsonString from the response of my Servlet(i also do not know how to set it on the servlet side either)