當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestBuilderBase類代碼示例

本文整理匯總了Java中com.ning.http.client.RequestBuilderBase的典型用法代碼示例。如果您正苦於以下問題:Java RequestBuilderBase類的具體用法?Java RequestBuilderBase怎麽用?Java RequestBuilderBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RequestBuilderBase類屬於com.ning.http.client包,在下文中一共展示了RequestBuilderBase類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateAndAddSignature

import com.ning.http.client.RequestBuilderBase; //導入依賴的package包/類
@Override
public void calculateAndAddSignature(Request request, RequestBuilderBase<?> builder) {
    long now = Long.parseLong(request.getHeaders().getFirstValue("X-Buttercoin-Date"));

    StringBuilder signature = new StringBuilder();
    signature.append(now);
    signature.append(request.getUrl());
    if (request.getStringData() != null && request.getStringData().length() > 0)
        signature.append(request.getStringData());

    builder.addHeader("X-Buttercoin-Access-Key", apiKey);

    Mac mac;
    try {
        mac = (Mac) SHARED_MAC.clone();
        mac.init(signingKey);
    } catch (CloneNotSupportedException | InvalidKeyException e) {
        throw new RuntimeException(e);
    }

    builder.addHeader("X-Buttercoin-Signature", Base64.encode(mac.doFinal(Base64.encode((signature.toString()).getBytes()).getBytes())));
}
 
開發者ID:buttercoin,項目名稱:buttercoin-java,代碼行數:23,代碼來源:HMAC256SignatureCalculator.java

示例2: calculateSignature

import com.ning.http.client.RequestBuilderBase; //導入依賴的package包/類
public static void calculateSignature(Signer signer, Request request, RequestBuilderBase<?> requestBuilder) {
    RequestContent.Builder sigBuilder = new RequestContent.Builder();

    sigBuilder.setRequestTarget(request.getMethod(), getRequestPath(request));
    for (FluentCaseInsensitiveStringsMap.Entry<String, List<String>> entry : request.getHeaders().entrySet()) {
        for (String value : entry.getValue()) {
            sigBuilder.addHeader(entry.getKey(), value);
        }
    }

    if (sigBuilder.build().getDate() == null) {
        sigBuilder.addDateNow();
        requestBuilder.addHeader(Constants.HEADER_DATE, sigBuilder.build().getDate());
    }

    Authorization authz = signer.sign(sigBuilder.build());
    if (authz != null) {
        requestBuilder.setHeader(Constants.AUTHORIZATION, authz.getHeaderValue());
    }
}
 
開發者ID:adamcin,項目名稱:httpsig-java,代碼行數:21,代碼來源:AsyncUtil.java

示例3: calculateAndAddSignature

import com.ning.http.client.RequestBuilderBase; //導入依賴的package包/類
@Override
public void calculateAndAddSignature(Request request, RequestBuilderBase<?> requestBuilder) { }
 
開發者ID:adamcin,項目名稱:httpsig-java,代碼行數:3,代碼來源:AsyncSignatureCalculator.java


注:本文中的com.ning.http.client.RequestBuilderBase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。