I am new to this kind of coding where in I have to send a collection of String i.e., List from a Spring controller of different web app. So my questions are
How should I return the Response which consists of List from a controller? Does the below code works fine? Below is my controller code where I will be returning
List<String>
.@RequestMapping(value = "getMyBookingsXmlList", method = RequestMethod.GET) public @ResponseBody List<String> getMyBookingsXmlList() { return mbXmlImpl.getMyBookingsDetailsXmlList(); }
In the client side how should I have to retrieve the
List<String>
which was sent from the above controller method ? Below is the code which I am trying to do but I have no clue as of how to do.HttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("URL"); HttpResponse httpResponse = httpclient.execute(httpGet); InputStream is = httpResponse.getEntity().getContent(); StringBuffer buffer = new StringBuffer(); byte [] b = new byte [1024]; for (int n ; (n = is.read(b)) != -1 ;) buffer.append(new String(b, 0, n));
After this I don't have a clue what to do....