Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending info back from a connection.  RSS feed

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got some simple code that I use to make a call to a url and it sends me back 3 peices of information. I would like a painful and easy way to identify the info.
Here is my code:
urlConnection = (HttpURLConnection)url.openConnection();
urlConnection.setRequestMethod("POST");
urlConnection.connect();
BufferedReader is = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
**********************
I guess one way is to send it back as xml, but what are some other options? Those 3 peices are data are bascially 2 strings and a int.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • Two strings and an int, each on a line by itself?
  • urlencoded data (name1=value1&name2=value2&name3=value3, with suitable escaping)


  • Neither of these are painful, as you requested, but perhaps you could just sit on a tack.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!