小编Kam*_*mil的帖子

文件下载器中的基本访问身份验证问题

我在从我的应用程序从互联网下载二进制文件(zip文件)时遇到问题.我必须使用基本访问身份验证来授权访问文件,但服务器响应始终是HTTP/1.0 400错误请求.

String authentication = this._login+":"+this._pass;
String encoding = Base64.encodeToString(authentication.getBytes(), 0);            

String fileName = "data.zip";
URL url = new URL("http://10.0.2.2/androidapp/data.zip"); 

HttpURLConnection ucon = (HttpURLConnection) url.openConnection();

ucon.setRequestMethod("GET");
ucon.setDoOutput(true);

ucon.setRequestProperty ("Authorization", "Basic " + encoding);
ucon.connect();

/*
 * Define InputStreams to read from the URLConnection.
 */
InputStream is = ucon.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);

/*
 * Read bytes to the Buffer until there is nothing more to read(-1).
 */
ByteArrayBuffer bab = new ByteArrayBuffer(50);
int current = 0;
while ((current = …
Run Code Online (Sandbox Code Playgroud)

java android apache2

11
推荐指数
1
解决办法
1943
查看次数

从Gnome Shell扩展中调用Python代码

我在找了一段时间,但仍然找不到从GnomeShell扩展代码中调用python函数的任何书面方法。有可能这样做吗?

python gnome-shell

2
推荐指数
1
解决办法
1602
查看次数

标签 统计

android ×1

apache2 ×1

gnome-shell ×1

java ×1

python ×1