在Android设备上使用HTTP POST将在谷歌应用程序引擎的BLOB数据存储 [英] Using HTTP Post on an android device to put data on google app engine's blob store

查看:99
本文介绍了在Android设备上使用HTTP POST将在谷歌应用程序引擎的BLOB数据存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想张贴在谷歌的App Engine数据到BLOB存储,这code运行没有抛出任何异常,但在Blob存储区到底有没有登录POST请求的。当我发布使用表单服务器端的东西的作品(虽然MIME数据)。我已经让我的Andr​​oid应用程序使用互联网。这是一个在黑暗中刺,但如果你们中的任何人可能之前也许我有可能打铃的问题有过这样的问题!

 公共无效sendVideo()抛出IOException
  //创建一个新的HttpClient和邮政头
  HttpClient的HttpClient的=新DefaultHttpClient();
  HttpPost httpPost =新HttpPost(http://www.theurliampostingto.com/au813rsadjfaruh);
  //添加数据
  清单<&的NameValuePair GT;对=新的ArrayList<&的NameValuePair GT;();
  pairs.add(新BasicNameValuePair(KEY1,值1));
  pairs.add(新BasicNameValuePair(KEY2,值2));
  httpPost.setEntity(新UrlEn codedFormEntity(对));
  //执行HTTP POST请求
  HTT presponse响应= httpclient.execute(httpPost);
 }


解决方案

您可以尝试拦截仿真器和服务器,即使用Wireshark之​​间的交通,看看服务器响应您的要求的。
您code看起来对我好。

I am trying to post data to the Blob Store on google's app engine, this code runs without throwing any exceptions, but on the blobstore end there is no log on the post request at all. The server side stuff works when i post using a form (albeit with mime data). I have allowed my android app to use internet. This is a stab in the dark but if any of you folks might have had an issue like this before perhaps the problem i am having might ring a bell!

public void sendVideo() throws IOException {
  // Create a new HttpClient and Post Header
  HttpClient httpclient = new DefaultHttpClient();
  HttpPost httpPost = new HttpPost("http://www.theurliampostingto.com/au813rsadjfaruh);
  // Add your data
  List<NameValuePair> pairs = new ArrayList<NameValuePair>();
  pairs.add(new BasicNameValuePair("key1", "value1"));
  pairs.add(new BasicNameValuePair("key2", "value2"));
  httpPost.setEntity(new UrlEncodedFormEntity(pairs));
  // Execute HTTP Post Request
  HttpResponse response = httpclient.execute(httpPost);
 }

解决方案

You can try to intercept the traffic between the emulator and the server i.e. with WireShark to see if the server is responding to your request at all. Your code looks good for me.

这篇关于在Android设备上使用HTTP POST将在谷歌应用程序引擎的BLOB数据存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