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


Java NameValuePair.getName方法代码示例

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


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

示例1: decodeExtras

import org.apache.http.NameValuePair; //导入方法依赖的package包/类
private Map<String, String> decodeExtras(String extras) {
    Map<String, String> results = new HashMap<String, String>();
    try {
        URI rawExtras = new URI("?" + extras);
        List<NameValuePair> extraList = URLEncodedUtils.parse(rawExtras, "UTF-8");
        for (NameValuePair item : extraList) {
            String name = item.getName();
            int i = 0;
            while (results.containsKey(name)) {
                name = item.getName() + ++i;
            }
            results.put(name, item.getValue());
        }
    } catch (URISyntaxException e) {
        Log.w(TAG, "Invalid syntax error while decoding extras data from server.");
    }
    return results;
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:19,代码来源:APKExpansionPolicy.java

示例2: parseHeader

import org.apache.http.NameValuePair; //导入方法依赖的package包/类
public HeaderElement parseHeader(
        final CharArrayBuffer buffer,
        final ParserCursor cursor) throws ParseException {
    if (buffer == null) {
        throw new IllegalArgumentException("Char array buffer may not be null");
    }
    if (cursor == null) {
        throw new IllegalArgumentException("Parser cursor may not be null");
    }
    NameValuePair nvp = parseNameValuePair(buffer, cursor);
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    while (!cursor.atEnd()) {
        NameValuePair param = parseNameValuePair(buffer, cursor);
        params.add(param);
    }
    return new BasicHeaderElement(
            nvp.getName(),
            nvp.getValue(), params.toArray(new NameValuePair[params.size()]));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:NetscapeDraftHeaderParser.java

示例3: URLGet

import org.apache.http.NameValuePair; //导入方法依赖的package包/类
/**
     * GET List<NameValuePair>请求
     *
     * @param pathUrl
     * @param params
     * @return
     */
    public static String URLGet(String pathUrl, List<NameValuePair> params) {

        String queryString = "";

        StringBuilder repString = new StringBuilder();

        try {
            String path = pathUrl;
            String keyValue;
            if (null != params && params.size() > 0) {

                for (NameValuePair nvp : params) {
                    String key = nvp.getName();
                    keyValue = nvp.getValue();
                    if (null != keyValue && !"".equals(keyValue)) {
                        queryString = queryString + key + "=" + keyValue + "&";
                    }
                }
            }
            if (!"".equals(queryString)) {
                path = path + "?" + queryString;
            }
            HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier);
            HttpsURLConnection connection = (HttpsURLConnection) (new URL(path)).openConnection();

            // Prepare SSL Context 
            TrustManager[] tm = {ignoreCertificationTrustManger};
//            SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE"); 
            SSLContext sslContext = SSLContext.getInstance("TLS");
            sslContext.init(null, tm, new java.security.SecureRandom());


            // 从上述SSLContext对象中得到SSLSocketFactory对象 
            SSLSocketFactory ssf = sslContext.getSocketFactory();
            connection.setSSLSocketFactory(ssf);

            InputStreamReader isr = new InputStreamReader(connection.getInputStream(), "utf-8");
            BufferedReader br = new BufferedReader(isr);
            String s;
            while (null != (s = br.readLine())) {
                repString.append(s);
            }
            isr.close();
            connection.disconnect();

        } catch (Exception ex) {
            log.error("调用链接失败:pathUrl:" + pathUrl + "queryString:" + queryString);
            ex.printStackTrace();
        } finally {
            log.info(repString.toString());
        }
        return repString.toString();
    }
 
开发者ID:tong12580,项目名称:OutsourcedProject,代码行数:61,代码来源:HttpUtil.java

示例4: ExecuteGetRequest

import org.apache.http.NameValuePair; //导入方法依赖的package包/类
public void ExecuteGetRequest() throws Exception
{
    String MixParams = "";

    if(!ArrayListParams.isEmpty())
    {

        MixParams += "?";

        for(NameValuePair p : ArrayListParams)
        {
            String paramString = p.getName() + "=" + URLEncoder.encode(p.getValue(),"UTF-8");

            if(MixParams.length() > 1)
            {
                MixParams  +=  "&" + paramString;
            }
            else
            {
                MixParams += paramString;
            }
        }
    }

    HttpGet httpGet = new HttpGet(UrlHolder + MixParams);

    for(NameValuePair h : headers)
    {
        httpGet.addHeader(h.getName(), h.getValue());
    }

    executeRequest(httpGet, UrlHolder);
}
 
开发者ID:cdc03819,项目名称:BrewBook,代码行数:34,代码来源:HttpServicesClass.java

示例5: IridiumMessage

import org.apache.http.NameValuePair; //导入方法依赖的package包/类
public IridiumMessage(List<NameValuePair> params) {
    for (NameValuePair param : params) {
        switch (param.getName()) {
            case PARAM_IMEI:
                imei = param.getValue();
                break;
            case PARAM_MOMSN:
                momsn = param.getValue();
                break;
            case PARAM_TRANSMIT_TIME:
                transmitTime = param.getValue();
                break;
            case PARAM_IRIDIUM_LATITUDE:
                iridiumLatitude = param.getValue();
                break;
            case PARAM_IRIDIUM_LONGITUDE:
                iridiumLongitude = param.getValue();
                break;
            case PARAM_IRIDIUM_CEP:
                iridiumCep = param.getValue();
                break;
            case PARAM_DATA:
                data = param.getValue();
                break;
        }
    }
}
 
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:28,代码来源:RockBlockHttpHandler.java

示例6: parametersAsQueryString

import org.apache.http.NameValuePair; //导入方法依赖的package包/类
public String parametersAsQueryString() {
    String s = "";
    for (Iterator<NameValuePair> i = this.params.iterator(); i.hasNext(); ) {
        NameValuePair nv = i.next();
        s += "&" + nv.getName() + "=" + nv.getValue();
    }
    if (s.length() > 0) {
        return "?" + s.substring(1);
    }
    return s;
}
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:12,代码来源:MsTeamsNotificationImpl.java


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