【发布时间】:2013-11-20 10:58:49
【问题描述】:
我打算在 Payload 中发送一个带有大字符串的简单 http post 请求。
到目前为止,我有以下内容。
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("address location");
String cred = "un:pw";
byte[] authEncBytes = Base64.encodeBase64(cred.getBytes());
String authStringEnc = new String(authEncBytes);
httppost.setHeader("Authorization","Basic " + authStringEnc);
但是,我不知道如何将简单的 RAW 字符串附加到有效负载中。我能找到的唯一例子是实体中的名称值对,但这不是我想要的。
有什么帮助吗?
【问题讨论】: