Codota Logo
NameValuePair.getName
Code IndexAdd Codota to your IDE (free)

How to use
getName
method
in
org.apache.commons.httpclient.NameValuePair

Best Java code snippets using org.apache.commons.httpclient.NameValuePair.getName (Showing top 20 results out of 315)

  • Common ways to obtain NameValuePair
private void myMethod () {
NameValuePair n =
  • Codota IconString name;String value;new NameValuePair(name, value)
  • Codota Iconvalues[0].getParameterByName("charset")
  • Codota Iconnew NameValuePair()
  • Smart code suggestions by Codota
}
origin: commons-httpclient/commons-httpclient

/**
 * Gets the parameter of the specified name. If there exists more than one
 * parameter with the name paramName, then only the first one is returned.
 *
 * @param paramName name of the parameter
 *
 * @return If a parameter exists with the name argument, the coresponding
 *         NameValuePair is returned.  Otherwise null.
 *
 * @since 2.0
 * 
 */
public NameValuePair getParameter(String paramName) {
  LOG.trace("enter PostMethod.getParameter(String)");
  if (paramName == null) {
    return null;
  }
  Iterator iter = this.params.iterator();
  while (iter.hasNext()) {
    NameValuePair parameter = (NameValuePair) iter.next();
    if (paramName.equals(parameter.getName())) {
      return parameter;
    }
  }
  return null;
}
origin: commons-httpclient/commons-httpclient

