本文整理汇总了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())));
}
示例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());
}
}
示例3: calculateAndAddSignature
import com.ning.http.client.RequestBuilderBase; //导入依赖的package包/类
@Override
public void calculateAndAddSignature(Request request, RequestBuilderBase<?> requestBuilder) { }