当前位置: 首页>>代码示例>>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;未经允许,请勿转载。