json - Getting java.io.IOException: Error writing to server at getInputStream -


if temp string large java.io.ioexception: error writing server @ getinputstream

string tmp  = js.deepserialize(taskex); url url = new url("http://"                     + "localhost"                     + ":"                     + "8080"                     + "/myproject/testservletupdated?command=starttask&taskeid=" +taskid + "'&jsoninput={\"result\":"                     + urlencoder.encode(tmp) + "}");                       urlconnection conn = url.openconnection();                      inputstream = conn.getinputstream(); 

why that? call goes servlet mentioned in url.

i think might have "too long url", maximum number of characters 2000 (see post more info). requests not made handle such long data input.

you can, if can change servlet code also, change post instead of request (as have today). client code pretty simular:

public static void main(string[] args) throws ioexception {      url url = new url("http", "localhost:8080", "/myproject/testservletupdated");      urlconnection conn = url.openconnection();     conn.setdooutput(true);      outputstreamwriter wr = new outputstreamwriter(conn.getoutputstream());     wr.write("command=starttask" +              "&taskeid=" +taskid +              "&jsoninput={\"result\":" + urlencoder.encode(tmp) + "}");     wr.flush();       .... handle answer ... } 

i didn't see first seems have single quote character in request string.

...sk&taskeid=" + taskid + "'&jso.....                             ^ 

try removing it, might you!


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -