當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。