如何通过Apache的HttpClient的CouchDB中设置管理员(给予卷曲的例子) [英] How to setup administrators in Couchdb via Apache's HttpClient (given a curl example)

查看:349
本文介绍了如何通过Apache的HttpClient的CouchDB中设置管理员(给予卷曲的例子)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我对CouchDB的桂工具箱工作更容易在Android上维持一个建立CouchDB的,因为被褥是一个小型移动设备上相当不舒服。

我要坚持org.apache.http.client。*这个包正在工作的结果很不错,直到我想设置管理员..

使用命令行工具卷曲它就像一个魅力:

 卷曲-X PUT http://127.0.0.1:5984/_config/admins/username -d密码

但我一直在有翻译,为了一个org.apache.http.client.methods.HttpPut()方法大问题。

任何帮助AP preciated。


解决方案

  DefaultHttpClient客户端=新DefaultHttpClient();HttpPut提出=新HttpPut(http://127.0.0.1:5984/_config/admins/username);
put.setEntity(新StringEntity(\\密码\\));
client.execute(放);

So I am working on a CouchDB Gui Toolbox for easier maintaining an setting up CouchDB on Android, as Futon is quite uncomfortable on a small mobile device.

I wanted to stick to the "org.apache.http.client.*" packages for this which was working out quite well until I wanted to setup administrators..

With the commandline tool "curl" it works like a charm:

curl -X PUT http://127.0.0.1:5984/_config/admins/username -d '"password"'

But I keep on having big problems translating that to a "org.apache.http.client.methods.HttpPut()" method.

Any help appreciated.

解决方案

DefaultHttpClient client = new DefaultHttpClient();

HttpPut put = new HttpPut("http://127.0.0.1:5984/_config/admins/username");
put.setEntity(new StringEntity("\"password\""));
client.execute(put);

这篇关于如何通过Apache的HttpClient的CouchDB中设置管理员(给予卷曲的例子)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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