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


Java HttpUriRequest.getAllHeaders方法代码示例

本文整理汇总了Java中org.apache.http.client.methods.HttpUriRequest.getAllHeaders方法的典型用法代码示例。如果您正苦于以下问题:Java HttpUriRequest.getAllHeaders方法的具体用法?Java HttpUriRequest.getAllHeaders怎么用?Java HttpUriRequest.getAllHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.client.methods.HttpUriRequest的用法示例。


在下文中一共展示了HttpUriRequest.getAllHeaders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: if

import org.apache.http.client.methods.HttpUriRequest; //导入方法依赖的package包/类
private HttpResponse b0449щ0449щщ0449(HttpUriRequest httpUriRequest, Map map, int i) throws Exception {
    URI uri = httpUriRequest.getURI();
    String trim = uri.getHost() != null ? uri.getHost().trim() : "";
    if (trim.length() > 0) {
        httpUriRequest.setHeader("Host", trim);
    }
    if (map != null) {
        for (Object next : map.entrySet()) {
            if (((b04170417041704170417З + b0417ЗЗЗЗ0417) * b04170417041704170417З) % bЗ0417ЗЗЗ0417 != bЗЗЗЗЗ0417) {
                b04170417041704170417З = 81;
                bЗЗЗЗЗ0417 = 31;
            }
            Entry entry = (Entry) next;
            httpUriRequest.setHeader((String) entry.getKey(), (String) entry.getValue());
        }
    }
    Header[] allHeaders = httpUriRequest.getAllHeaders();
    Log.d(b043D043Dнн043Dн, "request URI [" + httpUriRequest.getURI() + "]");
    for (Object obj : allHeaders) {
        Log.d(b043D043Dнн043Dн, "request header [" + obj.toString() + "]");
    }
    HttpConnectionParams.setSoTimeout(this.bнн043Dн043Dн.getParams(), i);
    HttpResponse execute = this.bнн043Dн043Dн.execute(httpUriRequest);
    if (execute != null) {
        return execute;
    }
    throw new RuntimeException("Null response returned.");
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:29,代码来源:ImmersionHttpClient.java

示例2: removeGoogleAuthHeaders

import org.apache.http.client.methods.HttpUriRequest; //导入方法依赖的package包/类
private static void removeGoogleAuthHeaders(HttpUriRequest request) {
  for (Header header : request.getAllHeaders()) {
    if (header.getName().equalsIgnoreCase("Authorization") &&
            header.getValue().startsWith(AUTHORIZATION_HEADER_PREFIX)) {
      Log.i(LOG_TAG, "Removing header:" + header);
      request.removeHeader(header);
    }
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:10,代码来源:ClientLoginHelper.java

示例3: debugHttpRequest

import org.apache.http.client.methods.HttpUriRequest; //导入方法依赖的package包/类
/**
 * デバッグ用.
 * @param req デバッグ出力するRequestオブジェクト
 * @param body デバッグ出力するリクエストボディ
 */
private void debugHttpRequest(final HttpUriRequest req, final String body) {
    log.debug(req.getURI());
    if (log.isDebugEnabled()) {
        log.debug("【Request】 " + req.getMethod() + "  " + req.getURI());
        Header[] headers = req.getAllHeaders();
        for (int i = 0; i < headers.length; i++) {
            log.debug("RequestHeader[" + headers[i].getName() + "] : " + headers[i].getValue());
        }
        log.debug("RequestBody:  " + body);
    }
}
 
开发者ID:personium,项目名称:personium-core,代码行数:17,代码来源:PersoniumRestAdapter.java

示例4: toCurl

import org.apache.http.client.methods.HttpUriRequest; //导入方法依赖的package包/类
/**
 * Generates a cURL command equivalent to the given request.
 */
private static String toCurl(HttpUriRequest request, boolean logAuthToken) throws IOException {
    StringBuilder builder = new StringBuilder();

    builder.append("curl ");

    for (Header header: request.getAllHeaders()) {
        if (!logAuthToken
                && (header.getName().equals("Authorization") ||
                    header.getName().equals("Cookie"))) {
            continue;
        }
        builder.append("--header \"");
        builder.append(header.toString().trim());
        builder.append("\" ");
    }

    URI uri = request.getURI();

    // If this is a wrapped request, use the URI from the original
    // request instead. getURI() on the wrapper seems to return a
    // relative URI. We want an absolute URI.
    if (request instanceof RequestWrapper) {
        HttpRequest original = ((RequestWrapper) request).getOriginal();
        if (original instanceof HttpUriRequest) {
            uri = ((HttpUriRequest) original).getURI();
        }
    }

    builder.append("\"");
    builder.append(uri);
    builder.append("\"");

    if (request instanceof HttpEntityEnclosingRequest) {
        HttpEntityEnclosingRequest entityRequest =
                (HttpEntityEnclosingRequest) request;
        HttpEntity entity = entityRequest.getEntity();
        if (entity != null && entity.isRepeatable()) {
            if (entity.getContentLength() < 1024) {
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                entity.writeTo(stream);
                String entityString = stream.toString();

                // TODO: Check the content type, too.
                builder.append(" --data-ascii \"")
                        .append(entityString)
                        .append("\"");
            } else {
                builder.append(" [TOO MUCH DATA TO INCLUDE]");
            }
        }
    }

    return builder.toString();
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:58,代码来源:AndroidHttpClient.java


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