java.net.URLConnection.getRequestProperties()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(233)

本文整理了Java中java.net.URLConnection.getRequestProperties()方法的一些代码示例,展示了URLConnection.getRequestProperties()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URLConnection.getRequestProperties()方法的具体详情如下:
包路径:java.net.URLConnection
类名称:URLConnection
方法名:getRequestProperties

URLConnection.getRequestProperties介绍

[英]Returns an unmodifiable map of general request properties used by this connection. The request property names are the key values of the map. The map values are lists of property values of the corresponding key name.
[中]返回此连接使用的常规请求属性的不可修改映射。请求属性名是映射的键值。映射值是对应键名的属性值列表。

代码示例

代码示例来源:origin: lingochamp/FileDownloader

@Override
public Map<String, List<String>> getRequestHeaderFields() {
  return mConnection.getRequestProperties();
}

代码示例来源:origin: lingochamp/okdownload

@Override
public Map<String, List<String>> getRequestProperties() {
  return connection.getRequestProperties();
}

代码示例来源:origin: square/okhttp

Map<String, List<String>> requestProperties = urlConnection.getRequestProperties();
Headers.Builder result = new Headers.Builder();
for (String fieldName : varyFields) {

代码示例来源:origin: lingochamp/okdownload

@Test
public void getRequestProperties() throws Exception {
  when(urlConnection.getRequestProperties()).thenReturn(headerFields);
  assertThat(downloadUrlConnection.getRequestProperties()).isEqualTo(headerFields);
}

代码示例来源:origin: org.eclipse.jetty.osgi/jetty-osgi-boot-warurl

@Override
public Map<String, List<String>> getRequestProperties()
{
  return _conn.getRequestProperties();
}

代码示例来源:origin: freeplane/freeplane

public Map<String, List<String>> getRequestProperties() {
  return connection.getRequestProperties();
}

代码示例来源:origin: edu.ucar/cdm

static private void showRequestHeaders(String urlString, java.net.URLConnection connection) {
 System.out.println("\nREQUEST Properties for " + urlString + ": ");
  Map<String,List<String>> reqs = connection.getRequestProperties();
  for (Map.Entry<String,List<String>> entry : reqs.entrySet()) {
   System.out.printf(" %s:", entry.getKey());
   for (String v : entry.getValue()) System.out.printf("%s,", v);
   System.out.printf("%n");
  }
}

代码示例来源:origin: Unidata/thredds

static private void showRequestHeaders(String urlString, java.net.URLConnection connection) {
 System.out.println("\nREQUEST Properties for " + urlString + ": ");
  Map<String,List<String>> reqs = connection.getRequestProperties();
  for (Map.Entry<String,List<String>> entry : reqs.entrySet()) {
   System.out.printf(" %s:", entry.getKey());
   for (String v : entry.getValue()) System.out.printf("%s,", v);
   System.out.printf("%n");
  }
}

代码示例来源:origin: badqiu/rapid-framework

private void setConnectionHeaders(String urlString, URLConnection conn) {
    conn.setReadTimeout(6000);
    conn.setConnectTimeout(6000);
    String cookie = getCookieString();
    conn.setRequestProperty("Cookie", cookie);
    //TODO: 用于支持 httpinclude_header.properties
//        conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3");
//        conn.setRequestProperty("Host", url.getHost());
    if(log.isDebugEnabled()) {
      log.debug("request properties:"+conn.getRequestProperties()+" for url:"+urlString);
    }
  }

代码示例来源:origin: stackoverflow.com

URL url = new URL(str_url);
    HttpURLConnection conection = (HttpURLConnection) url.openConnection();
    conection.setConnectTimeout(TIMEOUT_SOCKET);
    conection.setReadTimeout(TIMEOUT_CONNECTION);
    conection.addRequestProperty("Accept-Encoding", "gzip");
    RedirectLocations locations = new RedirectLocations();
    // here u get all header fields and properties write it in logs
    conection.getHeaderFields();
    conection.getRequestProperties();
 //      conection.getOutputStream().write(buffer);
   // download the file
    InputStream is = conection.getInputStream();
    // This is file path were a; quiz data will get saved. 
   // String file_path = context.getDir(folder,Activity.MODE_PRIVATE).getAbsolutePath();
    return unzip(is,save_file_path);

代码示例来源:origin: org.htmlparser/htmlparser

buffer.append (connection.getURL ());
buffer.append (" HTTP/1.1\n");
map  = connection.getRequestProperties ();
for (Iterator iter = map.keySet ().iterator (); iter.hasNext (); )

代码示例来源:origin: edu.ucar/netcdf

Map reqs = connection.getRequestProperties();
Iterator reqIter = reqs.keySet().iterator();
while (reqIter.hasNext()) {

代码示例来源:origin: edu.ucar/netcdf

Map reqs = connection.getRequestProperties();
Iterator reqIter = reqs.keySet().iterator();
while (reqIter.hasNext()) {

代码示例来源:origin: com.squareup.okhttp3/okhttp-android-support

Map<String, List<String>> requestProperties = urlConnection.getRequestProperties();
Headers.Builder result = new Headers.Builder();
for (String fieldName : varyFields) {

相关文章

URLConnection类方法