NameValuePair pair = (NameValuePair) iter.next();
if (paramName.equals(pair.getName())) {
  iter.remove();
  removed = true;
origin: commons-httpclient/commons-httpclient

/**
 * Returns parameter with the given name, if found. Otherwise null 
 * is returned
 *
 * @param name The name to search by.
 * @return NameValuePair parameter with the given name
 */
public NameValuePair getParameterByName(String name) {
  LOG.trace("enter HeaderElement.getParameterByName(String)");
  if (name == null) {
    throw new IllegalArgumentException("Name may not be null");
  } 
  NameValuePair found = null;
  NameValuePair parameters[] = getParameters();
  if (parameters != null) {
    for (int i = 0; i < parameters.length; i++) {
      NameValuePair current = parameters[ i ];
      if (current.getName().equalsIgnoreCase(name)) {
        found = current;
        break;
      }
    }
  }
  return found;
}
origin: commons-httpclient/commons-httpclient

/**
 * Produces textual representaion of the attribute/value pair using 
 * formatting rules defined in RFC 2616
 *  
 * @param buffer output buffer 
 * @param param the parameter to be formatted
 */
public void format(final StringBuffer buffer, final NameValuePair param) {
  if (buffer == null) {
    throw new IllegalArgumentException("String buffer may not be null");
  }
  if (param == null) {
    throw new IllegalArgumentException("Parameter may not be null");
  }
  buffer.append(param.getName());
  String value = param.getValue();
  if (value != null) {
    buffer.append("=");
    formatValue(buffer, value, this.alwaysUseQuotes);
  }
}

origin: commons-httpclient/commons-httpclient

NameValuePair pair = (NameValuePair) iter.next();
if (paramName.equals(pair.getName())
  && paramValue.equals(pair.getValue())) {
  iter.remove();
origin: commons-httpclient/commons-httpclient

/**
 * Adds a new parameter to be used in the POST request body.
 *
 * @param param The parameter to add.
 *
 * @throws IllegalArgumentException if the argument is null or contains
 *         null values
 *
 * @since 2.0
 */
public void addParameter(NameValuePair param) 
throws IllegalArgumentException {
  LOG.trace("enter PostMethod.addParameter(NameValuePair)");
  if (param == null) {
    throw new IllegalArgumentException("NameValuePair may not be null");
  }
  addParameter(param.getName(), param.getValue());
}
origin: commons-httpclient/commons-httpclient

/**
 * Return a name/value string suitable for sending in a <tt>"Cookie"</tt>
 * header as defined in RFC 2109 for backward compatibility with cookie
 * version 0
 * @param buffer The string buffer to use for output
 * @param param The parameter.
 * @param version The cookie version 
 */
private void formatParam(final StringBuffer buffer, final NameValuePair param, int version) {
  if (version < 1) {
    buffer.append(param.getName());
    buffer.append("=");
    if (param.getValue() != null) {
      buffer.append(param.getValue());   
    }
  } else {
    this.formatter.format(buffer, param);
  }
}
origin: commons-httpclient/commons-httpclient

  throw new IllegalArgumentException("Attribute may not be null.");
if (attribute.getName() == null) {
  throw new IllegalArgumentException("Attribute Name may not be null.");
  throw new IllegalArgumentException("Cookie may not be null.");
final String paramName = attribute.getName().toLowerCase();
final String paramValue = attribute.getValue();
origin: commons-httpclient/commons-httpclient

/** 
 * Extracts a map of challenge parameters from an authentication challenge.
 * Keys in the map are lower-cased
 *
 * @param challengeStr the authentication challenge string
 * @return a map of authentication challenge parameters
 * @throws MalformedChallengeException when the authentication challenge string
 *  is malformed
 * 
 * @since 2.0beta1
 */
public static Map extractParams(final String challengeStr)
 throws MalformedChallengeException {
  if (challengeStr == null) {
    throw new IllegalArgumentException("Challenge may not be null"); 
  }
  int idx = challengeStr.indexOf(' ');
  if (idx == -1) {
    throw new MalformedChallengeException("Invalid challenge: " + challengeStr);
  }
  Map map = new HashMap();
  ParameterParser parser = new ParameterParser();
  List params = parser.parse(
    challengeStr.substring(idx + 1, challengeStr.length()), ',');
  for (int i = 0; i < params.size(); i++) {
    NameValuePair param = (NameValuePair) params.get(i);
    map.put(param.getName().toLowerCase(), param.getValue());
  }
  return map;
}
origin: commons-httpclient/commons-httpclient

URLCodec codec = new URLCodec();
NameValuePair pair = pairs[i];
if (pair.getName() != null) {
  if (i > 0) {
    buf.append("&");
  buf.append(codec.encode(pair.getName(), charset));
  buf.append("=");
  if (pair.getValue() != null) {
origin: commons-httpclient/commons-httpclient

/**
 * Constructor with array of characters.
 *
 * @param chars the array of characters
 * @param offset - the initial offset.
 * @param length - the length.
 * 
 * @since 3.0
 */
public HeaderElement(char[] chars, int offset, int length) {
  this();
  if (chars == null) {
    return;
  }
  ParameterParser parser = new ParameterParser();
  List params = parser.parse(chars, offset, length, ';');
  if (params.size() > 0) {
    NameValuePair element = (NameValuePair) params.remove(0);
    setName(element.getName());  
    setValue(element.getValue());
    if (params.size() > 0) {
      this.parameters = (NameValuePair[])
        params.toArray(new NameValuePair[params.size()]);    
    }
  }
}
origin: commons-httpclient/commons-httpclient

  throw new IllegalArgumentException("Cookie may not be null.");
final String paramName = attribute.getName().toLowerCase();
final String paramValue = attribute.getValue();
origin: commons-httpclient/commons-httpclient

for (int j = parameters.length - 1; j >= 0; j--) {
  NameValuePair param = parameters[j];
  attribmap.put(param.getName().toLowerCase(), param);
origin: commons-httpclient/commons-httpclient

  buffer.append(", ");
boolean noQuotes = "nc".equals(param.getName()) ||
          "qop".equals(param.getName());
this.formatter.setAlwaysUseQuotes(!noQuotes);
this.formatter.format(buffer, param);
origin: commons-httpclient/commons-httpclient

  throw new IllegalArgumentException("Cookie may not be null.");
final String paramName = attribute.getName().toLowerCase();
final String paramValue = attribute.getValue();
origin: commons-httpclient/commons-httpclient

  throw new IllegalArgumentException("Cookie may not be null.");
final String paramName = attribute.getName().toLowerCase();
String paramValue = attribute.getValue();
origin: apache/cloudstack

/**
 * Builds parameters string with command and encoded param values
 * @param command
 * @param params
 * @return
 */
protected static String buildParams(String command, List<NameValuePair> params) {
  StringBuffer paramString = new StringBuffer("command=" + command);
  Iterator<NameValuePair> iter = params.iterator();
  try {
    while (iter.hasNext()) {
      NameValuePair param = iter.next();
      if (param.getValue() != null && !(param.getValue().isEmpty())) {
        paramString.append("&" + param.getName() + "=" + URLEncoder.encode(param.getValue(), "UTF-8"));
      }
    }
  } catch (UnsupportedEncodingException e) {
    s_logger.error(e.getMessage());
    return null;
  }
  return paramString.toString();
}
origin: info.kwarc.sally4/sally4-servlet

  @Override
  public void process(Exchange exchange) throws Exception {
    HashMap<String, String> result = new HashMap<String, String>();
    for (NameValuePair pairs  : (List<NameValuePair>) parser.parse(exchange.getIn().getHeader(Exchange.HTTP_QUERY, String.class), '&')) {
      result.put(pairs.getName(), pairs.getValue());
    }
    exchange.getIn().setHeader(QueryMapHeader, result);
  }
}
origin: org.jenkins-ci/htmlunit

/**
 * {@inheritDoc}
 */
public String getResponseHeaderValue(final String headerName) {
  for (final NameValuePair pair : responseData_.getResponseHeaders()) {
    if (pair.getName().equalsIgnoreCase(headerName)) {
      return pair.getValue();
    }
  }
  return null;
}
origin: net.disy.htmlunit/htmlunit

/**
 * {@inheritDoc}
 */
public String getResponseHeaderValue(final String headerName) {
  for (final NameValuePair pair : responseData_.getResponseHeaders()) {
    if (pair.getName().equalsIgnoreCase(headerName)) {
      return pair.getValue();
    }
  }
  return null;
}
org.apache.commons.httpclientNameValuePairgetName

Javadoc

Return the name.

Popular methods of NameValuePair

  • <init>
    Constructor.
  • getValue
    Return the current value.
  • setName
    Set the name.
  • setValue
    Set the value.
  • toString
    Get a String representation of this pair.

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JButton (javax.swing)
  • JFileChooser (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now