android - IOUtils writer error Java connect to GAE -


i import writer apache. error occured when try using it.

in url.

enter image description here

i following on link: store image blobstore android client , retrieve blobkey , upload url store in datastore. - gae

does know error?

updated

here full code:

import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem;  import com.google.api.client.util.ioutils;  import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.entity.contenttype; import org.apache.http.entity.mime.multipartentitybuilder; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.util.entityutils; import org.json.jsonexception; import org.json.jsonobject;  import java.io.file; import java.io.ioexception; import java.io.inputstream; import java.io.stringwriter;   public class getbloburltask extends actionbaractivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_get_blob_url_task); } @override protected void doinbackground(void... arg0){      httpclient httpclient = new defaulthttpclient();     //this invoke "imgupload servlet                httpget httpget = new httpget("http://put_your_url_here/bloburlget");     httpresponse response;     try {         response = httpclient.execute(httpget);         httpentity urlentity = response.getentity();         inputstream in = urlentity.getcontent();         string str = "";         stringwriter writer = new stringwriter();         string encoding = "utf-8";         ioutils.copy(in, writer, encoding);         str = writer.tostring();         httppost httppost = new httppost(str);         file f = new file(picturepath);         multipartentitybuilder reqentity = multipartentitybuilder.create();         reqentity.addbinarybody("photo", f, contenttype.create("image/jpeg"), "foto2.jpg");         httppost.setentity(reqentity.build());         response = httpclient.execute(httppost); //here "uploaded" servlet automatically       invoked         str = entityutils.tostring(response.getentity());         jsonobject resultjson = new jsonobject(str);         blobkey = resultjson.getstring("blobkey");         servingurl = resultjson.getstring("servingurl");      } catch (clientprotocolexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (jsonexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      return null;  }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.menu_get_blob_url_task, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();      //noinspection simplifiableifstatement     if (id == r.id.action_settings) {         return true;     }      return super.onoptionsitemselected(item); } 

}

my guess person in example using ioutils apache commons , using different ioutils provided google http client


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -