Android :: Servlets, I'm trying to flush a stream to a servlet -


i want send input stream android servlet, dont think can see right way communicate stream in android , stream in servlet, here sample both: android method:

    private inputstream gethttpconnection(string urlstring) throws ioexception {     inputstream stream = null;     url url = new url(urlstring);     urlconnection connection = url.openconnection();      try {         httpurlconnection httpconnection = (httpurlconnection) connection;         httpconnection.setrequestmethod("get");         httpconnection.setrequestproperty("name", "thekeyword");         httpconnection.connect();          if (httpconnection.getresponsecode() == httpurlconnection.http_ok) {             stream = httpconnection.getinputstream();          }     } catch (exception ex) {         ex.printstacktrace();     }     return stream; } 

and here servlet code:

inputstream = new datainputstream(request.getinputstream());         content = request.getparameter("name");           if (content.equals("thekeyword")) {             serverresponse = "32.024851:35.877249;31.9565783:35.945695;32.0833:36.1000;31.56:35.56;";         } else {             serverresponse = "32.024851:35.877249;31.56:35.56;";         }      } catch (exception e) {         // // todo: handle exception         system.out.println(serverresponse);     }      response.getoutputstream().print(serverresponse); 

please need help.

if want send input stream can use multipart/request, in web form upload file.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -