当前位置: 首页>>代码示例>>Java>>正文


Java HttpSetting类代码示例

本文整理汇总了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);
    }

}
 
开发者ID:bither,项目名称:bitherj,代码行数:27,代码来源:RecoveryHDMApi.java

示例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");
    }
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:11,代码来源:ExceptionUtil.java

示例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;
    }
}
 
开发者ID:bither,项目名称:bither-android,代码行数:11,代码来源:ExceptionUtil.java

示例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;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:9,代码来源:UploadHDMBidApi.java

示例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);
    }

}
 
开发者ID:bither,项目名称:bitherj,代码行数:11,代码来源:UploadHDMBidApi.java

示例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;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:11,代码来源:CreateHDMAddressApi.java

示例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;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:8,代码来源:RecoveryHDMApi.java

示例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;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:8,代码来源:SignatureHDMApi.java

示例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;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:58,代码来源:ConnectHttps.java


注:本文中的net.bither.bitherj.api.http.HttpSetting类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。