Package org.apache.http

Examples of org.apache.http.NameValuePair


        while (cur < indexTo) {
            char ch = buffer.charAt(cur);
            if (ch == '"' && !escaped) {
                qouted = !qouted;
            }
            NameValuePair param = null;
            if (!qouted && ch == ';') {
                param = parse(buffer, from, cur);
                from = cur + 1;
            } else if (cur == indexTo - 1) {
                param = parse(buffer, from, indexTo);
            }
            if (param != null && !(param.getName().length() == 0 && param.getValue() == null)) {
                params.add(param);
            }
            if (escaped) {
                escaped = false;
            } else {
View Full Code Here


    private final NameValuePair[] parameters;

    private BasicHeaderElement(final NameValuePair[] nvps) {
        super();
        if (nvps.length > 0) {
            NameValuePair nvp = nvps[0];
            this.name = nvp.getName();
            this.value = nvp.getValue();
            int len = nvps.length - 1;
            if (len > 0) {
                this.parameters = new NameValuePair[len];
                System.arraycopy(nvps, 1, this.parameters, 0, len);
            } else {
View Full Code Here

     */
    public NameValuePair getParameterByName(final String name) {
        if (name == null) {
            throw new IllegalArgumentException("Name may not be null");
        }
        NameValuePair found = null;
        for (int i = 0; i < this.parameters.length; i++) {
            NameValuePair current = this.parameters[ i ];
            if (current.getName().equalsIgnoreCase(name)) {
                found = current;
                break;
            }
        }
        return found;
View Full Code Here

  private boolean isIgnore( List<NameValuePair> params, String name, String value) {
    for(int i = 0; i < ignores.size(); i++) {
      if(ignores.get(i).equals(name, value)) return true;
    }
    for(int i = 0; i < params.size(); i++) {
      NameValuePair np = params.get(i);
      if(np.getName().equalsIgnoreCase(name)
          && np.getValue().equalsIgnoreCase(value)) return true;
    }
    return false;
  }
View Full Code Here

    private String buildQueryString(Map<String, String> params) {
        ArrayList<NameValuePair> nvs = new ArrayList<NameValuePair>(
                params.size());
        for (Map.Entry<String, String> entry : params.entrySet()) {
            NameValuePair nv = new BasicNameValuePair(entry.getKey(),
                    entry.getValue());
            nvs.add(nv);
        }
        String queryString = URLEncodedUtils.format(nvs, "UTF-8");
        return queryString;
View Full Code Here

    }

    private String buildQueryString(Map<String, String> params) {
        ArrayList<NameValuePair> nvs = new ArrayList<NameValuePair>(params.size());
        for (Map.Entry<String, String> entry : params.entrySet()) {
            NameValuePair nv = new BasicNameValuePair(entry.getKey(), entry.getValue());
            nvs.add(nv);
        }
        String queryString = URLEncodedUtils.format(nvs, "UTF-8");
        return queryString;
    }
View Full Code Here

  private String buildQueryString(Map<String, String> params) {
    ArrayList<NameValuePair> nvs = new ArrayList<NameValuePair>(
        params.size());
    for (Map.Entry<String, String> entry : params.entrySet()) {
      NameValuePair nv = new BasicNameValuePair(entry.getKey(),
          entry.getValue());
      nvs.add(nv);
    }
    String queryString = URLEncodedUtils.format(nvs, "UTF-8");
    return queryString;
View Full Code Here

    }

    private static ContentType create(final HeaderElement helem) {
        String mimeType = helem.getName();
        String charset = null;
        NameValuePair param = helem.getParameterByName("charset");
        if (param != null) {
            charset = param.getValue();
        }
        return create(mimeType, charset);
    }
View Full Code Here

    }

    private static ContentType create(final HeaderElement helem) {
        String mimeType = helem.getName();
        String charset = null;
        NameValuePair param = helem.getParameterByName("charset");
        if (param != null) {
            charset = param.getValue();
        }
        return create(mimeType, charset);
    }
View Full Code Here

        }
        String charset = null;
        if (entity.getContentType() != null) {
            HeaderElement values[] = entity.getContentType().getElements();
            if (values.length > 0) {
                NameValuePair param = values[0].getParameterByName("charset");
                if (param != null) {
                    charset = param.getValue();
                }
            }
        }
        return charset;
    }
View Full Code Here

TOP

Related Classes of org.apache.http.NameValuePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.