java - Many JSON request in same connection -


i need execute more 1 json request, can't close current connection

example code:

private string[] test(url url, final url url2) throws ioexception {     string[] test = new string[2];     urlconnection openconnection = url.openconnection();     test[0] = this.formatjson(openconnection.getinputstream());     url = url2;     test[1] = this.formatjson(openconnection.getinputstream());      return test; } 

or

private string[] test(url url, final url url2) throws ioexception {     string[] test = new string[2];     urlconnection openconnection = url.openconnection();     test[0] = this.formatjson(openconnection.getinputstream());     url.setnewurl(url2);     test[1] = this.formatjson(openconnection.getinputstream());      return test; } 

any options?

solved it!

to execute more 1 json request in same session need save cookies first , use him others.

this link helped me http://www.hccp.org/java-net-cookie-how-to.htm


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -