本文整理汇总了Java中net.bither.bitherj.api.http.HttpSetting类的典型用法代码示例。如果您正苦于以下问题:Java HttpSetting类的具体用法?Java HttpSetting怎么用?Java HttpSetting使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpSetting类属于net.bither.bitherj.api.http包,在下文中一共展示了HttpSetting类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setResult
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
@Override
public void setResult(String response) throws Exception {
JSONObject json = new JSONObject(response);
this.result = new ArrayList<HDMAddress.Pubs>();
List<byte[]> pubHots = new ArrayList<byte[]>();
List<byte[]> pubColds = new ArrayList<byte[]>();
List<byte[]> pubService = new ArrayList<byte[]>();
if (!json.isNull(HttpSetting.PUB_HOT)) {
String pubHotString = json.getString(HttpSetting.PUB_HOT);
pubHots = Utils.decodeServiceResult(pubHotString);
}
if (!json.isNull(HttpSetting.PUB_COLD)) {
String pubColdString = json.getString(HttpSetting.PUB_COLD);
pubColds = Utils.decodeServiceResult(pubColdString);
}
if (!json.isNull(HttpSetting.PUB_SERVER)) {
String pubServiceString = json.getString(HttpSetting.PUB_SERVER);
pubService = Utils.decodeServiceResult(pubServiceString);
}
for (int i = 0; i < pubHots.size(); i++) {
HDMAddress.Pubs pubs = new HDMAddress.Pubs(pubHots.get(i), pubColds.get(i), pubService.get(i), i);
this.result.add(pubs);
}
}
示例2: getHDMHttpExceptionMessage
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
public static final String getHDMHttpExceptionMessage(int code) {
switch (code) {
case HttpSetting.HDMBIdIsAlready:
return LocaliserUtils.getString("hdm_exception_bid_already_exists");
case HttpSetting.MessageSignatureIsWrong:
return LocaliserUtils.getString("hdm_keychain_add_sign_server_qr_code_error");
default:
return LocaliserUtils.getString("network_or_connection_error");
}
}
示例3: getHDMHttpExceptionMessage
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
public static final int getHDMHttpExceptionMessage(int code) {
switch (code) {
case HttpSetting.HDMBIdIsAlready:
return R.string.hdm_exception_bid_already_exists;
case HttpSetting.MessageSignatureIsWrong:
return R.string.hdm_keychain_add_sign_server_qr_code_error;
default:
return R.string.network_or_connection_error;
}
}
示例4: getParams
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
@Override
public Map<String, String> getParams() throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put(HttpSetting.PASSWORD, Utils.base64Encode(this.password));
params.put(HttpSetting.SIGNATURE, Utils.base64Encode(this.signature));
params.put(HttpSetting.HOT_ADDRESS, this.hotAddress);
return params;
}
示例5: setResult
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
@Override
public void setResult(String response) throws Exception {
this.result = false;
JSONObject json = new JSONObject(response);
if (!json.isNull(HttpSetting.RESULT)) {
this.result = Utils.compareString(json.getString(HttpSetting.RESULT)
, HttpSetting.STATUS_OK);
}
}
示例6: getParams
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
@Override
public Map<String, String> getParams() throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put(HttpSetting.PASSWORD, Utils.base64Encode(this.password));
params.put(HttpSetting.PUB_HOT, this.pubHot);
params.put(HttpSetting.PUB_COLD, this.pubCold);
params.put(HttpSetting.START, Integer.toString(this.start));
params.put(HttpSetting.END, Integer.toString(this.end));
return params;
}
示例7: getParams
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
@Override
public Map<String, String> getParams() throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put(HttpSetting.PASSWORD, Utils.base64Encode(this.password));
params.put(HttpSetting.SIGNATURE, Utils.base64Encode(this.signature));
return params;
}
示例8: getParams
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
@Override
public Map<String, String> getParams() throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put(HttpSetting.PASSWORD, Utils.base64Encode(password));
params.put(HttpSetting.UNSIGN, Utils.encodeBytesForService(unSigns));
return params;
}
示例9: doPost
import net.bither.bitherj.api.http.HttpSetting; //导入依赖的package包/类
public static String doPost(String reqUrl, Map parameters) throws Exception {
HttpsURLConnection url_con = null;
String responseContent = null;
try {
StringBuffer params = new StringBuffer();
for (Iterator iter = parameters.entrySet().iterator();
iter.hasNext(); ) {
Map.Entry element = (Map.Entry) iter.next();
params.append(element.getKey().toString());
params.append("=");
params.append(URLEncoder.encode(element.getValue().toString(),
HttpSetting.REQUEST_ENCODING));
params.append("&");
}
if (params.length() > 0) {
params = params.deleteCharAt(params.length() - 1);
}
URL url = new URL(reqUrl);
url_con = (HttpsURLConnection) url.openConnection();
url_con.setRequestMethod("POST");
System.setProperty("sun.net.client.defaultConnectTimeout",
String.valueOf(HttpSetting.HTTP_CONNECTION_TIMEOUT));
System.setProperty("sun.net.client.defaultReadTimeout",
String.valueOf(HttpSetting.HTTP_SO_TIMEOUT));
url_con.setDoOutput(true);
byte[] b = params.toString().getBytes();
url_con.getOutputStream().write(b, 0, b.length);
url_con.getOutputStream().flush();
url_con.getOutputStream().close();
InputStream in = url_con.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(in,
HttpSetting.REQUEST_ENCODING));
String tempLine = rd.readLine();
StringBuffer tempStr = new StringBuffer();
String crlf = System.getProperty("line.separator");
while (tempLine != null) {
tempStr.append(tempLine);
tempStr.append(crlf);
tempLine = rd.readLine();
}
responseContent = tempStr.toString();
rd.close();
in.close();
} catch (IOException e) {
e.printStackTrace();
throw e;
} finally {
if (url_con != null) {
url_con.disconnect();
}
}
return responseContent;
}